/* ===== Variables CSS ===== */
:root {
    /* Colores principales */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #ec4899;
    --accent: #f59e0b;
    
    /* Gradientes */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-accent: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-dark: linear-gradient(135deg, #1e1e2e 0%, #2a2a3e 100%);
    
    /* Colores de fondo */
    --bg-primary: #0f0f1e;
    --bg-secondary: #1a1a2e;
    --bg-card: rgba(26, 26, 46, 0.6);
    --bg-input: rgba(255, 255, 255, 0.05);
    
    /* Texto */
    --text-primary: #ffffff;
    --text-secondary: #a0a0b8;
    --text-muted: #6b6b8a;
    
    /* Bordes */
    --border-color: rgba(255, 255, 255, 0.1);
    --border-radius: 16px;
    --border-radius-sm: 8px;
    
    /* Sombras */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
    
    /* Transiciones */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset y Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(236, 72, 153, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== Header ===== */
.header {
    padding: 32px 0;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    text-align: center;
}

.logo {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 3rem;
    filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.5));
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 400;
}

/* ===== Main Content ===== */
.main-content {
    padding: 48px 0;
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 32px;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

.card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* ===== Form Styles ===== */
.banner-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.label-icon {
    font-size: 1.2rem;
}

.form-input,
.form-select,
.form-textarea {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-select {
    cursor: pointer;
}

/* ===== Advanced Options ===== */
.advanced-options {
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
}

.toggle-advanced {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--primary-light);
    font-size: 1rem;
    font-weight: 600;
    padding: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.toggle-advanced:hover {
    background: rgba(99, 102, 241, 0.1);
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.toggle-advanced.active .toggle-icon {
    transform: rotate(180deg);
}

.advanced-content {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ===== Upload Areas ===== */
.upload-section {
    margin-top: 8px;
}

.upload-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.upload-area {
    background: var(--bg-input);
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 16px;
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-area.dragover {
    border-color: var(--primary-light);
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 12px;
    filter: grayscale(0.5);
}

.upload-text {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.upload-hint {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.upload-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.preview-item {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    border: 2px solid var(--border-color);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: var(--transition);
}

.preview-remove:hover {
    background: var(--secondary);
    transform: scale(1.1);
}

/* ===== Buttons ===== */
.btn-generate {
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    padding: 16px 32px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    margin-top: 16px;
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn-generate:active {
    transform: translateY(0);
}

.btn-generate:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    font-size: 1.5rem;
}

.btn-close {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.2rem;
}

.btn-close:hover {
    background: var(--secondary);
    border-color: var(--secondary);
    color: white;
}

/* ===== Loading Overlay ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 15, 30, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
}

.spinner {
    width: 80px;
    height: 80px;
    border: 4px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.loading-subtext {
    color: var(--text-secondary);
}

/* ===== Results Section ===== */
.results-section {
    margin-top: 32px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.result-item {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
}

.result-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.result-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--bg-secondary);
}

.result-actions {
    padding: 16px;
    display: flex;
    gap: 8px;
}

.btn-download {
    flex: 1;
    background: var(--gradient-accent);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    padding: 10px 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ===== History Section ===== */
.history-section {
    margin-top: 48px;
}

.history-grid {
    display: grid;
    gap: 16px;
}

.history-item {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
    cursor: pointer;
}

.history-item:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.history-info h4 {
    font-weight: 600;
    margin-bottom: 8px;
}

.history-meta {
    display: flex;
    gap: 16px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.history-badge {
    background: var(--gradient-primary);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 48px;
    font-size: 1.1rem;
}

/* ===== Footer ===== */
.footer {
    margin-top: 64px;
    padding: 32px 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
}

/* ===== Utility Classes ===== */
.hidden {
    display: none !important;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .card {
        padding: 20px;
    }
    
    .logo {
        font-size: 2rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Animaciones ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.5s ease-out;
}
