* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.form-section, .preview-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.form-section h2, .preview-section h2 {
    margin-bottom: 20px;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #4a5568;
    font-weight: 600;
}

.form-group select,
.form-group input[type="text"],
.form-group input[type="color"],
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group select:focus,
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.template-item {
    cursor: pointer;
    border: 3px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s;
}

.template-item:hover {
    transform: scale(1.05);
}

.template-item.selected {
    border-color: #667eea;
    box-shadow: 0 0 0 2px #667eea;
}

.template-item img {
    width: 100%;
    height: 100px;
    object-fit: cover;
}

.template-item span {
    display: block;
    text-align: center;
    padding: 5px;
    background: #f7fafc;
    font-size: 12px;
}

.btn-primary {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.preview-section {
    background: #f8f9fa;
}

.card-preview {
    min-height: 400px;
    background: #dee2e6;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.preview-placeholder {
    color: #6c757d;
    font-style: italic;
}

.preview-content {
    width: 100%;
    height: 100%;
    position: relative;
}

.preview-content img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-text {
    position: absolute;
    left: 0;
    right: 0;
    padding: 20px;
    text-align: center;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    font-weight: bold;
}

.preview-text.top { top: 20px; }
.preview-text.center { top: 50%; transform: translateY(-50%); }
.preview-text.bottom { bottom: 20px; }

.result-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-top: 30px;
}

.result-section h2 {
    margin-bottom: 20px;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

.card-result {
    text-align: center;
}

.card-result img {
    max-width: 100%;
    max-height: 500px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    margin-bottom: 20px;
}

.card-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-success, .btn-secondary {
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: transform 0.3s;
}

.btn-success {
    background: #48bb78;
    color: white;
}

.btn-success:hover {
    background: #38a169;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #a0aec0;
    color: white;
}

.btn-secondary:hover {
    background: #718096;
    transform: translateY(-2px);
}

.watermark-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e2e8f0;
    color: #718096;
    font-size: 14px;
}

footer {
    text-align: center;
    margin-top: 40px;
    color: white;
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .card-actions {
        flex-direction: column;
    }
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}