:root {
    --gs-gap: 12px;
}

.studio-layout {
    display: flex;
    gap: var(--gs-gap) !important;
    padding: var(--gs-gap) !important;
    height: calc(100vh - 56px);
    overflow: hidden;
    box-sizing: border-box;
    background: #000;
}



/* Kill ALL blue focus outlines globally */
*:focus { outline: none !important; }
*:focus-visible { outline: none !important; }
button:focus, select:focus, textarea:focus, input:focus {
    outline: none !important;
    box-shadow: none !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

/* Fix for blue background/color in some browsers when typing */
textarea::selection, input::selection {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
}
textarea:focus, input:focus {
    background-color: transparent !important;
}


/* ── Page layout ──────────────────────────────────────────────────────────── */
/* ── LEFT COLUMN ──────────────────────────────────────────────────────────── */
.studio-left {
    width: var(--gen-left-w);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: var(--gs-gap);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.studio-left::-webkit-scrollbar { width: 4px; }
.studio-left::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }

/* ── Mode tabs ────────────────────────────────────────────────────────────── */
.mode-tabs {
    display: flex;
    gap: 2px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 3px;
}
.mode-tab {
    flex: 1;
    padding: 6px 0;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    background: transparent;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.mode-tab:hover {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.04);
}
.mode-tab.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* ── Model selector ───────────────────────────────────────────────────────── */
.prompt-block {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.05); /* Same fill as header buttons */
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: hidden;
}
.prompt-textarea {
    flex: 1;
    width: 100%;
    padding: 16px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.6;
    resize: none;
    font-family: var(--font-main);
}
.prompt-textarea::placeholder {
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.8rem;
    line-height: 1.5;
}

.model-selector-wrap {
    display: flex;
    flex-direction: column;
}
.section-label { display: none; }

.model-select {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.85);
    padding: 8px 34px 8px 12px;
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color 0.2s;
}
.model-select:focus { border-color: rgba(255, 255, 255, 0.2); }
.model-select option { background: #111; color: #e5e5e5; }



/* ── Icon buttons (unified style for ALL buttons project-wide) ───────────── */
.gs-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.2s;
}
.gs-icon-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
}

/* ── Prompt action buttons (icon-only) ────────────────────────────────────── */
.prompt-actions {
    display: flex;
    gap: 6px;
    padding: 0;
    margin-top: 8px;
}

/* Hide old text-based buttons, use gs-icon-btn instead */
.prompt-action-btn { display: none; }

/* ── Random prompt button — same icon style ──────────────────────────────── */
.random-prompt-btn { display: none; }

/* ── Progress bar (shimmer) ───────────────────────────────────────────────── */
.generation-progress {
    position: fixed;
    top: 56px; /* Exactly under header */
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.04);
    overflow: hidden;
    opacity: 0;
    z-index: 1000;
    pointer-events: none;
    transition: opacity 0.5s;
}
.generation-progress.active { opacity: 1; }
.generation-progress-inner {
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.2) 50%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: shimmer 6s linear infinite; /* Very slow premium shimmer */
}

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


/* ── Generate button ──────────────────────────────────────────────────────── */
.generate-btn {
    width: 100%;
    padding: 12px 24px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.85);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.generate-btn::before { display: none; }
.generate-btn:hover:not(:disabled) {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.04);
}
.generate-btn:active:not(:disabled) {
    background: rgba(255, 255, 255, 0.06);
}
.generate-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.generate-btn-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.generate-btn-inner svg { display: none; }
.generate-btn .shortcut-hint { display: none; }

/* ── CENTER COLUMN ────────────────────────────────────────────────────────── */
.studio-center {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--gs-gap);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.studio-center::-webkit-scrollbar { width: 4px; }
.studio-center::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }

.references-block {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    height: 126px; 
    min-height: 126px;
    max-height: 126px;
    overflow: hidden;
}
.sidebar-top-controls {
    display: flex;
    flex-direction: column;
    gap: 8px; /* Tighter internal gap for buttons */
    height: 126px;
    min-height: 126px;
    max-height: 126px;
}





/* Vertical button bar on left */
.ref-sidebar {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

/* References area */
.references-grid {
    display: flex;
    gap: 8px;
    padding: 8px;
    flex: 1;
    align-items: center;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.06) transparent;
}
.reference-item {
    position: relative;
    width: 140px;
    height: 140px;
    flex-shrink: 0;
}
.reference-item img {
    width: 140px;
    height: 140px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border-subtle);
    display: block;
    transition: border-color 0.2s;
}
.reference-item:hover img { border-color: rgba(255, 255, 255, 0.2); }
.reference-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
    line-height: 1;
}
.reference-item:hover .reference-remove { opacity: 1; }
.reference-remove:hover { color: #fff; background: rgba(255,255,255,0.15); }
.references-empty {
    color: rgba(255, 255, 255, 0.15);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    padding: 0 16px;
}

/* Hide old ref buttons (replaced by sidebar) */
.ref-btn { display: none; }

/* ── Result block ─────────────────────────────────────────────────────────── */
.result-block {
    flex: 1;
    min-height: 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}


.result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.15);
}
.result-placeholder-icon {
    width: 48px;
    height: 48px;
    opacity: 0.25;
}
.result-placeholder p {
    font-size: 0.82rem;
    margin: 0;
}
.result-image-wrap {
    width: 100%;
    height: 100%;
    display: none;
    position: relative;
}
.result-image-wrap.has-image { display: flex; }
.result-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: zoom-in;
}
/* Overlay buttons on result */
.result-overlay-btns {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}
.result-block:hover .result-overlay-btns { opacity: 1; }
.result-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    font-size: 0;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all 0.2s;
}
.result-action-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

/* ── Lightbox / fullscreen ────────────────────────────────────────────────── */
.studio-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}
.studio-lightbox.open {
    opacity: 1;
    pointer-events: all;
}
.studio-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}

/* ── Gallery ──────────────────────────────────────────────────────────────── */
.gallery-block {
    background: rgba(255, 255, 255, 0.05); /* Unified dark gray glass */
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px;
    flex-shrink: 0;
}

.gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.gallery-title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    font-family: var(--font-main); /* Strict sans-serif */
}
.gallery-count {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.2);
    font-family: var(--font-main);
}

.gallery-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.06) transparent;
}
.gallery-scroll::-webkit-scrollbar { height: 4px; }
.gallery-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 4px; }
.gallery-empty-msg {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.15);
    padding: 4px 0;
}
.gallery-card {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: all 0.2s;
}
.gallery-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}
.gallery-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    color: transparent; /* Hide ugly broken image text */
}
/* Style for broken image fallback */
.gallery-card img:after {
    content: "✕";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111;
    color: rgba(255,255,255,0.1);
    font-size: 1.5rem;
}

.gallery-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 4px;
    padding: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}
.gallery-card:hover .gallery-card-overlay { opacity: 1; }
.gallery-card-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 0;
    color: rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.15s;
}
.gallery-card-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.25);
}
.gallery-card-btn.danger:hover {
    background: rgba(255, 60, 60, 0.35);
    border-color: rgba(255, 60, 60, 0.5);
    color: #ff6b6b;
}

/* ── Animations ───────────────────────────────────────────────────────────── */
@keyframes pulse-subtle {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.85; }
}
@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.result-image-wrap.has-image { animation: fade-in-up 0.3s ease; }
.gallery-card { animation: fade-in-up 0.2s ease; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .studio-layout { flex-direction: column; height: auto; overflow: auto; }
    .studio-left { width: 100%; overflow: visible; }
}
/* ── Settings specific icon fix ─────────────────────────────────────────── */
.settings-section-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.4);
}
.settings-header-title {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}
.settings-label-sub {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 6px;
    display: block;
}
.input-dark {
    width: 100%;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 0.85rem;
    outline: none;
    transition: all 0.2s;
}
.input-dark:focus {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.4);
}

/* Dropdown for AR (Aspect Ratio) */
#studioAspectRatio {
    flex: 1;
    height: 34px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px; /* Match icon buttons */
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    padding: 0 12px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}
#studioAspectRatio option {
    background: #111;
    color: #fff;
}

/* Aspect ratio icon style */
.ar-dropdown-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Duration dropdown — same style as AR */
#studioDuration {
    flex: 1;
    height: 34px;
    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.75rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    padding: 0 12px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}
#studioDuration option {
    background: #111;
    color: #fff;
}

/* Quality dropdown — same style as AR and Duration */
#studioQuality {
    flex: 1;
    height: 34px;
    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.75rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    padding: 0 12px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}
#studioQuality option {
    background: #111;
    color: #fff;
}
