/* ===== CSS VARIABLES - FUTURISTIC THEME ===== */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-tertiary: #1a2035;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-glass: rgba(255, 255, 255, 0.03);
    
    --accent-primary: #00d4ff;
    --accent-secondary: #7c3aed;
    --accent-tertiary: #06ffa5;
    --accent-pink: #ff006e;
    --accent-orange: #ff8c00;
    
    --gradient-primary: linear-gradient(135deg, #00d4ff, #7c3aed);
    --gradient-secondary: linear-gradient(135deg, #7c3aed, #ff006e);
    --gradient-accent: linear-gradient(135deg, #06ffa5, #00d4ff);
    --gradient-warm: linear-gradient(135deg, #ff006e, #ff8c00);
    
    --text-primary: #f0f4ff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --border-color: rgba(0, 212, 255, 0.15);
    --border-glow: rgba(0, 212, 255, 0.3);
    
    --shadow-neon: 0 0 20px rgba(0, 212, 255, 0.15);
    --shadow-neon-strong: 0 0 30px rgba(0, 212, 255, 0.25);
    --shadow-purple: 0 0 20px rgba(124, 58, 237, 0.2);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    --font-heading: 'Sora', 'Be Vietnam Pro', sans-serif;
    --font-body: 'Be Vietnam Pro', -apple-system, sans-serif;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ===== ANIMATED BACKGROUND PARTICLES ===== */
.bg-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-particles::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(ellipse at 20% 50%, rgba(0, 212, 255, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(124, 58, 237, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(255, 0, 110, 0.03) 0%, transparent 50%);
    animation: bgShift 20s ease-in-out infinite;
}

@keyframes bgShift {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-2%, 1%) rotate(1deg); }
    66% { transform: translate(1%, -2%) rotate(-1deg); }
}

.particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: floatParticle linear infinite;
}

@keyframes floatParticle {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-10vh) scale(1);
        opacity: 0;
    }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}

/* ===== APP CONTAINER ===== */
.app-container {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* ===== HEADER ===== */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    box-shadow: var(--shadow-neon);
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    box-shadow: var(--shadow-neon);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: var(--shadow-neon); }
    50% { box-shadow: var(--shadow-neon-strong); }
}

.logo-text h1 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
}

.logo-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* ===== BUTTONS ===== */
.btn-icon {
    width: 42px;
    height: 42px;
    border: 1px solid var(--border-color);
    background: var(--bg-glass);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: var(--transition);
    position: relative;
}

.btn-icon:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    box-shadow: var(--shadow-neon);
    background: rgba(0, 212, 255, 0.05);
}

.btn-icon .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent-pink);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    padding: 10px 24px;
    background: var(--gradient-primary);
    border: none;
    color: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    box-shadow: var(--shadow-neon-strong);
    transform: translateY(-1px);
}

.btn-secondary {
    padding: 10px 24px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: var(--transition);
}

.btn-secondary:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.btn-generate {
    width: 100%;
    padding: 14px 28px;
    background: var(--gradient-primary);
    border: none;
    color: white;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 1px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    margin-top: 16px;
}

.btn-generate::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.6s;
}

.btn-generate:hover::before {
    left: 100%;
}

.btn-generate:hover {
    box-shadow: var(--shadow-neon-strong);
    transform: translateY(-2px);
}

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

.btn-generate .btn-content,
.btn-generate .btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-generate .btn-loading.hidden,
.btn-generate .btn-content.hidden {
    display: none;
}

/* ===== SPINNER ===== */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ===== TAB NAVIGATION ===== */
.tab-nav {
    display: flex;
    gap: 6px;
    padding: 6px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-neon);
}

.tab-btn i {
    font-size: 1rem;
}

/* ===== TAB CONTENT ===== */
.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== PANEL HEADER ===== */
.panel-header {
    margin-bottom: 24px;
}

.panel-header h2 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-header h2 i {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.panel-header p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===== GENERATOR LAYOUT ===== */
.generator-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

/* ===== INPUT SECTION ===== */
.input-section {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-neon);
}

/* ===== MODE TOGGLE ===== */
.mode-toggle {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.mode-btn {
    flex: 1;
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: var(--transition);
}

.mode-btn:hover {
    color: var(--text-secondary);
}

.mode-btn.active {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
    box-shadow: inset 0 0 0 1px var(--border-color);
}

/* ===== INPUT GROUPS ===== */
.input-group {
    margin-bottom: 16px;
}

.input-group.hidden {
    display: none;
}

.input-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-label i {
    color: var(--accent-primary);
    font-size: 0.75rem;
}

.cyber-textarea {
    width: 100%;
    padding: 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
    transition: var(--transition);
    outline: none;
}

.cyber-textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.cyber-textarea::placeholder {
    color: var(--text-muted);
}

.cyber-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: var(--transition);
    outline: none;
}

.cyber-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.cyber-input::placeholder {
    color: var(--text-muted);
}

.cyber-select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.cyber-select:focus {
    border-color: var(--accent-primary);
}

.cyber-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.prompt-extras {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

/* ===== RESOLUTION SELECTOR ===== */
.resolution-selector {
    margin-top: 14px;
}

.resolution-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.res-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 10px 6px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.res-btn:hover {
    border-color: var(--accent-primary);
    background: rgba(0, 212, 255, 0.04);
}

.res-btn.active {
    border-color: var(--accent-primary);
    background: rgba(0, 212, 255, 0.08);
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.15), inset 0 0 12px rgba(0, 212, 255, 0.05);
}

.res-btn.active .res-value {
    color: var(--accent-primary);
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
}

.res-btn.active .res-label {
    color: var(--text-secondary);
}

.res-value {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    transition: var(--transition);
}

.res-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.res-btn-premium {
    position: relative;
}

.res-btn-premium::after {
    content: 'PRO';
    position: absolute;
    top: 3px;
    right: 3px;
    font-size: 0.5rem;
    font-weight: 800;
    font-family: var(--font-heading);
    padding: 1px 4px;
    background: var(--gradient-warm);
    color: white;
    border-radius: 3px;
    letter-spacing: 0.5px;
}

.res-btn-premium.active {
    border-color: var(--accent-pink);
    background: rgba(255, 0, 110, 0.06);
    box-shadow: 0 0 12px rgba(255, 0, 110, 0.15), inset 0 0 12px rgba(255, 0, 110, 0.04);
}

.res-btn-premium.active .res-value {
    color: var(--accent-pink);
    text-shadow: 0 0 8px rgba(255, 0, 110, 0.4);
}

@media (max-width: 480px) {
    .resolution-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== IMAGE COUNT SELECTOR ===== */
.image-count-selector {
    margin-top: 14px;
}

.count-buttons {
    display: flex;
    gap: 6px;
}

.count-btn {
    width: 42px;
    height: 38px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.count-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.count-btn.active {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.15);
}

/* ===== MULTI RESULT GRID ===== */
.output-section-multi {
    flex-direction: column;
    align-items: stretch;
}

.multi-result-grid {
    display: grid;
    gap: 16px;
    width: 100%;
}

.multi-result-grid.hidden {
    display: none;
}

.multi-result-grid.grid-1 { grid-template-columns: 1fr; }
.multi-result-grid.grid-2 { grid-template-columns: 1fr 1fr; }
.multi-result-grid.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.multi-result-grid.grid-4 { grid-template-columns: 1fr 1fr; }
.multi-result-grid.grid-5 { grid-template-columns: 1fr 1fr 1fr; }

.multi-result-item {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    background: var(--bg-primary);
}

.multi-result-item:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-neon);
}

.multi-result-item img {
    width: 100%;
    display: block;
    cursor: pointer;
}

.multi-result-item .item-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    color: var(--accent-primary);
    font-family: var(--font-heading);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    letter-spacing: 0.5px;
}

.multi-result-item .item-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: var(--transition);
}

.multi-result-item:hover .item-actions {
    opacity: 1;
}

.multi-result-item .item-actions button {
    width: 30px;
    height: 30px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    border: none;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.multi-result-item .item-actions button:hover {
    background: var(--accent-primary);
}

.multi-result-item .item-download-bar {
    display: flex;
    gap: 4px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
}

.multi-result-item .item-download-bar button {
    flex: 1;
    padding: 4px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 4px;
    font-family: var(--font-heading);
    font-size: 0.6rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.multi-result-item .item-download-bar button:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Placeholder for loading */
.multi-result-item.loading {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.multi-result-item.loading .spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(0, 212, 255, 0.2);
    border-top-color: var(--accent-primary);
}

/* ===== GENERATION PROGRESS ===== */
.generation-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    width: 100%;
}

.generation-progress.hidden { display: none; }

.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 3px;
    transition: width 0.4s ease;
    width: 0%;
}

.progress-text {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    color: var(--accent-primary);
    min-width: 40px;
    text-align: right;
}

@media (max-width: 768px) {
    .multi-result-grid.grid-3,
    .multi-result-grid.grid-5 {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .multi-result-grid.grid-2,
    .multi-result-grid.grid-3,
    .multi-result-grid.grid-4,
    .multi-result-grid.grid-5 {
        grid-template-columns: 1fr;
    }
    .count-btn { width: 36px; height: 34px; font-size: 0.8rem; }
}

/* ===== FACE + PRODUCT UPLOAD ROW ===== */
.extras-upload-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 16px;
}

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

.mini-upload {
    min-height: 100px !important;
    padding: 14px !important;
    position: relative;
}

.mini-upload .upload-placeholder i {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.mini-upload .upload-placeholder p {
    font-size: 0.75rem;
}

.mini-upload .upload-preview {
    max-height: 90px;
}

.btn-clear-upload {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    background: rgba(255, 0, 110, 0.8);
    border: none;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: var(--transition);
    line-height: 1;
}

.btn-clear-upload:hover {
    background: var(--accent-pink);
    transform: scale(1.1);
}

.btn-clear-upload.hidden {
    display: none;
}

.cyber-select-sm {
    padding: 6px 10px;
    font-size: 0.75rem;
}

@media (max-width: 480px) {
    .extras-upload-row {
        grid-template-columns: 1fr;
    }
}

/* ===== DOWNLOAD BAR ===== */
.download-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.download-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-right: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.download-label i {
    color: var(--accent-primary);
}

.btn-download-res {
    padding: 6px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    transition: var(--transition);
}

.btn-download-res:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(0, 212, 255, 0.06);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.15);
}

.btn-download-premium {
    position: relative;
}

.btn-download-premium::after {
    content: 'PRO';
    position: absolute;
    top: -6px;
    right: -6px;
    font-size: 0.45rem;
    font-weight: 800;
    padding: 1px 3px;
    background: var(--gradient-warm);
    color: white;
    border-radius: 3px;
    letter-spacing: 0.5px;
}

.btn-download-premium:hover {
    border-color: var(--accent-pink);
    color: var(--accent-pink);
    background: rgba(255, 0, 110, 0.06);
    box-shadow: 0 0 10px rgba(255, 0, 110, 0.15);
}

/* ===== UPLOAD ZONE ===== */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
    margin-bottom: 12px;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-zone:hover {
    border-color: var(--accent-primary);
    background: rgba(0, 212, 255, 0.02);
}

.upload-zone.dragover {
    border-color: var(--accent-primary);
    background: rgba(0, 212, 255, 0.05);
    box-shadow: var(--shadow-neon);
}

.upload-placeholder {
    pointer-events: none;
}

.upload-placeholder i {
    font-size: 2.5rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: block;
}

.upload-placeholder p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.upload-placeholder span {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.upload-preview {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.upload-preview.hidden {
    display: none;
}

/* ===== OUTPUT SECTION ===== */
.output-section {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-neon);
}

.output-placeholder {
    text-align: center;
    padding: 40px;
}

.output-placeholder i {
    font-size: 4rem;
    color: var(--text-muted);
    opacity: 0.3;
    margin-bottom: 16px;
    display: block;
}

.output-placeholder p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.output-result {
    width: 100%;
}

.output-result.hidden {
    display: none;
}

.result-image-wrapper {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.result-image-wrapper img {
    width: 100%;
    display: block;
    border-radius: var(--radius-md);
}

.result-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: var(--transition);
}

.result-image-wrapper:hover .result-actions {
    opacity: 1;
}

.btn-action {
    width: 38px;
    height: 38px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: var(--transition);
}

.btn-action:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-neon);
}

.result-info {
    margin-top: 16px;
}

.result-tag {
    display: inline-block;
    padding: 4px 12px;
    background: var(--gradient-primary);
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.result-tag.bg-tag {
    background: var(--gradient-secondary);
}

.result-prompt {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.5;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== FILTER BAR ===== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.filter-btn:hover {
    color: var(--text-secondary);
    border-color: var(--text-muted);
}

.filter-btn.active {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
}

.search-box {
    margin-left: auto;
    position: relative;
    min-width: 220px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.search-box .cyber-input {
    padding-left: 36px;
}

/* ===== TEMPLATES GRID ===== */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.template-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.template-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-neon);
    transform: translateY(-3px);
}

.template-card-image {
    width: 100%;
    aspect-ratio: auto;
    max-height: 500px;
    object-fit: contain;
    display: block;
    background: #0a0e1a;
}

.template-card-body {
    padding: 10px 12px;
}

.template-card-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.template-card-name span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.template-card-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.template-card-type.model-type {
    background: rgba(0, 212, 255, 0.15);
    color: var(--accent-primary);
}

.template-card-type.bg-type {
    background: rgba(124, 58, 237, 0.15);
    color: var(--accent-secondary);
}

.template-card-prompt {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}

.template-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}

.template-tag {
    padding: 1px 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.65rem;
    color: var(--text-muted);
}

.template-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.template-date {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.template-card-actions {
    display: flex;
    gap: 4px;
}

.template-card-actions button {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    transition: var(--transition);
}

.template-card-actions button:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.template-card-actions button.btn-delete:hover {
    border-color: var(--accent-pink);
    color: var(--accent-pink);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state.hidden {
    display: none;
}

.empty-state i {
    font-size: 4rem;
    color: var(--text-muted);
    opacity: 0.3;
    margin-bottom: 20px;
    display: block;
}

.empty-state h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===== MODALS ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5), var(--shadow-neon);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h3 i {
    color: var(--accent-primary);
}

.btn-close {
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-close:hover {
    border-color: var(--accent-pink);
    color: var(--accent-pink);
    background: rgba(255, 0, 110, 0.1);
}

.modal-body {
    padding: 24px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.api-key-input {
    display: flex;
    gap: 8px;
}

.api-key-input .cyber-input {
    flex: 1;
}

.input-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.input-hint a {
    color: var(--accent-primary);
    text-decoration: none;
}

.input-hint a:hover {
    text-decoration: underline;
}

.save-preview {
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: 8px;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

.save-preview img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    display: block;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

/* ===== FULLSCREEN MODAL ===== */
.fullscreen-modal {
    max-width: 95vw;
    max-height: 95vh;
    background: transparent;
    border: none;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.fullscreen-modal img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.fullscreen-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: toastIn 0.3s ease;
    backdrop-filter: blur(10px);
}

.toast.toast-success {
    background: rgba(6, 255, 165, 0.15);
    border: 1px solid rgba(6, 255, 165, 0.3);
    color: var(--accent-tertiary);
}

.toast.toast-error {
    background: rgba(255, 0, 110, 0.15);
    border: 1px solid rgba(255, 0, 110, 0.3);
    color: var(--accent-pink);
}

.toast.toast-info {
    background: rgba(0, 212, 255, 0.15);
    border: 1px solid rgba(0, 212, 255, 0.3);
    color: var(--accent-primary);
}

.toast.toast-out {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .generator-layout {
        grid-template-columns: 1fr;
    }
    
    .output-section {
        min-height: 300px;
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 12px;
    }
    
    .app-header {
        padding: 12px 16px;
    }
    
    .logo-text h1 {
        font-size: 1rem;
    }
    
    .logo-subtitle {
        display: none;
    }
    
    .tab-btn span {
        display: none;
    }
    
    .tab-btn {
        padding: 12px 16px;
    }
    
    .tab-btn i {
        font-size: 1.1rem;
    }
    
    .prompt-extras {
        grid-template-columns: 1fr;
    }
    
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-bar .filter-btn {
        flex: 1;
    }
    
    .search-box {
        margin-left: 0;
        min-width: auto;
    }
    
    .templates-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
    
    .modal {
        max-width: 100%;
        margin: 10px;
    }
    
    .toast-container {
        left: 12px;
        right: 12px;
        bottom: 12px;
    }
    
    .toast {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .templates-grid {
        grid-template-columns: 1fr;
    }
    
    .mode-btn {
        font-size: 0.8rem;
        padding: 8px 12px;
    }
    
    .panel-header h2 {
        font-size: 1.1rem;
    }
}

/* ===== UTILITY CLASSES ===== */
.hidden {
    display: none !important;
}

/* ===== GLOW EFFECTS ===== */
@keyframes glowPulse {
    0%, 100% {
        filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.3));
    }
    50% {
        filter: drop-shadow(0 0 16px rgba(0, 212, 255, 0.5));
    }
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 26, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    border-radius: var(--radius-lg);
    z-index: 10;
}

.loading-overlay .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 212, 255, 0.2);
    border-top-color: var(--accent-primary);
}

.loading-overlay p {
    color: var(--accent-primary);
    font-size: 0.9rem;
    font-weight: 500;
}

/* ===== SCAN LINE EFFECT ===== */
.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--gradient-primary);
    animation: scanLine 2s linear infinite;
    opacity: 0.5;
}

@keyframes scanLine {
    0% { top: 0; }
    100% { top: 100%; }
}

/* ===== SETTINGS EXTRAS ===== */
.settings-divider {
    height: 1px;
    background: var(--border-color);
    margin: 20px 0 16px;
}

.settings-section-title {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.settings-section-title i {
    font-size: 0.85rem;
}

/* ===== RANGE SLIDER ===== */
.slider-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.cyber-range {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.cyber-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--gradient-primary);
    cursor: pointer;
    box-shadow: var(--shadow-neon);
    border: 2px solid var(--bg-secondary);
    transition: var(--transition);
}

.cyber-range::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: var(--shadow-neon-strong);
}

.cyber-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--gradient-primary);
    cursor: pointer;
    border: 2px solid var(--bg-secondary);
}

.slider-value {
    min-width: 36px;
    text-align: center;
    padding: 4px 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: 0.8rem;
    color: var(--accent-primary);
    font-weight: 600;
}

/* ===== AI ENHANCE TOGGLE ===== */
.ai-enhance-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(0, 212, 255, 0.03);
    border: 1px solid rgba(0, 212, 255, 0.1);
    border-radius: var(--radius-sm);
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--accent-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
    background: var(--accent-primary);
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
}

.toggle-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.toggle-label i {
    color: var(--accent-primary);
    margin-right: 4px;
}

/* ===== ENHANCED PROMPT PREVIEW ===== */
.enhanced-prompt-preview {
    margin-top: 12px;
    padding: 14px;
    background: rgba(124, 58, 237, 0.05);
    border: 1px solid rgba(124, 58, 237, 0.15);
    border-radius: var(--radius-sm);
    animation: fadeIn 0.3s ease;
}

.enhanced-prompt-preview.hidden {
    display: none;
}

.enhanced-prompt-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.6;
    max-height: 120px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ===== STEP INDICATOR ===== */
.step-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.step-indicator .step {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.step-indicator .step.active {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(0, 212, 255, 0.05);
}

.step-indicator .step.done {
    border-color: var(--accent-tertiary);
    color: var(--accent-tertiary);
    background: rgba(6, 255, 165, 0.05);
}

.step-indicator .step-arrow {
    color: var(--text-muted);
    font-size: 0.7rem;
}

/* ===== SETTINGS TAB ===== */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 28px;
}

.settings-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
}

.settings-card:hover {
    border-color: rgba(0, 212, 255, 0.25);
    box-shadow: var(--shadow-neon);
}

.settings-card-wide {
    grid-column: 1 / -1;
}

.settings-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.01);
}

.settings-card-header h3 {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.settings-card-header p {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.settings-card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.settings-card-icon.key-icon {
    background: rgba(0, 212, 255, 0.1);
    color: var(--accent-primary);
    border: 1px solid rgba(0, 212, 255, 0.15);
}

.settings-card-icon.brain-icon {
    background: rgba(124, 58, 237, 0.1);
    color: var(--accent-secondary);
    border: 1px solid rgba(124, 58, 237, 0.15);
}

.settings-card-icon.image-icon {
    background: rgba(6, 255, 165, 0.1);
    color: var(--accent-tertiary);
    border: 1px solid rgba(6, 255, 165, 0.15);
}

.settings-card-icon.temp-icon {
    background: rgba(255, 140, 0, 0.1);
    color: var(--accent-orange);
    border: 1px solid rgba(255, 140, 0, 0.15);
}

.settings-card-icon.res-icon {
    background: rgba(255, 0, 110, 0.1);
    color: var(--accent-pink);
    border: 1px solid rgba(255, 0, 110, 0.15);
}

.settings-card-icon.openai-icon {
    background: rgba(16, 163, 127, 0.1);
    color: #10a37f;
    border: 1px solid rgba(16, 163, 127, 0.15);
}

.settings-card-body {
    padding: 20px;
}

/* API Key Input Row */
.settings-card .api-key-input {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.settings-card .api-key-input .cyber-input {
    flex: 1;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.8rem;
    white-space: nowrap;
}

/* API Status Indicator */
.api-status {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.api-status-none {
    background: rgba(100, 116, 139, 0.1);
    border: 1px solid rgba(100, 116, 139, 0.2);
    color: var(--text-muted);
}
.api-status-none .status-dot {
    background: var(--text-muted);
}

.api-status-idle {
    background: rgba(255, 140, 0, 0.08);
    border: 1px solid rgba(255, 140, 0, 0.2);
    color: var(--accent-orange);
}
.api-status-idle .status-dot {
    background: var(--accent-orange);
    animation: statusBlink 2s ease infinite;
}

.api-status-testing {
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.2);
    color: var(--accent-primary);
}
.api-status-testing .status-dot {
    background: var(--accent-primary);
    animation: statusBlink 0.6s ease infinite;
}

.api-status-connected {
    background: rgba(6, 255, 165, 0.08);
    border: 1px solid rgba(6, 255, 165, 0.2);
    color: var(--accent-tertiary);
}
.api-status-connected .status-dot {
    background: var(--accent-tertiary);
    box-shadow: 0 0 6px rgba(6, 255, 165, 0.5);
}

.api-status-partial {
    background: rgba(255, 140, 0, 0.08);
    border: 1px solid rgba(255, 140, 0, 0.2);
    color: var(--accent-orange);
}
.api-status-partial .status-dot {
    background: var(--accent-orange);
    box-shadow: 0 0 6px rgba(255, 140, 0, 0.5);
}

.api-status-error {
    background: rgba(255, 0, 110, 0.08);
    border: 1px solid rgba(255, 0, 110, 0.2);
    color: var(--accent-pink);
}
.api-status-error .status-dot {
    background: var(--accent-pink);
    box-shadow: 0 0 6px rgba(255, 0, 110, 0.5);
}

@keyframes statusBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Header Mini Status */
.api-status-mini {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    height: 12px;
    margin-right: -4px;
}

.status-dot-mini {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: var(--transition);
}

.api-mini-connected .status-dot-mini {
    background: var(--accent-tertiary);
    box-shadow: 0 0 6px rgba(6, 255, 165, 0.6);
}

.api-mini-partial .status-dot-mini {
    background: var(--accent-orange);
    box-shadow: 0 0 6px rgba(255, 140, 0, 0.6);
}

.api-mini-error .status-dot-mini {
    background: var(--accent-pink);
    box-shadow: 0 0 6px rgba(255, 0, 110, 0.6);
}

.api-mini-idle .status-dot-mini {
    background: var(--accent-orange);
    animation: statusBlink 2s ease infinite;
}

.api-mini-none .status-dot-mini {
    background: var(--text-muted);
}

/* Temperature Labels */
.temp-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 6px;
    padding: 0 2px;
}

/* Settings Actions */
.settings-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 0;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 0.95rem;
}

/* Settings Tab Responsive */
@media (max-width: 768px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .settings-card-header {
        flex-wrap: wrap;
    }
    
    .api-status {
        margin-left: 0;
        margin-top: 8px;
        width: 100%;
        justify-content: center;
    }
    
    .settings-card .api-key-input {
        flex-wrap: wrap;
    }
    
    .settings-card .api-key-input .cyber-input {
        min-width: 0;
    }
    
    .settings-actions {
        flex-direction: column;
    }
    
    .settings-actions .btn-primary,
    .settings-actions .btn-secondary {
        width: 100%;
        justify-content: center;
    }
}

/* ===== USER AVATAR & PROFILE DROPDOWN ===== */
.header-user { position: relative; }
.header-user.hidden { display: none; }

.header-avatar-btn { cursor: pointer; transition: all 0.3s; }
.header-avatar-btn:hover { transform: scale(1.1); }

.header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--accent-primary);
    object-fit: cover;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.2);
    vertical-align: middle;
}

.user-dropdown {
    position: fixed;
    top: 60px;
    right: 20px;
    width: 280px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    z-index: 9999;
    animation: dropIn 0.2s ease;
}
.user-dropdown.hidden { display: none; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(0, 212, 255, 0.05);
}

.user-dropdown-avatar {
    width: 44px; height: 44px; border-radius: 50%;
    border: 2px solid var(--accent-primary); object-fit: cover;
}

.user-dropdown-name { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.user-dropdown-email { font-size: 0.72rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.user-dropdown-divider { height: 1px; background: var(--border-color); }

.user-dropdown-item {
    width: 100%; padding: 12px 16px; border: none; background: transparent;
    color: var(--text-secondary); font-size: 0.84rem; font-family: inherit;
    cursor: pointer; display: flex; align-items: center; gap: 10px;
    transition: all 0.2s; text-align: left;
}
.user-dropdown-item:hover { background: rgba(0, 212, 255, 0.08); color: var(--text-primary); }
.user-dropdown-item i { width: 16px; text-align: center; color: var(--accent-primary); }
.user-dropdown-logout:hover { background: rgba(255, 0, 110, 0.1); color: var(--accent-pink); }
.user-dropdown-logout i { color: var(--accent-pink); }

/* ===== EDIT IMAGE TAB ===== */
.edit-mode-toggle {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 24px;
}

.edit-mode-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.edit-mode-btn i { font-size: 1.3rem; flex-shrink: 0; }
.edit-mode-btn strong { display: block; font-size: 0.82rem; color: var(--text-primary); margin-bottom: 2px; }
.edit-mode-btn small { font-size: 0.68rem; color: var(--text-muted); }
.edit-mode-btn:hover { border-color: var(--accent-primary); }
.edit-mode-btn.active {
    border-color: var(--accent-primary);
    background: rgba(0, 212, 255, 0.08);
    box-shadow: var(--shadow-neon);
}
.edit-mode-btn.active i { color: var(--accent-primary); }

.retouch-quick-picks {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.retouch-pick {
    padding: 5px 12px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.76rem;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.retouch-pick:hover { border-color: var(--accent-primary); color: var(--text-primary); }
.retouch-pick.active {
    background: var(--gradient-primary);
    color: #fff;
    border-color: transparent;
}

.edit-panel { animation: fadeIn 0.3s ease; }

@media (max-width: 600px) {
    .edit-mode-toggle { grid-template-columns: 1fr; }
}

.detail-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.detail-suggestion-chip {
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.78rem;
    cursor: pointer;
    transition: var(--transition);
}

.detail-suggestion-chip:hover { border-color: var(--accent-primary); color: var(--text-primary); }
.detail-suggestion-chip.selected {
    background: var(--gradient-primary);
    color: #fff;
    border-color: transparent;
}

.detail-suggestion-chip i { margin-right: 4px; }

/* ===== VIDEO AI TAB ===== */
.video-ai-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.video-step {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.step-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.step-header strong { display: block; font-size: 0.95rem; color: var(--text-primary); }
.step-header small { font-size: 0.75rem; color: var(--text-muted); }

.video-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 12px 0;
}

.video-analysis {
    margin-top: 12px;
    padding: 12px;
    background: rgba(0, 212, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.video-analysis-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    max-height: 100px;
    overflow-y: auto;
}

.storyboard-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.storyboard-scene {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: start;
    padding: 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.scene-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gradient-secondary);
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scene-content textarea {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 8px 10px;
    font-size: 0.8rem;
    font-family: var(--font-body);
    resize: vertical;
    min-height: 50px;
}

.scene-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.scene-script-vi {
    margin-top: 8px;
    padding: 8px 10px;
    background: rgba(6, 255, 165, 0.05);
    border: 1px solid rgba(6, 255, 165, 0.15);
    border-radius: var(--radius-sm);
}

.scene-script-text {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 4px;
}

.scene-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.scene-actions button {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.7rem;
    transition: var(--transition);
}

.scene-actions button:hover { border-color: var(--accent-primary); color: var(--accent-primary); }

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

.video-result-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.video-result-card video {
    width: 100%;
    display: block;
    max-height: 400px;
    background: #000;
}

.video-result-card .video-card-info {
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.video-result-card .video-card-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.video-result-card .video-card-actions button {
    padding: 6px 12px;
    border: 1px solid var(--accent-primary);
    background: transparent;
    color: var(--accent-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.75rem;
    transition: var(--transition);
}

.video-result-card .video-card-actions button:hover {
    background: var(--accent-primary);
    color: #fff;
}

.video-result-card .video-loading {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
}

@media (max-width: 700px) {
    .video-controls { grid-template-columns: 1fr; }
    .storyboard-scene { grid-template-columns: auto 1fr; }
    .scene-actions { flex-direction: row; }
}

/* ===== FACE CROP MODAL ===== */
.face-crop-modal {
    max-width: 600px;
    width: 95vw;
}

.crop-hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-align: center;
}

.crop-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    text-align: center;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #000;
}

.crop-wrapper canvas {
    display: block;
    margin: 0 auto;
}

#cropOverlay {
    position: absolute;
    top: 0;
    left: 0;
    cursor: crosshair;
}

/* ===== BACKGROUND GALLERY ===== */
.bg-category-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.bg-cat-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.78rem;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.bg-cat-btn:hover { border-color: var(--accent-primary); color: var(--text-primary); }
.bg-cat-btn.active {
    background: var(--gradient-primary);
    color: #fff;
    border-color: transparent;
}

.bg-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
    margin-bottom: 12px;
}

.bg-gallery::-webkit-scrollbar { width: 4px; }
.bg-gallery::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

.bg-gallery-item {
    position: relative;
    aspect-ratio: 3/4;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
    background: var(--bg-tertiary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px 4px;
}

.bg-gallery-item:hover { border-color: var(--accent-primary); transform: scale(1.03); }
.bg-gallery-item.selected {
    border-color: var(--accent-primary);
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.4);
}

.bg-gallery-item .bg-icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
    color: var(--accent-primary);
}

.bg-gallery-item .bg-name {
    font-size: 0.68rem;
    color: var(--text-secondary);
    line-height: 1.2;
}

.bg-gallery-item.selected .bg-name { color: var(--text-primary); }

.bg-selected {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

.bg-selected-label { font-size: 0.8rem; color: var(--text-secondary); }
.bg-selected-name { font-size: 0.85rem; color: var(--accent-primary); font-weight: 600; flex: 1; }
.btn-clear-sm {
    background: none; border: none; color: var(--text-muted);
    font-size: 1.2rem; cursor: pointer; padding: 0 4px;
}
.btn-clear-sm:hover { color: var(--accent-pink); }

.mini-upload-bg {
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.mini-upload-bg:hover { border-color: var(--accent-primary); }
.mini-upload-bg .upload-preview { width: 100%; max-height: 200px; object-fit: contain; }

.bg-upload-actions { margin-top: 8px; display: flex; gap: 8px; }

.empty-state-mini {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
}
.empty-state-mini i { font-size: 1.5rem; margin-bottom: 8px; display: block; }
.empty-state-mini p { font-size: 0.82rem; }

.bg-saved-item {
    position: relative;
}
.bg-saved-item .bg-saved-thumb {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    border-radius: var(--radius-sm);
}
.bg-saved-item .bg-saved-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.6);
    border: none;
    color: var(--accent-pink);
    font-size: 0.7rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bg-saved-item .bg-saved-delete:hover { background: var(--accent-pink); color: #fff; }
