/* ========================================================================= */
/* BACKEND STUDIOS: HIGH-CONTRAST PURE DARK / BLACK THEME                   */
/* Optimized for readability: Black backgrounds, crisp white text, vivid accents */
/* ========================================================================= */

.backend-studio-section {
    margin-top: 3.5rem;
    scroll-margin-top: 2rem;
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

/* Master Dashboard Tab Buttons */
.master-tab-btn {
    padding: 0.65rem 1.25rem;
    font-size: 0.88rem;
    font-weight: 800;
    border-radius: 12px;
    border: 1.5px solid #1e293b !important;
    background: #090d16 !important;
    color: #94a3b8 !important;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.master-tab-btn:hover {
    color: #ffffff !important;
    background: #0f172a !important;
    border-color: #38bdf8 !important;
    transform: translateY(-1px);
}

.master-tab-btn.active {
    background: #312e81 !important;
    border-color: #818cf8 !important;
    color: #ffffff !important;
    box-shadow: 0 0 16px rgba(99, 102, 241, 0.45) !important;
}

/* Master Studio Pane */
.master-studio-pane {
    width: 100%;
    transition: opacity 0.2s ease-in-out;
}

/* Master Studio Container - Solid Deep Charcoal/Black */
.studio-card-container {
    background: #090d16 !important;
    border: 2px solid #1e293b !important;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    color: #ffffff !important;
}

/* Studio Nav Top Bar */
.studio-tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    border-bottom: 2px solid #1e293b;
    background: #030712 !important;
    padding: 0.75rem 1.25rem;
}

.studio-nav-btn {
    padding: 0.65rem 1.35rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.92rem;
    border: 1.5px solid #1f2937;
    background: #0f172a !important;
    color: #cbd5e1 !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.studio-nav-btn:hover {
    color: #ffffff !important;
    background: #1e293b !important;
    border-color: #38bdf8 !important;
}

.studio-nav-btn.active {
    background: #1e1e38 !important;
    border-color: #6366f1 !important;
    color: #ffffff !important;
    box-shadow: 0 0 16px rgba(99, 102, 241, 0.35);
}

/* Badges */
.redis-badge {
    background: #1e1014 !important;
    color: #f87171 !important;
    border: 1.5px solid #ef4444 !important;
    font-weight: 800;
}

.celery-badge {
    background: #061e16 !important;
    color: #34d399 !important;
    border: 1.5px solid #10b981 !important;
    font-weight: 800;
}

/* Cache Metrics Grid */
.cache-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.cache-metric-card {
    background: #020617 !important;
    border: 1.5px solid #1e293b !important;
    border-radius: 12px;
    padding: 1.1rem;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.cache-metric-val {
    font-size: 1.85rem;
    font-weight: 900;
    margin-bottom: 0.35rem;
    font-family: var(--font-mono, monospace);
}

.cache-metric-lbl {
    font-size: 0.8rem;
    color: #94a3b8 !important;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.75px;
}

/* Action Control Panels */
.studio-control-panel {
    background: #030712 !important;
    border: 1.5px solid #1e293b !important;
    border-radius: 14px;
    padding: 1.35rem;
    margin-bottom: 1.5rem;
}

.studio-control-label {
    display: block;
    font-size: 0.84rem;
    font-weight: 800;
    color: #f1f5f9 !important;
    margin-bottom: 0.45rem;
}

.studio-input-dark {
    width: 100%;
    padding: 0.65rem 0.95rem;
    border-radius: 8px;
    border: 1.5px solid #334155 !important;
    background: #000000 !important;
    color: #ffffff !important;
    font-family: var(--font-mono, monospace);
    font-size: 0.88rem;
    box-sizing: border-box;
}

.studio-input-dark:focus {
    outline: none;
    border-color: #38bdf8 !important;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

/* Visual Key-Value Table */
.kv-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 0.75rem;
    border: 1.5px solid #1e293b !important;
    border-radius: 10px;
    overflow: hidden;
    background: #000000 !important;
}

.kv-table th {
    background: #0f172a !important;
    padding: 0.85rem 1rem;
    text-align: left;
    font-size: 0.84rem;
    font-weight: 800;
    color: #f8fafc !important;
    border-bottom: 1.5px solid #1e293b !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kv-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #1e293b !important;
    font-size: 0.88rem;
    color: #f1f5f9 !important;
    background: #000000 !important;
}

.kv-table tr:last-child td {
    border-bottom: none !important;
}

.kv-key {
    font-family: var(--font-mono, monospace);
    font-weight: 800;
    color: #38bdf8 !important;
}

.ttl-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 800;
    font-family: var(--font-mono, monospace);
    background: #1c1504 !important;
    color: #fbbf24 !important;
    border: 1.5px solid #f59e0b !important;
}

/* Hit / Miss Flash Banner */
.hit-miss-banner {
    padding: 0.95rem 1.35rem;
    border-radius: 12px;
    margin-bottom: 1.35rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 0.96rem;
    animation: fadeInScale 0.25s ease-out;
}

.banner-hit {
    background: #031c12 !important;
    border: 1.5px solid #10b981 !important;
    color: #34d399 !important;
}

.banner-miss {
    background: #23080c !important;
    border: 1.5px solid #ef4444 !important;
    color: #fca5a5 !important;
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

/* Pythonic Syntax Highlighting */
.py-kw { color: #f43f5e !important; font-weight: 700; } /* def, return, import, from, if, else, raise, try, except */
.py-fn { color: #38bdf8 !important; font-weight: 700; } /* function name: cache_aside, wrapper, get, setex */
.py-dec { color: #fbbf24 !important; font-weight: 700; } /* @wraps, @celery_app.task */
.py-str { color: #34d399 !important; } /* strings: '127.0.0.1', "utf-8" */
.py-cm { color: #94a3b8 !important; font-style: italic; } /* comments: # Setup Redis... */
.py-num { color: #fb923c !important; } /* numbers: 6379, 60, 2.0 */
.py-cls { color: #e879f9 !important; font-weight: 700; } /* classes: Redis, Celery, RequestException */
.py-self { color: #c084fc !important; font-weight: 700; font-style: italic; } /* self, cls */
.py-builtin { color: #38bdf8 !important; } /* json, str, int, dict */

/* Code & Output Boxes - Pitch Black */
.studio-code-box-black {
    background: #000000 !important;
    border: 1.5px solid #1e293b !important;
    border-radius: 10px;
    padding: 1.15rem;
    font-family: var(--font-mono, monospace);
    font-size: 0.88rem;
    color: #ffffff !important;
    overflow-x: auto;
    line-height: 1.6;
    margin: 0;
}

/* Celery Worker Node Visualizer */
.celery-cluster {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    margin: 1.25rem 0;
}

.worker-box {
    background: #020617 !important;
    border: 1.5px solid #1e293b !important;
    border-radius: 14px;
    padding: 1.35rem;
    position: relative;
    transition: all 0.25s ease;
}

.worker-box.working {
    border-color: #38bdf8 !important;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.35);
}

.worker-status-badge {
    position: absolute;
    top: 1.1rem;
    right: 1.1rem;
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.status-idle {
    background: #0f172a !important;
    color: #cbd5e1 !important;
    border: 1.5px solid #334155 !important;
}

.status-active {
    background: #082f49 !important;
    color: #38bdf8 !important;
    border: 1.5px solid #38bdf8 !important;
    animation: pulseGlow 1.5s infinite;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Celery State Pipeline */
.celery-pipeline-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #020617 !important;
    border: 1.5px solid #1e293b !important;
    border-radius: 14px;
    padding: 1.1rem;
    margin: 1.25rem 0;
    position: relative;
    overflow-x: auto;
}

.pipeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    z-index: 2;
    min-width: 80px;
}

.pipeline-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #0f172a !important;
    border: 2px solid #334155 !important;
    color: #cbd5e1 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.pipeline-step.active .pipeline-circle {
    background: #4338ca !important;
    border-color: #818cf8 !important;
    color: #ffffff !important;
    box-shadow: 0 0 16px rgba(99, 102, 241, 0.7);
}

.pipeline-step.success .pipeline-circle {
    background: #065f46 !important;
    border-color: #34d399 !important;
    color: #ffffff !important;
}

.pipeline-step.retry .pipeline-circle {
    background: #78350f !important;
    border-color: #fbbf24 !important;
    color: #ffffff !important;
}

.pipeline-label {
    font-size: 0.8rem;
    font-weight: 800;
    color: #94a3b8 !important;
}

.pipeline-step.active .pipeline-label {
    color: #818cf8 !important;
}

/* Terminal Log Console - Pitch Black with Vivid Syntax */
.terminal-console {
    background: #000000 !important;
    border: 1.5px solid #1e293b !important;
    border-radius: 12px;
    padding: 1.15rem;
    font-family: var(--font-mono, 'Fira Code', monospace);
    font-size: 0.85rem;
    color: #ffffff !important;
    max-height: 230px;
    overflow-y: auto;
    line-height: 1.6;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8);
}

.terminal-line {
    margin-bottom: 0.4rem;
    word-break: break-all;
}

.term-time { color: #94a3b8 !important; }
.term-info { color: #34d399 !important; font-weight: 800; }
.term-warn { color: #fbbf24 !important; font-weight: 800; }
.term-task { color: #c084fc !important; font-weight: 700; }

/* ========================================================================= */
/* AUTH & SECURITY STUDIO                                                    */
/* ========================================================================= */

.jwt-token-display {
    background: #000000 !important;
    border: 1.5px solid #1e293b !important;
    border-radius: 12px;
    padding: 1.2rem;
    font-family: var(--font-mono, monospace);
    font-size: 0.92rem;
    word-break: break-all;
    line-height: 1.65;
    margin-bottom: 1.25rem;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
}

.jwt-part-header { color: #fb7185 !important; font-weight: 700; }
.jwt-part-payload { color: #c084fc !important; font-weight: 700; }
.jwt-part-sig { color: #38bdf8 !important; font-weight: 700; }
.jwt-dot { color: #94a3b8 !important; font-weight: 900; padding: 0 1px; }

.jwt-breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 1.25rem;
    margin-top: 1.25rem;
}

.jwt-panel {
    background: #020617 !important;
    border: 1.5px solid #1e293b !important;
    border-radius: 12px;
    padding: 1.2rem;
    transition: border-color 0.2s ease;
}

.jwt-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #1e293b;
}

.jwt-json-box {
    background: #000000 !important;
    border: 1.5px solid #1e293b !important;
    border-radius: 8px;
    padding: 0.95rem;
    font-family: var(--font-mono, monospace);
    font-size: 0.86rem;
    color: #f8fafc !important;
    min-height: 150px;
    resize: vertical;
    width: 100%;
    box-sizing: border-box;
    line-height: 1.55;
}

.jwt-json-box:focus {
    outline: none;
    border-color: #38bdf8 !important;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

/* OAuth2 Stepper - Solid Dark Buttons with Crisp White Text */
.oauth-stepper {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.oauth-step-btn {
    background: #020617 !important;
    border: 1.5px solid #334155 !important;
    border-radius: 10px;
    padding: 0.75rem 1.15rem;
    color: #cbd5e1 !important;
    font-weight: 800;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.oauth-step-btn:hover {
    color: #ffffff !important;
    background: #0f172a !important;
    border-color: #6366f1 !important;
}

.oauth-step-btn.active {
    background: #312e81 !important;
    border-color: #818cf8 !important;
    color: #ffffff !important;
    box-shadow: 0 0 16px rgba(99, 102, 241, 0.45);
}

.oauth-detail-box {
    background: #020617 !important;
    border: 1.5px solid #1e293b !important;
    border-radius: 14px;
    padding: 1.65rem;
}

/* Rate Limiter Bucket Cylinder */
.bucket-visualizer-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    flex-wrap: wrap;
    margin: 1.5rem 0;
}

.bucket-cylinder {
    width: 160px;
    height: 220px;
    border: 3px solid #38bdf8 !important;
    border-top: none !important;
    border-radius: 0 0 24px 24px;
    background: #000000 !important;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column-reverse;
    box-shadow: 0 0 24px rgba(56, 189, 248, 0.25);
}

.token-orb-container {
    display: flex;
    flex-direction: column-reverse;
    gap: 6px;
    padding: 10px;
    width: 100%;
    box-sizing: border-box;
}

.token-orb {
    height: 32px;
    border-radius: 16px;
    background: linear-gradient(135deg, #0284c7, #0369a1) !important;
    border: 1.5px solid #38bdf8 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff !important;
    font-weight: 800;
    font-size: 0.78rem;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.6);
    animation: dropIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes dropIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.shake-animation {
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* Multi-OS Installation 2x2 Grid */
.multi-os-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

@media (max-width: 768px) {
    .multi-os-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================================================= */
/* Framework Studio File Tab Buttons (Flask, FastAPI, Django)                */
/* ========================================================================= */
.flask-file-tab-btn,
.fastapi-file-tab-btn,
.django-file-tab-btn {
    padding: 0.6rem 1.05rem;
    font-size: 0.88rem;
    font-family: var(--font-mono, monospace);
    border-radius: 9999px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* Flask theme */
.flask-file-tab-btn {
    border: 1.5px solid #3b82f6;
    background: #eff6ff;
    color: #1d4ed8;
}
.flask-file-tab-btn:hover {
    background: #dbeafe;
    border-color: #2563eb;
    color: #1e40af;
    transform: translateY(-2px);
}
.flask-file-tab-btn.active {
    background: #2563eb !important;
    border-color: #1d4ed8 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35) !important;
}

/* FastAPI theme */
.fastapi-file-tab-btn {
    border: 1.5px solid #06b6d4;
    background: #ecfeff;
    color: #0e7490;
}
.fastapi-file-tab-btn:hover {
    background: #cffafe;
    border-color: #0891b2;
    color: #155e75;
    transform: translateY(-2px);
}
.fastapi-file-tab-btn.active {
    background: #0891b2 !important;
    border-color: #0e7490 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 14px rgba(8, 145, 178, 0.35) !important;
}

/* Django theme */
.django-file-tab-btn {
    border: 1.5px solid #10b981;
    background: #ecfdf5;
    color: #065f46;
}
.django-file-tab-btn:hover {
    background: #d1fae5;
    border-color: #059669;
    color: #047857;
    transform: translateY(-2px);
}
.django-file-tab-btn.active {
    background: #059669 !important;
    border-color: #047857 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35) !important;
}

/* Dark theme overrides */
[data-theme="dark"] .flask-file-tab-btn:not(.active),
body.dark-mode .flask-file-tab-btn:not(.active) {
    background: #0f172a;
    border-color: #3b82f6;
    color: #93c5fd;
}
[data-theme="dark"] .fastapi-file-tab-btn:not(.active),
body.dark-mode .fastapi-file-tab-btn:not(.active) {
    background: #082f49;
    border-color: #06b6d4;
    color: #67e8f9;
}
[data-theme="dark"] .django-file-tab-btn:not(.active),
body.dark-mode .django-file-tab-btn:not(.active) {
    background: #064e3b;
    border-color: #10b981;
    color: #6ee7b7;
}

/* Framework Studio Sandbox Code Boxes & Pythonic Highlighting */
#fastapi-sandbox-display,
#fastapi-sandbox-editor,
#flask-sandbox-editor,
#django-sandbox-editor,
#sql-sandbox-editor {
    background-color: #050811 !important;
    background: #050811 !important;
    color: #f8fafc !important;
    font-family: 'Fira Code', 'JetBrains Mono', Consolas, monospace !important;
    border: none !important;
}

#fastapi-sandbox-editor,
#flask-sandbox-editor,
#django-sandbox-editor,
#sql-sandbox-editor {
    color: #a7f3d0 !important;
    caret-color: #34d399 !important;
}


