/* =============================================
   CORTEX AI - CLEAN MODERN THEME
   ============================================= */

:root {
    --primary: #00d4ff;
    --primary-dark: #00a8cc;
    --primary-glow: rgba(0, 212, 255, 0.3);
    --secondary: #8b5cf6;
    --accent: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    
    --bg: #09090b;
    --bg-card: rgba(255,255,255,0.03);
    --bg-hover: rgba(255,255,255,0.06);
    --border: rgba(255,255,255,0.08);
    --border-hover: rgba(255,255,255,0.15);
    
    --text: #fafafa;
    --text-dim: rgba(255,255,255,0.7);
    --text-muted: rgba(255,255,255,0.4);
    
    --radius: 10px;
    --radius-lg: 16px;
    --font: 'Space Grotesk', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Background */
.cyber-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: radial-gradient(ellipse at top, rgba(0,212,255,0.12) 0%, transparent 50%),
                radial-gradient(ellipse at bottom right, rgba(139,92,246,0.08) 0%, transparent 50%),
                radial-gradient(ellipse at bottom left, rgba(0,212,255,0.05) 0%, transparent 40%);
    overflow: hidden;
}

/* Animated lightning orbs */
.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.4;
    animation: orbFloat 8s ease-in-out infinite;
}

.orb1 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(0,212,255,0.6) 0%, transparent 70%);
    top: -100px;
    right: 20%;
    animation-delay: 0s;
}

.orb2 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(139,92,246,0.5) 0%, transparent 70%);
    bottom: 20%;
    left: -50px;
    animation-delay: -3s;
}

.orb3 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(0,212,255,0.4) 0%, transparent 70%);
    top: 50%;
    right: -80px;
    animation-delay: -5s;
}

@keyframes orbFloat {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.4; }
    50% { transform: translateY(-30px) scale(1.1); opacity: 0.6; }
}

.grid-lines, .scan-line { display: none; }

/* Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 12px 0;
    background: rgba(9,9,11,0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-icon { width: 32px; height: 32px; }
.logo-icon svg { width: 100%; height: 100%; }

.logo-text {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 2px;
    font-family: 'Space Grotesk', sans-serif;
}

.logo-text span { 
    color: var(--primary); 
    font-weight: 300;
    margin-left: 2px;
}

.nav {
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    text-decoration: none;
    color: var(--text-dim);
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-link:hover { color: var(--text); background: var(--bg-hover); }
.nav-link.active { background: var(--primary); color: white; }
.nav-link i { font-size: 0.8rem; }

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.api-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--warning);
}

.status-dot.online { background: var(--accent); }
.status-dot.error { background: var(--error); }

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
}

.menu-toggle span {
    width: 20px;
    height: 2px;
    background: var(--text);
    transition: all 0.2s;
}

.mobile-menu {
    display: none;
    position: fixed;
    top: 57px;
    left: 0;
    right: 0;
    background: rgba(9,9,11,0.98);
    padding: 16px;
    flex-direction: column;
    gap: 8px;
    z-index: 999;
    border-bottom: 1px solid var(--border);
}

.mobile-menu.active { display: flex; }

.mobile-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-weight: 500;
}

/* Hero */
.hero {
    padding: 120px 0 40px;
    text-align: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 20px;
}

.badge-dot {
    width: 5px;
    height: 5px;
    background: var(--accent);
    border-radius: 50%;
}

.hero-title {
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 16px;
}

.title-line { display: block; }

.hero-desc {
    font-size: 1rem;
    color: var(--text-dim);
    max-width: 450px;
    margin: 0 auto;
}

/* Sections */
.prompt-gen-section,
.create-section {
    padding: 40px 0 60px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.section-header h2 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header h2 i { color: var(--primary); font-size: 1.2rem; }
.section-header p { color: var(--text-dim); flex: 1; }

/* Panel Cards */
.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: border-color 0.2s;
}

.panel-card:hover { border-color: var(--border-hover); }

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.card-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59,130,246,0.1);
    border-radius: 8px;
    color: var(--primary);
    font-size: 0.85rem;
}

.card-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    flex: 1;
}

.model-count, .optional-badge {
    font-size: 0.7rem;
    padding: 3px 8px;
    background: var(--bg-hover);
    border-radius: 4px;
    color: var(--text-muted);
}

/* Prompt Generator */
.prompt-gen-section .section-header {
    text-align: center;
    flex-direction: column;
    align-items: center;
}

.prompt-gen-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.prompt-gen-input textarea,
.prompt-wrapper textarea {
    width: 100%;
    min-height: 120px;
    padding: 14px;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.9rem;
    resize: vertical;
    transition: all 0.2s;
}

.prompt-gen-input textarea:focus,
.prompt-wrapper textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.prompt-gen-input textarea::placeholder,
.prompt-wrapper textarea::placeholder {
    color: var(--text-muted);
}

.gen-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 16px 0;
}

.gen-option label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.gen-option select {
    width: 100%;
    padding: 8px 10px;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.8rem;
    cursor: pointer;
}

.gen-option select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Prompt Image Upload */
.prompt-image-upload {
    margin-bottom: 14px;
}

.prompt-upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(139,92,246,0.05), rgba(59,130,246,0.05));
    border: 2px dashed rgba(139,92,246,0.3);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.prompt-upload-zone:hover {
    border-color: var(--secondary);
    background: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(59,130,246,0.1));
}

.prompt-upload-zone.dragover {
    border-color: var(--secondary);
    background: linear-gradient(135deg, rgba(139,92,246,0.15), rgba(59,130,246,0.15));
    transform: scale(1.01);
}

.prompt-upload-icon {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.prompt-upload-icon > i:first-child {
    font-size: 1.5rem;
    color: var(--secondary);
    opacity: 0.7;
}

.prompt-upload-icon .overlay-icon {
    position: absolute;
    bottom: -2px;
    right: -4px;
    font-size: 0.8rem;
    color: var(--primary);
    background: var(--bg);
    padding: 2px;
    border-radius: 50%;
}

.prompt-upload-text {
    color: var(--text-dim);
    font-size: 0.85rem;
    font-weight: 500;
}

.prompt-upload-zone small {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.prompt-upload-preview {
    display: none;
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--border);
}

.prompt-upload-preview.active {
    display: block;
}

.prompt-upload-preview img {
    width: 100%;
    max-height: 150px;
    object-fit: contain;
    display: block;
}

.prompt-preview-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    display: flex;
    justify-content: center;
}

.preview-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(139,92,246,0.3);
    border: 1px solid rgba(139,92,246,0.5);
    border-radius: 12px;
    font-size: 0.7rem;
    color: #c4b5fd;
}

.preview-badge i {
    font-size: 0.65rem;
}

.prompt-remove-img {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    color: var(--error);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.75rem;
}

.prompt-remove-img:hover {
    background: var(--error);
    color: white;
    border-color: var(--error);
}

.generate-prompt-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: var(--radius);
    color: white;
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.generate-prompt-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(59,130,246,0.3);
}

.generate-prompt-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Output */
.output-format-toggle {
    display: flex;
    gap: 2px;
    margin-left: auto;
    background: rgba(0,0,0,0.3);
    padding: 3px;
    border-radius: 6px;
}

.format-btn {
    padding: 5px 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.format-btn:hover { color: var(--text); }
.format-btn.active { background: var(--primary); color: white; }

.output-container {
    min-height: 200px;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 14px;
    position: relative;
}

.output-empty,
.output-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.output-empty i { font-size: 2rem; opacity: 0.4; }
.output-loading { display: none; }
.output-loading.active { display: flex; }

.mini-loader {
    width: 32px;
    height: 32px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.output-result { display: none; }
.output-result.active { display: block; }

.output-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text);
    white-space: pre-wrap;
}

.output-json {
    display: none;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--primary);
    white-space: pre-wrap;
    margin: 0;
}

.output-json.active { display: block; }
.output-text.active { display: block; }
.output-text:not(.active) { display: none; }

.output-actions {
    display: flex;
    gap: 10px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s;
}

.output-actions.active {
    opacity: 1;
    pointer-events: auto;
}

.output-action-btn {
    flex: 1;
    padding: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.output-action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.output-action-btn.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.output-action-btn.primary:hover {
    background: var(--primary-dark);
}

/* Create Section */
.create-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.control-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.prompt-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.char-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.enhance-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s;
}

.enhance-btn:hover {
    border-color: var(--secondary);
    color: var(--secondary);
}

/* Model Selector */
.model-selector { position: relative; }

.model-selected {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.model-selected:hover { border-color: var(--border-hover); }
.model-selected.active { border-color: var(--primary); border-radius: var(--radius) var(--radius) 0 0; }

.model-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--bg-card);
}

.model-info { flex: 1; text-align: left; }
.model-name { display: block; font-weight: 600; font-size: 0.9rem; color: var(--text); }
.model-meta { font-size: 0.75rem; color: var(--text-dim); }

.model-selected > i {
    color: var(--text-muted);
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.model-selected.active > i { transform: rotate(180deg); }

.model-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(15,15,20,0.98);
    border: 1px solid var(--primary);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s;
    z-index: 100;
}

.model-dropdown.active { max-height: 350px; }

.dropdown-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.dropdown-search i { color: var(--text-muted); font-size: 0.85rem; }

.dropdown-search input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.85rem;
}

.dropdown-search input:focus { outline: none; }

.dropdown-list {
    max-height: 300px;
    overflow-y: auto;
}

.dropdown-list::-webkit-scrollbar { width: 4px; }
.dropdown-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.model-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.15s;
    border-left: 2px solid transparent;
}

.model-option:hover {
    background: var(--bg-hover);
    border-left-color: var(--primary);
}

.model-option.selected {
    background: rgba(59,130,246,0.1);
    border-left-color: var(--primary);
}

.model-option img {
    width: 32px;
    height: 32px;
    border-radius: 6px;
}

.model-option-info { flex: 1; }
.model-option-name { display: block; font-weight: 600; font-size: 0.85rem; color: var(--text); }
.model-option-desc { font-size: 0.7rem; color: var(--text-dim); }
.model-option-speed { font-size: 0.7rem; color: var(--primary); font-family: var(--font-mono); }

.model-option:hover .model-option-name { color: var(--primary); }
.model-option.selected .model-option-name { color: var(--primary); }

/* Settings */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.aspect-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.aspect-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.aspect-btn:hover { border-color: var(--border-hover); }
.aspect-btn.active { border-color: var(--primary); background: rgba(59,130,246,0.1); }

.aspect-icon { background: var(--text-dim); border-radius: 2px; }
.aspect-icon.square { width: 16px; height: 16px; }
.aspect-icon.wide { width: 22px; height: 12px; }
.aspect-icon.tall { width: 10px; height: 18px; }
.aspect-icon.r43 { width: 18px; height: 14px; }
.aspect-icon.r34 { width: 14px; height: 18px; }
.aspect-icon.ultra { width: 26px; height: 10px; }
.aspect-icon.r32 { width: 18px; height: 12px; }
.aspect-icon.r23 { width: 12px; height: 18px; }

.aspect-btn.active .aspect-icon { background: var(--primary); }
.aspect-btn span { font-size: 0.65rem; color: var(--text-muted); font-family: var(--font-mono); }
.aspect-btn.active span { color: var(--primary); }

.bg-selector {
    display: flex;
    gap: 6px;
}

.bg-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-dim);
    font-size: 0.7rem;
    transition: all 0.2s;
}

.bg-btn:hover { border-color: var(--border-hover); }
.bg-btn.active { border-color: var(--primary); background: rgba(59,130,246,0.1); color: var(--primary); }
.bg-btn i { font-size: 0.9rem; }

/* Reference Upload */
.upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    background: rgba(0,0,0,0.4);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.upload-zone:hover { border-color: var(--primary); background: rgba(59,130,246,0.05); }
.upload-zone.dragover { border-color: var(--primary); background: rgba(59,130,246,0.1); }
.upload-zone i { font-size: 1.5rem; color: var(--text-muted); }
.upload-zone span { color: var(--text-dim); font-size: 0.85rem; }
.upload-zone small { color: var(--text-muted); font-size: 0.7rem; }

.upload-preview { display: none; position: relative; }
.upload-preview.active { display: block; }

.upload-preview img {
    width: 100%;
    max-height: 150px;
    object-fit: contain;
    border-radius: var(--radius);
    background: rgba(0,0,0,0.4);
}

.remove-ref {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.8);
    border: none;
    border-radius: 50%;
    color: var(--error);
    cursor: pointer;
}

.ref-warning {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 10px;
    background: rgba(245,158,11,0.1);
    border: 1px solid rgba(245,158,11,0.3);
    border-radius: var(--radius);
    color: var(--warning);
    font-size: 0.8rem;
    margin-top: 10px;
}

.ref-warning.active { display: flex; }

/* Face Preservation Option */
.face-preserve-option {
    display: none;
    margin-top: 12px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(16,185,129,0.08), rgba(59,130,246,0.08));
    border: 1px solid rgba(16,185,129,0.2);
    border-radius: var(--radius);
}

.face-preserve-option.active {
    display: block;
}

.face-preserve-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex-wrap: wrap;
}

.face-preserve-checkbox input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 4px;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
}

.face-preserve-checkbox input:checked + .checkbox-custom {
    background: var(--accent);
    border-color: var(--accent);
}

.checkbox-custom::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 6px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity 0.2s;
}

.face-preserve-checkbox input:checked + .checkbox-custom::after {
    opacity: 1;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
}

.checkbox-label i {
    color: var(--accent);
    font-size: 0.9rem;
}

.checkbox-hint {
    width: 100%;
    margin-left: 30px;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Image Strength Slider */
.strength-slider-container {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.strength-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.strength-header label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
}

.strength-header label i {
    color: var(--primary);
    font-size: 0.8rem;
}

.strength-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    font-family: var(--font-mono);
    background: rgba(0,212,255,0.15);
    padding: 3px 10px;
    border-radius: 12px;
    min-width: 50px;
    text-align: center;
    border: 1px solid rgba(0,212,255,0.3);
}

.strength-slider {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    position: relative;
}

.strength-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, var(--primary), #00a8cc);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 15px var(--primary-glow), 0 2px 8px rgba(0,0,0,0.3);
    transition: all 0.2s;
    border: 2px solid rgba(255,255,255,0.9);
}

.strength-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 0 25px var(--primary-glow), 0 2px 12px rgba(0,0,0,0.4);
}

.strength-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, var(--primary), #00a8cc);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.9);
    box-shadow: 0 0 15px var(--primary-glow), 0 2px 8px rgba(0,0,0,0.3);
}

.strength-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.65rem;
    color: var(--text-muted);
}

.strength-labels span:first-child {
    color: var(--secondary);
}

.strength-labels span:last-child {
    color: var(--primary);
}

.strength-hint {
    margin-top: 8px;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    padding: 6px 10px;
    background: rgba(0,212,255,0.05);
    border-radius: 6px;
    border: 1px solid rgba(0,212,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.strength-hint i {
    color: var(--primary);
    font-size: 0.7rem;
}

/* Generate Button */
.generate-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.2s;
}

.generate-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(59,130,246,0.3);
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-content,
.btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
}

.btn-loading { display: none; }
.generate-btn.loading .btn-content { display: none; }
.generate-btn.loading .btn-loading { display: flex; }

.loader {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* Stats */
.stats-bar {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.stat { flex: 1; text-align: center; }
.stat-label { display: block; font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
.stat-value { font-size: 0.85rem; font-weight: 600; font-family: var(--font-mono); color: var(--primary); }

/* Result Panel */
.result-panel { position: sticky; top: 80px; }

.result-container {
    min-height: 450px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-empty {
    text-align: center;
    padding: 40px;
}

.empty-visual {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
}

.empty-rings { display: none; }

.empty-visual > i {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    color: var(--text-muted);
    opacity: 0.5;
}

.result-empty h3 { font-size: 1rem; margin-bottom: 6px; }
.result-empty p { color: var(--text-dim); font-size: 0.85rem; }

.result-loading {
    display: none;
    text-align: center;
    padding: 40px;
}

.result-loading.active { display: block; }

.loading-visual {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
}

.pulse-ring {
    position: absolute;
    inset: 0;
    border: 2px solid var(--primary);
    border-radius: 50%;
    animation: pulseOut 1.5s ease-out infinite;
}

.delay-1 { animation-delay: 0.3s; }
.delay-2 { animation-delay: 0.6s; }

@keyframes pulseOut {
    0% { transform: scale(0.5); opacity: 1; }
    100% { transform: scale(1.3); opacity: 0; }
}

.loading-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    border-radius: 50%;
}

.loading-icon i { font-size: 1.2rem; color: white; }

.result-loading h3 { font-size: 1rem; margin-bottom: 6px; }
.result-loading p { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 16px; }

.progress-bar {
    width: 160px;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 8px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s;
}

.progress-text { font-size: 0.75rem; color: var(--text-muted); font-family: var(--font-mono); }

.result-success { display: none; width: 100%; }
.result-success.active { display: block; }

.image-wrapper { position: relative; background: rgba(0,0,0,0.5); }
.image-wrapper img { width: 100%; display: block; }

.image-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.image-wrapper:hover .image-overlay { opacity: 1; }

.overlay-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.overlay-btn:hover { background: var(--primary); }

.result-actions {
    display: flex;
    gap: 8px;
    padding: 14px;
    border-top: 1px solid var(--border);
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-dim);
    font-family: var(--font);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover { border-color: var(--primary); color: var(--primary); }

.action-btn.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.action-btn.primary:hover { background: var(--primary-dark); }

.result-meta {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 10px;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.result-meta span { display: flex; align-items: center; gap: 4px; }
.result-meta i { color: var(--primary); font-size: 0.7rem; }

.result-error { display: none; text-align: center; padding: 40px; }
.result-error.active { display: block; }

.error-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(239,68,68,0.1);
    border-radius: 50%;
    margin: 0 auto 16px;
}

.error-icon i { font-size: 1.5rem; color: var(--error); }
.result-error h3 { font-size: 1rem; margin-bottom: 6px; }
.result-error p { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 16px; }

.retry-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--error);
    border-radius: var(--radius);
    color: var(--error);
    font-family: var(--font);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.retry-btn:hover { background: var(--error); color: white; }

/* Gallery */
.gallery-section { padding: 60px 0; }

.clear-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-dim);
    font-family: var(--font);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-btn:hover { border-color: var(--error); color: var(--error); }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.gallery-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px;
    color: var(--text-muted);
}

.gallery-empty i { font-size: 2.5rem; margin-bottom: 12px; display: block; opacity: 0.5; }

.gallery-item {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}

.gallery-item:hover { transform: translateY(-3px); border-color: var(--primary); }
.gallery-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }

.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 12px;
}

.gallery-item:hover .gallery-item-overlay { opacity: 1; }
.gallery-item-model { font-size: 0.7rem; color: var(--primary); margin-bottom: 2px; }
.gallery-item-prompt { font-size: 0.8rem; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.gallery-item-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}

.gallery-item:hover .gallery-item-actions { opacity: 1; }

.gallery-action {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.gallery-action:hover { background: var(--primary); }
.gallery-action.delete:hover { background: var(--error); }

/* Models Section */
.models-section { padding: 60px 0; background: rgba(0,0,0,0.3); }

.models-filter {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-dim);
    font-family: var(--font);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover { border-color: var(--border-hover); color: var(--text); }
.filter-btn.active { background: var(--primary); border-color: var(--primary); color: white; }

.models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.model-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.model-card:hover { border-color: var(--primary); transform: translateY(-3px); }

.model-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.model-card-icon { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: var(--bg); }
.model-card-title { flex: 1; }
.model-card-title h4 { font-size: 1rem; margin-bottom: 2px; color: var(--text); font-weight: 600; }
.model-card-title span { font-size: 0.75rem; color: var(--text-dim); }
.model-card-desc { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.model-card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.model-tag { padding: 3px 8px; background: rgba(59,130,246,0.1); border-radius: 4px; font-size: 0.65rem; color: var(--primary); }
.model-tag.img2img { background: rgba(139,92,246,0.1); color: var(--secondary); }

.model-card-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; border-top: 1px solid var(--border); }
.model-speed { display: flex; align-items: center; gap: 4px; font-size: 0.8rem; color: var(--text-dim); }
.model-speed i { color: var(--warning); font-size: 0.7rem; }

.use-model-btn {
    padding: 6px 14px;
    background: var(--primary);
    border: none;
    border-radius: 6px;
    color: white;
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.use-model-btn:hover { background: var(--primary-dark); }

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0,0,0,0.95);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.lightbox.active { display: flex; }

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
}

.lightbox-close:hover { background: var(--error); border-color: var(--error); }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--radius); }

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    z-index: 3000;
    transition: transform 0.3s;
    font-size: 0.85rem;
}

.toast.active { transform: translateX(-50%) translateY(0); }
.toast.success { border-color: var(--accent); }
.toast.success .toast-icon { color: var(--accent); }
.toast.error { border-color: var(--error); }
.toast.error .toast-icon { color: var(--error); }
.toast.info { border-color: var(--primary); }
.toast.info .toast-icon { color: var(--primary); }

/* Footer */
.footer {
    padding: 24px 0;
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer p { color: var(--text-muted); font-size: 0.8rem; }
.footer a { color: var(--primary); text-decoration: none; }

/* Responsive */
@media (max-width: 1024px) {
    .create-grid, .prompt-gen-grid { grid-template-columns: 1fr; }
    .result-panel { position: static; }
    .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .nav { display: none; }
    .menu-toggle { display: flex; }
    .api-status span { display: none; }
    .hero { padding: 100px 0 30px; }
    .hero-title { font-size: 2rem; }
    .gen-options { grid-template-columns: 1fr; }
    .aspect-selector { grid-template-columns: repeat(4, 1fr); }
    .result-actions { flex-wrap: wrap; }
    .action-btn { flex: 1 1 calc(50% - 4px); }
    .action-btn span { display: none; }
    .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .models-grid { grid-template-columns: 1fr; }
    
    /* Mobile prompt generator */
    .prompt-gen-section .section-header { padding: 0 10px; }
    .prompt-gen-input textarea { min-height: 100px; }
    .output-container { min-height: 150px; }
    
    /* Mobile face preserve */
    .face-preserve-option { padding: 10px; }
    .strength-slider-container { padding-top: 10px; margin-top: 10px; }
    .strength-header { flex-direction: column; gap: 8px; align-items: flex-start; }
    .strength-value { align-self: flex-end; margin-top: -24px; }
    
    /* Mobile upload zones */
    .prompt-upload-zone { padding: 12px; }
    .upload-zone { padding: 16px; }
    
    /* Mobile result meta */
    .result-meta { padding: 10px; }
    .meta-row { gap: 10px; font-size: 0.7rem; }
    
    /* Mobile orbs - smaller */
    .orb1 { width: 150px; height: 150px; }
    .orb2 { width: 100px; height: 100px; }
    .orb3 { width: 120px; height: 120px; }
}

@media (max-width: 480px) {
    .container { padding: 0 12px; }
    .hero-title { font-size: 1.6rem; }
    .hero-desc { font-size: 0.9rem; }
    .panel-card { padding: 12px; }
    
    /* Smaller header */
    .header { padding: 10px 0; }
    .logo-text { font-size: 1.1rem; letter-spacing: 1px; }
    .logo-icon { width: 28px; height: 28px; }
    
    /* Compact aspect selector */
    .aspect-selector { grid-template-columns: repeat(4, 1fr); gap: 4px; }
    .aspect-btn { padding: 8px 4px; }
    .aspect-btn span { font-size: 0.6rem; }
    
    /* Compact buttons */
    .generate-btn, .generate-prompt-btn { padding: 12px; font-size: 0.85rem; }
    
    /* Gallery 2 columns */
    .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .gallery-item-overlay { padding: 8px; }
    .gallery-item-prompt { font-size: 0.7rem; }
    
    /* Output format toggle */
    .output-format-toggle { gap: 0; }
    .format-btn { padding: 4px 8px; font-size: 0.7rem; }
    
    /* Compact options */
    .gen-option label { font-size: 0.7rem; }
    .gen-option select { padding: 6px 8px; font-size: 0.75rem; }
    
    /* Mobile lightbox */
    .lightbox { padding: 10px; }
    .lightbox-close { top: 10px; right: 10px; width: 36px; height: 36px; }
    
    /* Mobile toast */
    .toast { left: 10px; right: 10px; bottom: 10px; transform: translateX(0); }
    
    /* Hide some orbs on very small screens */
    .orb2, .orb3 { display: none; }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .gallery-item-overlay { opacity: 1; background: linear-gradient(to top, rgba(0,0,0,0.7), transparent 60%); }
    .gallery-item-actions { opacity: 1; }
    .image-overlay { opacity: 0.8; }
    
    /* Larger touch targets */
    .aspect-btn { min-height: 44px; }
    .quality-btn { min-height: 50px; }
    .bg-btn { min-height: 44px; }
    .gallery-action { width: 32px; height: 32px; }
    
    /* Better slider for touch */
    .strength-slider::-webkit-slider-thumb { width: 24px; height: 24px; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

::selection { background: var(--primary); color: white; }

/* =============================================
   QUALITY SELECTOR
   ============================================= */

.quality-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.quality-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quality-btn:hover {
    border-color: var(--border-hover);
}

.quality-btn.active {
    border-color: var(--primary);
    background: rgba(0,240,255,0.1);
}

.quality-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-dim);
}

.quality-btn.active .quality-label {
    color: var(--primary);
}

.quality-size {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.quality-btn.active .quality-size {
    color: var(--primary);
}

/* =============================================
   ENHANCED RESULT META
   ============================================= */

.result-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
}

.meta-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.meta-row span {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-dim);
}

.meta-row i {
    color: var(--primary);
    font-size: 0.75rem;
}

@media (max-width: 768px) {
    .quality-selector {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .meta-row {
        gap: 12px;
    }
}

/* =============================================
   ENHANCED GALLERY ITEMS
   ============================================= */

.gallery-item-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.gallery-item-details {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.gallery-item-actions {
    display: flex;
    gap: 6px;
}

.gallery-action {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
}
