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

:root {
    /* Colors */
    --bg-deep: #0a0a0a;
    --bg-mid: #111;
    --bg-surface: rgba(255, 255, 255, 0.04);

    --text-primary: #f2f2f2;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;

    --accent-blue: #fff;
    --accent-green: #fff;

    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-glow: rgba(255, 255, 255, 0.12);

    /* Glass */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.06);

    /* Typography */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-serif: 'Georgia', 'Times New Roman', serif;

    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 0.75rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ... existing html resets ... */

body {
    font-family: var(--font-main);
    background: #0a0a0a;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* ===== 3D BACKGROUND LAYER (Neutralized) ===== */
.background-layer {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: #0a0a0a;
    pointer-events: none;
    display: none; /* User hates 'ragged' tints */
}

.background-layer::before,
.background-layer::after {
    display: none;
}

/* Header - Unified */
.header {
    position: relative;
    /* Relative to flow naturally */
    width: 100%;
    z-index: 100;
    background: transparent !important;
    border-bottom: none !important;
    backdrop-filter: none !important;
    padding: var(--space-md) 0;
    box-shadow: none !important;
}

.header-content {
    max-width: calc(1400px + 3rem);
    margin: 0 auto;
    padding: 0 var(--space-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    border: none;
    box-shadow: none;
}

/* ===== NAVIGATION ===== */
.main-nav {
    display: flex;
    gap: var(--space-xs);
    background: rgba(40, 45, 55, 0.3);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
}

.nav-link {
    padding: 8px 16px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-normal);
    font-size: 0.875rem;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}



.logo {
    font-size: 0.9rem;
    /* Reduced from 1.125rem */
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.logo-icon {
    color: var(--accent-blue);
}

.header-status {
    display: flex;
    align-items: center;
    gap: 32px !important;
    /* Increased gap to prevent overlap */
    font-size: 0.875rem;
    color: var(--text-secondary);
    position: relative;
    /* justify-self: end; implied by justify-content: space-between on parent */
}

/* Ensure no weird width constraints */
.header-status>* {
    flex-shrink: 0;
}

.version-tag {
    font-size: 10px !important;
    background: #F59E0B !important;
    /* Yellow */
    color: #000 !important;
    padding: 2px 5px !important;
    border-radius: 4px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    display: inline-block !important;
    vertical-align: middle !important;
    margin-left: 6px !important;
    /* Visual closeness */
    line-height: 1 !important;
    position: relative;
    top: -1px;
    box-shadow: 0 0 2px rgba(245, 158, 11, 0.5) !important;
}

.status-indicator {
    display: flex;
    /* Flex to hold text and dot */
    align-items: center;
    gap: 8px;
    /* Gap between circle and text */
}

/* The dot itself */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 6px var(--accent-green);
    display: block;
}

/* The text 'Готов' */
.status-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
}

/* When generating */
.status-indicator.generating .status-dot {
    background: #F59E0B;
    box-shadow: 0 0 10px #F59E0B;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.spin {
    display: inline-block;
    animation: spin 1s infinite linear;
}

/* ===== QUOTA INFO ===== */
.quota-info {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
}

.quota-info.warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: #F59E0B;
}

.quota-info.error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #EF4444;
}


/* ===== MAIN CONTENT ===== */
.main {
    position: relative;
    z-index: 1;
    padding-top: 0 !important;
    /* Force remove gap */
    padding-bottom: var(--space-xl);
}

.container {
    max-width: calc(1400px + 3rem);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

/* ===== MAIN GRID (NEW) ===== */
.main-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: var(--space-md);
    /* Unified gap */
    align-items: start;
    position: relative;
    /* Anchor for loading line */
}

.left-column {
    grid-column: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    position: static;
    /* Unified Scroll */
    height: auto;
    overflow: visible;
    padding-right: 0;
    z-index: 1;
}

.right-column {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    /* Prevent grid blowout */
}

/* ===== HERO ACTIONS (Restored) ===== */
.hero-actions {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

/* ... existing code ... */

/* ===== REFERENCE PANEL (Right Top) ===== */
.reference-panel {
    grid-column: 1 / -1;
    padding: var(--space-xs) var(--space-md);
    display: flex;
    align-items: center;
    /* Fixed height to match Mode (58px) + Gap (14px) + Model (63px) = 135px */
    height: 135px;
    min-height: 135px;
    max-height: 135px;
    overflow: hidden;
}

/* ===== GALLERY HERO (Right Bottom) ===== */
.gallery-hero-panel {
    grid-column: 1 / -1;
    padding: var(--space-md);
    /* Match prompt-panel padding */
    /* Align with Prompt Panel height (header + content + footer) */
    display: flex;
    flex-direction: column;
}

.gallery-hero {
    position: relative;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    /* Match Prompt Textarea (400px) + Footer (~44px) */
    height: 400px;
    min-height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Match Prompt Textarea Background exactly */
    background: rgba(10, 14, 26, 0.4);
    border: 1px solid var(--border-subtle);
}

.gallery-hero img,
.gallery-hero video {
    max-height: 100%;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}


.reference-preview {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    max-width: 300px;
}

.reference-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.btn-remove {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
}

.btn-remove:hover {
    background: rgba(255, 255, 255, 0.3);
    box-shadow: none;
}

/* ===== GENERATE BUTTON ===== */
.btn-generate {
    grid-column: 1 / -1;
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    color: #fff;
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    transition: all var(--transition-normal);
}

.btn-generate:hover {
    background: #1a1a1a;
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

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

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

/* ===== LOADING LINE ===== */
/* ===== LOADING LINE ===== */
.loading-line {
    position: absolute;
    /* Relative to main-grid */
    top: -2px;
    /* Slight offset to sit on top edge */
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--accent-blue);
    /* Visible blue line by default */
    z-index: 100;
    pointer-events: none;
    transform-origin: left;
    transition: transform 0.3s;
    border-radius: 2px;
}

.loading-line.active {
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-green), var(--accent-blue));
    background-size: 200% 100%;
    animation: shimmer-line 1.5s infinite linear;
}

@keyframes shimmer-line {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

/* ===== PROGRESS (Hidden, replaced by loading line) ===== */
.progress-container {
    display: none !important;
}

/* ===== GENERATION LINE ===== */
.generation-line {
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: none;
    border-radius: 2px;
    margin-bottom: var(--space-md);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
}

.generation-line.active {
    height: 4px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
    box-shadow: none;
}

@keyframes shimmer {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

/* ===== UPDATED PROMPT AREA ===== */
.prompt-panel {
    min-height: auto;
    /* Remove fixed height */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.prompt-textarea {
    width: 100%;
    height: 400px !important;
    min-height: 400px !important;
    background: rgba(10, 14, 26, 0.4);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: var(--space-md);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    resize: none;
    /* Disable resize to keep alignment */
    outline: none;
    transition: all var(--transition-normal);
}



/* ===== GALLERY ===== */
.gallery-panel {
    margin-top: 0;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-lg);
}

.gallery-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-xl) 0;
    color: var(--text-muted);
}

.gallery-empty svg {
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(10, 14, 26, 0.5);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.gallery-item:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
}

.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(10, 14, 26, 0.95) 0%, rgba(10, 14, 26, 0.4) 50%, transparent 100%);
    opacity: 0; /* Hidden by default */
    transition: opacity var(--transition-normal);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: var(--space-md);
    pointer-events: none; /* Let clicks pass through to the image when hidden/transparent */
}

/* Base states for touch devices or default */
@media (hover: none) {
    .gallery-item-overlay {
        opacity: 1;
        background: linear-gradient(to top, rgba(10, 14, 26, 0.95) 0%, transparent 100%);
    }
    .gallery-item-overlay * {
        pointer-events: auto;
    }
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

.gallery-item:hover .gallery-item-overlay * {
    pointer-events: auto;
}

.char-gallery-item:hover .char-gallery-overlay,
.loc-gallery-item:hover .loc-gallery-overlay {
    opacity: 1 !important;
}

.char-gallery-item:hover .char-gallery-overlay *,
.loc-gallery-item:hover .loc-gallery-overlay * {
    pointer-events: auto !important;
}

/* ===== LIGHTBOX ===== */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.96);
    /* Darker */
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    padding: 0;
    /* Remove padding */
}

.lightbox.active {
    display: flex !important;
}

/* Hide "ugly" close button */
.lightbox-close {
    display: none !important;
}

.lightbox-content {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox img {
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    box-shadow: none;
    opacity: 1;
    transform: scale(1);
    transition: transform 0.3s ease;
    pointer-events: auto;
    cursor: zoom-out;
}

/* Removed duplicate .gallery-item:hover .gallery-item-overlay as it was moved up */

.gallery-item-prompt {
    font-size: 0.75rem;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    /* Standard property */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    opacity: 0.9;
}

.gallery-item-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px; /* slightly smaller gap to fit 5 buttons */
}

.gallery-item-btn {
    padding: var(--space-xs) var(--space-sm);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.gallery-item-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: none;
}

/* ===== TEXT BUTTON ===== */
.modal-content {
    background: rgba(10, 14, 26, 0.75);
    margin: auto;
    padding: var(--space-xl);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    backdrop-filter: blur(16px);
    width: 90%;
    max-width: 800px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn var(--transition-normal);
}

.video-modal-override {
    max-height: 95vh !important;
    height: auto;
}

.btn-text {
    padding: var(--space-xs) var(--space-md);
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn-text:hover {
    border-color: rgba(255, 255, 255, 0.15);
    color: #fff;
    box-shadow: none;
}

/* ===== BUTTON ICON ONLY ===== */
/* Removed conflicting .icon-btn styles (now managed by App.css for consistent perfectly round buttons without borders) */

/* ===== TOOLTIP ===== */
.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: 4px 8px;
    background: var(--bg-deep);
    border: 1px solid var(--border-glow);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.tooltip:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .main-grid {
        grid-template-columns: 1fr;
    }

    .left-column {
        position: static;
    }

    .prompt-panel {
        min-height: 400px;
    }
}

@media (max-width: 768px) {
    .settings-row-compact {
        grid-template-columns: 1fr;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== REFERENCE PANEL RELAYOUT ===== */
.reference-layout {
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
    min-height: 80px;
}

.reference-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    /* Reduced gap to fit 3 buttons */
    flex-shrink: 0;
}

.btn-ref-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-normal);
}

/* Unified Icon Button Style */
.btn-icon-styled {
    min-width: 34px;
    width: auto;
    height: 34px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    padding: 0 8px;
}

.btn-ref-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
    transform: translateY(-2px);
}

.reference-content-area {
    flex: 1;
    position: relative;
    background: rgba(10, 14, 26, 0.3);
    border-radius: 10px;
    border: 1px dashed var(--border-subtle);
    height: 114px;
    /* 34*3 + 6*2 */
    min-height: 114px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: var(--space-sm);
    overflow-x: auto;
}

.reference-grid {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: flex-start;
    width: 100%;
}

.url-input-overlay {
    position: absolute;
    inset: 0;
    background: rgba(26, 29, 36, 0.95);
    backdrop-filter: blur(4px);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    border-radius: 10px;
}

.icon-btn-small {
    padding: 6px 12px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

/* Updated Delete Button Style */
.btn-delete-ref {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-blue);
    color: white;
    border: 2px solid var(--bg-deep);
    /* Border to separate from image */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: transform var(--transition-fast);
}

.btn-delete-ref:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.3);
}

/* ===== MISSING STYLES RESTORED ===== */

/* Glass Panel */
.glass-panel {
    background: var(--bg-panel);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: var(--space-md);
    backdrop-filter: blur(16px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.glass-panel:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    border-color: var(--border-subtle);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.panel-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* Mode Switch */
/* Mode Switch */
.mode-switch {
    display: flex;
    background: transparent;
    padding: 2px;
    /* Reduced padding */
    border-radius: 12px;
    border: none;
    gap: 2px;
    margin-bottom: 4px;
}

.mode-btn {
    flex: 1;
    padding: 6px 0;
    /* Reduced padding */
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.825rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.mode-btn:hover {
    color: var(--text-primary);
    background: transparent;
    /* Removed hover bg */
}

.mode-btn.active {
    background: transparent;
    /* Removed background */
    color: var(--accent-blue);
    box-shadow: none;
    /* Removed shadow */
}

/* Form Elements */
.setting-label {
    display: block;
    font-size: 0.825rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.select-input,
.text-input {
    width: 100%;
    padding: 10px 12px;
    background: rgba(10, 14, 26, 0.4);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.925rem;
    outline: none;
    transition: all var(--transition-fast);
    appearance: none;
    /* Remove default arrow */
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.text-input {
    background-image: none;
}

.select-input:focus,
.text-input:focus {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(10, 14, 26, 0.6);
    box-shadow: none;
}

.prompt-textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    background: rgba(10, 14, 26, 0.4);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    transition: all var(--transition-fast);
}

.prompt-textarea:focus {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(10, 14, 26, 0.6);
    box-shadow: none;
}

.prompt-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-sm);
}

.prompt-counter {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.prompt-actions {
    display: flex;
    gap: var(--space-xs);
}

/* Slider */
.slider-input {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    margin: 10px 0;
}

.slider-input::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
    transition: transform 0.1s;
}

.slider-input::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

/* Enhancements Buttons */
.btn-enhance {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-enhance:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
}

/* Settings Layout */
.settings-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.settings-row-compact {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: var(--space-md);
}

.dev-badge {
    background: #FFD700;
    color: #000;
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 10px;
    font-weight: bold;
    vertical-align: middle;
}

/* I2T Mode Highlight */
.highlight-input {
    border: 2px solid var(--accent-primary) !important;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.3) !important;
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0% {
        border-color: var(--accent-primary);
        box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
    }

    50% {
        border-color: #a5b4fc;
        box-shadow: 0 0 25px rgba(99, 102, 241, 0.5);
    }

    100% {
        border-color: var(--accent-primary);
        box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
    }
}

/* ===== ERROR MODAL (Blue Style) ===== */
.lightbox-error {
    background: rgba(10, 14, 26, 0.8) !important;
    /* Semi-transparent Blue-ish Dark */
    backdrop-filter: blur(8px);
}

.error-panel {
    max-width: 450px;
    width: 90%;
    position: relative;
    /* Opaque Blue Plate as requested */
    background: #141E32;
    border: 1px solid var(--accent-blue);
    box-shadow: 0 0 50px rgba(74, 158, 255, 0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-xl);
    border-radius: 20px;
}

.error-title {
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 var(--space-md) 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.error-message {
    color: #E2E8F0;
    margin-bottom: var(--space-xl);
    white-space: pre-wrap;
    line-height: 1.6;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 8px;
    width: 100%;
    text-align: left;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-subtle);
}

/* Make the close button strictly blue */
.error-close-btn {
    width: 100%;
    padding: 12px;
    background: var(--accent-blue);
    color: white;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.error-close-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: none;
    transform: translateY(-1px);
}

/* ===== NAV BUTTON STYLED ===== */
.nav-btn-styled {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-normal);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-btn-styled:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
    transform: translateY(-1px);
    color: #fff;
}

.nav-btn-styled.active {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: none;
}

/* ===== VIDEO GENERATION MODAL ===== */
.video-gallery-top {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    padding: 15px;
    background: rgba(10, 14, 26, 0.5);
    border-bottom: 1px solid var(--border-subtle);
    border-radius: 16px 16px 0 0;
    min-height: 120px;
}

.video-gallery-top::-webkit-scrollbar {
    height: 6px;
}
.video-gallery-top::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 3px;
}

.video-gallery-top .gallery-thumb {
    width: 140px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.video-gallery-top .gallery-thumb:hover {
    transform: translateY(-2px);
    border-color: var(--accent-blue);
}

.video-gallery-top .gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== UTILITIES ===== */
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 1rem; }
.ml-4 { margin-left: 1rem; }
.p-3 { padding: 12px; }
.p-4 { padding: 1rem; }
.p-8 { padding: 2rem; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.flex-center { display: flex; align-items: center; }
.flex-center-center { display: flex; align-items: center; justify-content: center; }
.flex-col { display: flex; flex-direction: column; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.hidden { display: none; }
.font-medium { font-weight: 500; }
.text-muted { color: var(--text-muted); }
.text-danger { color: #F87171; }
.cursor-pointer { cursor: pointer; }
.cursor-zoom-out { cursor: zoom-out; }
.bg-transparent { background: transparent; }
.border-none { border: none; }
.text-white { color: white; }
.text-center { text-align: center; }
.relative { position: relative; }
.overflow-y-auto { overflow-y: auto; }
.max-w-480 { max-width: 480px; }
.max-w-400 { max-width: 400px; }
.max-h-80vh { max-height: 80vh; }
.z-3000 { z-index: 3000; }
.w-90 { width: 90%; }
.input-field-custom { flex: 1; padding: 8px; border-radius: 8px; border: 1px solid var(--border-subtle); background: rgba(10, 14, 26, 0.5); color: var(--text-primary); }
.border-glow-bottom { border-bottom: 1px solid var(--border-glow); }
.settings-header { display: flex; align-items: center; gap: 8px; color: var(--text-primary); margin: 0; }
/* Force consistent glass panels */
.glass-panel {
    background: var(--bg-panel) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(20px) !important;
    border-radius: 12px !important;
}

/* Fix Model Selector Blob */
.premium-input {
    background: rgba(0, 0, 0, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}
.premium-input:focus {
    background: rgba(0, 0, 0, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
}

/* ── Toast notification system ───────────────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

.toast {
    backdrop-filter: blur(10px);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast.toast-visible {
    opacity: 1;
    transform: translateY(0);
}
.toast-info {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.toast-error {
    background: rgba(255, 74, 74, 0.2);
    border: 1px solid rgba(255, 74, 74, 0.4);
}
.toast-success {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.4);
}
.toast__text { flex: 1; }

/* ── Confirm modal — Pure Black ──────────────────────────────────────────── */
.cm-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: cm-overlay-in 0.2s ease;
}
.cm-panel {
    background: #0a0a0a;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 24px 28px;
    max-width: 400px;
    width: 90vw;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: cm-in 0.2s ease;
}
.cm-title {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.cm-message {
    margin: 0;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.55;
}
.cm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}
.cm-btn-cancel {
    padding: 8px 18px;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: transparent;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.82rem;
    font-family: var(--font-main, 'Inter', sans-serif);
    cursor: pointer;
    transition: all 0.2s;
}
.cm-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.7);
    border-color: rgba(255, 255, 255, 0.15);
}
.cm-btn-confirm {
    padding: 8px 18px;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: transparent;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: var(--font-main, 'Inter', sans-serif);
    cursor: pointer;
    transition: all 0.2s;
}
.cm-btn-confirm:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.45);
}
.cm-btn-confirm:focus-visible {
    outline: 1px solid rgba(255, 255, 255, 0.3);
    outline-offset: 2px;
}
.cm-btn-confirm--danger {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.25);
}
.cm-btn-confirm--danger:hover {
    background: rgba(248, 113, 113, 0.08);
    border-color: rgba(248, 113, 113, 0.45);
}
@keyframes cm-in {
    from { opacity: 0; transform: scale(0.96) translateY(6px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes cm-overlay-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.cm-overlay--closing {
    animation: none;
    opacity: 0;
    transition: opacity 0.15s;
}
.cm-overlay--closing .cm-panel {
    transform: scale(0.97);
    transition: transform 0.15s;
}

