/* Custom Premium Dark Theme Style for Nano Banana 2 */
:root {
    --bg-base: #090c10;
    --bg-surface: rgba(21, 27, 35, 0.7);
    --bg-surface-solid: #161b22;
    --bg-sidebar: rgba(13, 17, 23, 0.85);
    
    --border-color: rgba(240, 246, 252, 0.08);
    --border-glow: rgba(139, 92, 246, 0.2);
    
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --text-muted: #484f58;
    
    --primary: #8b5cf6;
    --primary-hover: #a78bfa;
    --primary-glow: rgba(139, 92, 246, 0.45);
    --primary-gradient: linear-gradient(135deg, #8b5cf6 0%, #d946ef 100%);
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-premium: 0 10px 40px -10px rgba(0, 0, 0, 0.5), 0 0 1px 1px rgba(255, 255, 255, 0.05) inset;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
    color-scheme: dark; /* Globally forces browser elements (dropdowns, scrollbars) to dark mode */
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* SIDEBAR STYLING */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    padding: 24px;
    flex-shrink: 0;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 36px;
}

.logo-icon {
    font-size: 24px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-text {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 18px;
    letter-spacing: 1px;
}

.version-tag {
    font-size: 10px;
    background: rgba(139, 92, 246, 0.15);
    color: var(--primary);
    padding: 2px 6px;
    border-radius: 20px;
    font-weight: bold;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    transition: var(--transition-smooth);
}

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

.nav-btn.active {
    color: var(--text-primary);
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.25);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.1);
}

.nav-btn i {
    font-size: 18px;
}

.api-status-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}

.status-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12px;
}

.status-item:last-child {
    margin-bottom: 0;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-dot.offline {
    background-color: var(--text-muted);
}

/* MAIN CONTENT AREA */
.main-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 36px;
    position: relative;
}

.view-section {
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.view-section.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.view-header {
    margin-bottom: 28px;
}

.view-header h1 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 28px;
    margin-bottom: 6px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 15px;
}

/* PANEL & STUDIO GRID */
.panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow: hidden;
}

.studio-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 24px;
    height: calc(100vh - 160px);
}

.controller-panel {
    display: flex;
    flex-direction: column;
    max-height: 100%;
}

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

.tabs {
    display: flex;
    gap: 8px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    border-radius: var(--radius-sm);
}

.tab-btn.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab-content {
    display: none;
    padding: 24px;
    overflow-y: auto;
    flex-grow: 1;
}

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

/* FORM ELEMENTS */
.studio-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-section {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.form-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

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

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 10px 14px;
    font-family: var(--font-body);
    font-size: 13.5px;
    outline: none;
    transition: var(--transition-smooth);
    color-scheme: dark; /* Forces browser to render native dropdown in dark mode */
}

select.form-control {
    background-color: #161b22;
}

select.form-control option {
    background-color: #161b22 !important;
    color: #f0f6fc !important;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--border-glow);
    background: rgba(255, 255, 255, 0.05);
}

textarea.form-control {
    resize: vertical;
}

/* ASPECT RATIO SELECTOR */
.aspect-ratio-selector {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.ar-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 6px;
    cursor: pointer;
    transition: var(--transition-smooth);
    user-select: none;
}

.ar-option input {
    display: none;
}

.ar-option span {
    font-size: 10px;
    font-weight: 500;
    text-align: center;
    color: var(--text-secondary);
}

.ar-box {
    border: 2px solid var(--text-secondary);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.05);
    transition: var(--transition-smooth);
}

.ar-1-1 { width: 20px; height: 20px; }
.ar-16-9 { width: 28px; height: 16px; }
.ar-9-16 { width: 16px; height: 28px; }
.ar-4-3 { width: 24px; height: 18px; }
.ar-3-4 { width: 18px; height: 24px; }

.ar-option:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-secondary);
}

.ar-option.active {
    background: rgba(139, 92, 246, 0.08);
    border-color: var(--primary);
}

.ar-option.active .ar-box {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.2);
}

.ar-option.active span {
    color: var(--text-primary);
}

/* SUB DETAILS TOGGLING */
.subject-sub-details {
    padding: 12px;
    background: rgba(255, 255, 255, 0.01);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--primary);
    margin-top: 10px;
}

/* FILE UPLOAD CONTROL */
.file-upload-wrapper {
    position: relative;
    width: 100%;
}

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

.file-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition-smooth);
    width: 100%;
    text-align: center;
}

.file-upload-label:hover {
    border-color: var(--primary);
    color: var(--text-primary);
    background: rgba(139, 92, 246, 0.05);
}

.upload-preview-container {
    position: relative;
    margin-top: 12px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    width: 100%;
    max-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #06090d;
}

.upload-preview-container img {
    max-width: 100%;
    max-height: 150px;
    object-fit: contain;
}

.btn-remove-preview {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(239, 68, 68, 0.85);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.btn-remove-preview:hover {
    background: #ef4444;
    transform: scale(1.1);
}

.hidden {
    display: none !important;
}

/* RAW JSON EDITOR */
.raw-editor-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
}

.code-editor {
    background: #0d1117;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: #e6edf3;
    font-family: var(--font-mono);
    padding: 16px;
    outline: none;
    font-size: 12.5px;
    line-height: 1.6;
    flex-grow: 1;
    resize: none;
}

.code-editor:focus {
    border-color: var(--primary);
}

/* ACTION FOOTER */
.action-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.15);
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition-smooth);
    outline: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
    border-radius: var(--radius-md);
}

.btn-primary:hover {
    filter: brightness(1.1);
}

.btn-glow {
    box-shadow: 0 0 20px var(--primary-glow);
}

.btn-glow:hover {
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.65);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
}

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

.btn-lg {
    width: 100%;
    padding: 14px;
    font-size: 15px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

/* PREVIEW PANEL */
.preview-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.panel-actions {
    display: flex;
    gap: 8px;
}

.preview-viewport {
    flex-grow: 1;
    background: #06090d;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 24px;
}

.viewport-placeholder {
    text-align: center;
    color: var(--text-muted);
}

.placeholder-icon {
    font-size: 48px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--text-muted) 0%, rgba(255,255,255,0.05) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hint-tag {
    font-size: 11px;
    margin-top: 10px;
    display: inline-block;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 20px;
}

.viewport-loading {
    text-align: center;
}

.glowing-spinner {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid rgba(139, 92, 246, 0.1);
    border-top: 3px solid var(--primary);
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
    box-shadow: 0 0 15px var(--primary-glow);
}

.loading-status {
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 15px;
}

.generation-details {
    color: var(--text-secondary);
    font-size: 12px;
}

.viewport-error {
    text-align: center;
    max-width: 80%;
}

.error-icon {
    font-size: 36px;
    color: var(--error);
    margin-bottom: 12px;
}

.error-message {
    font-size: 12px;
    font-family: var(--font-mono);
    background: var(--error-bg);
    color: #ff8b8b;
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 12px;
    border-radius: var(--radius-md);
    margin-top: 10px;
}

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

.viewport-result img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 15px 30px rgba(0,0,0,0.6);
}

.meta-overlay {
    position: absolute;
    bottom: 12px;
    left: 12px;
    display: flex;
    gap: 8px;
}

.badge {
    background: rgba(13, 17, 23, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-secondary {
    color: var(--text-secondary);
}

/* LIVE PROMPT VIEWER */
.live-prompt-viewer {
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--border-color);
    padding: 16px 24px;
}

.live-prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.copy-btn {
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition-smooth);
}

.copy-btn:hover {
    color: var(--text-primary);
    transform: scale(1.1);
}

.live-prompt-body {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
    max-height: 56px;
    overflow-y: auto;
    font-style: italic;
}

/* GALLERY GRID */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.gallery-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.gallery-item:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.25);
}

.gallery-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-bottom: 1px solid var(--border-color);
}

.gallery-item-meta {
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.item-category {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary-hover);
    background: rgba(139, 92, 246, 0.1);
    padding: 2px 8px;
    border-radius: 20px;
}

.item-date {
    font-size: 11px;
    color: var(--text-secondary);
}

.gallery-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
    color: var(--text-muted);
}

.gallery-empty i {
    font-size: 48px;
    margin-bottom: 16px;
}

.gallery-empty h3 {
    color: var(--text-secondary);
    font-family: var(--font-heading);
    margin-bottom: 4px;
}

/* MODAL CONTAINER */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--bg-surface-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 85%;
    max-width: 960px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-backdrop.active .modal-card {
    transform: scale(1);
}

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

.modal-header h3 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 18px;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    flex-grow: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: calc(100% - 130px);
}

.modal-image-panel {
    background: #06090d;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    border-right: 1px solid var(--border-color);
}

.modal-image-panel img {
    max-width: 100%;
    max-height: 80%;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.modal-meta {
    margin-top: 16px;
    display: flex;
    gap: 8px;
}

.modal-json-panel {
    padding: 24px;
    display: flex;
    flex-direction: column;
    background: #0d1117;
    height: 100%;
}

.json-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.modal-json-panel pre {
    flex-grow: 1;
    overflow: auto;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
    color: #e6edf3;
    background: rgba(0, 0, 0, 0.2);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: rgba(0, 0, 0, 0.1);
}

/* SETTINGS VIEW GRID */
.settings-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 24px;
}

.full-width {
    grid-column: span 2;
}

.password-group {
    display: flex;
    position: relative;
    align-items: center;
}

.password-group input {
    width: 100%;
    padding-right: 44px;
}

.toggle-password {
    position: absolute;
    right: 14px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition-smooth);
}

.toggle-password:hover {
    color: var(--text-primary);
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
}

.save-status {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.save-status.success {
    color: var(--success);
}

/* VPS DEPLOY CARD */
.deploy-info-card {
    padding: 24px;
}

.deploy-info-card h3 {
    font-family: var(--font-heading);
    font-size: 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.path-link {
    color: var(--primary-hover);
    text-decoration: none;
    font-weight: 600;
}

.path-link:hover {
    text-decoration: underline;
}

.quick-commands {
    margin-top: 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}

.cmd-line {
    display: flex;
    margin-bottom: 8px;
    font-size: 13px;
    align-items: center;
}

.cmd-line:last-child {
    margin-bottom: 0;
}

.cmd-label {
    width: 140px;
    font-weight: 600;
    color: var(--text-secondary);
}

.quick-commands code {
    font-family: var(--font-mono);
    color: #f0f6fc;
    background: rgba(255,255,255,0.05);
    padding: 2px 8px;
    border-radius: 4px;
    flex-grow: 1;
}

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

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

.animate-spin-slow {
    animation: spin 3s linear infinite;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}

/* UTILITIES */
.mt-4 { margin-top: 24px; }

/* RESPONSIVE LAYOUTS */
@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 16px 24px;
    }
    
    .brand {
        margin-bottom: 16px;
    }
    
    .nav-menu {
        flex-direction: row;
        width: 100%;
        justify-content: flex-start;
    }
    
    .api-status-card {
        display: none;
    }
    
    .main-content {
        padding: 20px;
        height: calc(100vh - 120px);
    }
    
    .studio-grid {
        grid-template-columns: 1fr;
        height: auto;
        gap: 20px;
    }
    
    .controller-panel, .preview-panel {
        max-height: none;
        height: auto;
    }
    
    .preview-viewport {
        min-height: 400px;
    }
    
    .modal-card {
        width: 95%;
        height: auto;
        max-height: 90vh;
    }
    
    .modal-body {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }
    
    .modal-json-panel {
        border-left: none;
        border-top: 1px solid var(--border-color);
        height: 250px;
    }
}

@media (max-width: 640px) {
    .sidebar {
        flex-direction: column;
        gap: 12px;
    }
    
    .nav-menu {
        width: 100%;
        justify-content: space-around;
    }
    
    .aspect-ratio-selector {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .settings-form-grid {
        grid-template-columns: 1fr;
        padding: 12px;
    }
    
    .full-width {
        grid-column: span 1;
    }
}

/* ==========================================
   LOGIN SCREEN (AUTHENTICATION SCREEN OVERLAY)
   ========================================== */
.login-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 6, 9, 0.82);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    visibility: hidden;
}

.login-backdrop:not(.hidden) {
    display: flex !important;
    opacity: 1;
    visibility: visible;
}

.login-card {
    background: rgba(21, 27, 35, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    width: 90%;
    max-width: 400px;
    padding: 40px;
    text-align: center;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    transform: scale(0.95) translateY(15px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-backdrop:not(.hidden) .login-card {
    transform: scale(1) translateY(0);
}

.login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}

.login-card h3 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 22px;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.login-card p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}

.login-error-message {
    font-size: 12.5px;
    color: #ff8b8b;
    background: var(--error-bg);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 10px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
