/* ===== APP DARK THEME ===== */
.app-body {
    background: #0F1729;
    color: var(--text-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* App Navbar */
.app-navbar {
    background: #0F1729;
    border-bottom: 1px solid var(--dark-border);
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-nav-container {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
}

.app-body .logo-text {
    color: var(--text-light);
}

.app-nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #1A2340;
    border-radius: var(--border-radius-full);
    padding: 4px;
}

.app-nav-link {
    padding: 8px 20px;
    border-radius: var(--border-radius-full);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.app-nav-link.active {
    background: var(--blue);
    color: var(--text-light);
}

.app-nav-link:hover:not(.active) {
    color: var(--text-light);
}

.app-nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.credits-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1A2340;
    padding: 8px 16px;
    border-radius: var(--border-radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--yellow);
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border-radius: 50%;
}

.icon-btn:hover {
    background: #1A2340;
    color: var(--text-light);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--orange), var(--yellow));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

/* Status Bar */
.status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    font-size: 0.85rem;
    color: var(--text-muted);
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* App Layout */
.app-layout {
    display: flex;
    gap: 0;
    flex: 1;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    padding: 0 24px 0 24px;
}

/* Image Grid Area */
.image-grid-area {
    flex: 1;
    padding-right: 24px;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.image-card {
    border-radius: var(--border-radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.image-card:hover {
    transform: scale(1.02);
}

.image-card.large {
    grid-column: span 2;
    grid-row: span 2;
}

.image-placeholder {
    width: 100%;
    aspect-ratio: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-card.large .image-placeholder {
    aspect-ratio: auto;
    height: 100%;
    min-height: 300px;
}

.img-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.image-card:hover .img-overlay {
    opacity: 1;
    background: rgba(0,0,0,0.2);
}

/* Image Actions */
.image-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 0;
}

.action-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border-radius: 50%;
    background: #1A2340;
}

.action-btn:hover {
    color: var(--text-light);
    background: #243054;
}

.action-spacer {
    flex: 1;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 320px;
    min-width: 320px;
    background: #141B2D;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--dark-border);
    border-bottom: none;
    overflow-y: auto;
    max-height: calc(100vh - 120px);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 20px;
    font-weight: 600;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--dark-border);
    color: var(--text-light);
}

/* Model Selector */
.sidebar-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--dark-border);
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius);
    transition: background 0.2s;
}

.model-selector:hover {
    background: rgba(255,255,255,0.05);
}

.model-info {
    flex: 1;
}

.model-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.model-selector svg {
    color: var(--text-muted);
}

/* Prompt Area */
.prompt-area {
    background: #1A2340;
    border-radius: var(--border-radius);
    border: 1px solid var(--dark-border);
    overflow: hidden;
}

.prompt-area textarea {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-light);
    font-family: inherit;
    font-size: 0.85rem;
    padding: 16px;
    resize: none;
    outline: none;
    line-height: 1.5;
}

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

.prompt-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    border-top: 1px solid var(--dark-border);
}

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

.ai-prompt-btn {
    font-size: 0.8rem;
    color: var(--yellow);
    font-weight: 500;
    padding: 4px 12px;
    border-radius: var(--border-radius-full);
    background: rgba(255, 184, 0, 0.1);
}

.ai-prompt-btn:hover {
    background: rgba(255, 184, 0, 0.2);
}

/* Section Headers */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-light);
}

.section-header svg {
    color: var(--text-muted);
    transition: transform 0.2s;
}

.section-header.collapsed svg {
    transform: rotate(0);
}

/* Sliders */
.slider-control {
    margin-top: 12px;
}

.range-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #1A2340;
    outline: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--blue);
    cursor: pointer;
    border: 3px solid #0F1729;
    box-shadow: 0 0 0 2px var(--blue);
}

.range-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--blue);
    cursor: pointer;
    border: 3px solid #0F1729;
    box-shadow: 0 0 0 2px var(--blue);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Mode Toggle */
.mode-toggle {
    display: flex;
    gap: 4px;
    background: #1A2340;
    border-radius: var(--border-radius);
    padding: 4px;
    margin-top: 12px;
}

.mode-btn {
    flex: 1;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
}

.mode-btn.active {
    background: var(--blue);
    color: var(--text-light);
}

.mode-btn:hover:not(.active) {
    color: var(--text-light);
}

/* Advanced Panel */
.advanced-panel {
    margin-top: 12px;
}

.advanced-panel.hidden {
    display: none;
}

.advanced-option {
    margin-bottom: 12px;
}

.advanced-option label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.advanced-option textarea,
.advanced-option input[type="number"] {
    width: 100%;
    background: #1A2340;
    border: 1px solid var(--dark-border);
    border-radius: 8px;
    color: var(--text-light);
    font-family: inherit;
    font-size: 0.85rem;
    padding: 10px 12px;
    outline: none;
    resize: none;
}

.advanced-option textarea:focus,
.advanced-option input[type="number"]:focus {
    border-color: var(--blue);
}

/* Toggles */
.toggles {
    border-bottom: none;
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.9rem;
}

.beta-badge {
    display: inline-block;
    background: var(--orange);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--border-radius-full);
    margin-left: 6px;
    text-transform: uppercase;
    vertical-align: middle;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    display: inline-block;
}

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

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #1A2340;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.toggle-switch input:checked + .toggle-slider {
    background: var(--teal);
}

.toggle-switch input:checked + .toggle-slider::before {
    background: white;
    transform: translateX(20px);
}

/* Generate Button */
.sidebar-footer {
    padding: 16px 20px;
    margin-top: auto;
}

.generate-btn {
    width: 100%;
    background: var(--blue);
    color: white;
    padding: 14px 24px;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.2s;
}

.generate-btn:hover {
    background: #3A7EC9;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(74, 144, 217, 0.4);
}

.credit-cost {
    font-size: 0.8rem;
    font-weight: 400;
    opacity: 0.8;
    background: rgba(0,0,0,0.2);
    padding: 2px 10px;
    border-radius: var(--border-radius-full);
}

/* ===== BOTTOM TOOLBAR ===== */
.bottom-toolbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #141B2D;
    border-top: 1px solid var(--dark-border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 16px;
    z-index: 100;
    overflow-x: auto;
}

.toolbar-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    border-radius: var(--border-radius);
    color: var(--text-muted);
    font-size: 0.7rem;
    min-width: 70px;
    white-space: nowrap;
}

.toolbar-btn.active {
    background: #1A2340;
    color: var(--blue);
}

.toolbar-btn:hover:not(.active) {
    color: var(--text-light);
    background: rgba(255,255,255,0.05);
}

.toolbar-btn svg {
    flex-shrink: 0;
}

/* ===== APP RESPONSIVE ===== */
@media (max-width: 1024px) {
    .app-layout {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        min-width: unset;
        max-height: none;
        border-radius: 0;
    }
    .image-grid-area {
        padding-right: 0;
    }
    .image-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .image-card.large {
        grid-column: span 1;
        grid-row: span 1;
    }
}

@media (max-width: 768px) {
    .app-nav-links {
        display: none;
    }
    .image-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .bottom-toolbar {
        gap: 0;
        padding: 6px 8px;
    }
    .toolbar-btn {
        min-width: 56px;
        padding: 6px 8px;
        font-size: 0.6rem;
    }
}
