/* ============================================================
   🧠 DNYANSETU NEURAL UI – CLEAN STABLE CORE
   One Container • One Scroll • One Modal
============================================================ */

/* ------------------------------------------------------------
   1. DESIGN TOKENS
------------------------------------------------------------ */
:root {
    --accent: #1e40af;
    --accent-hover: #1e3a8a;

    --bg-neural: #f4faff;
    --bg-card: #ffffff;
    --primary-light: #eff6ff;

    --text-main: #0f172a;
    --text-muted: #64748b;

    --border-color: #e2e8f0;

    --radius-xl: 24px;
    --radius-lg: 14px;

    --app-padding: 16px;

    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
}

/* ------------------------------------------------------------
   2. GLOBAL RESET
------------------------------------------------------------ */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    background: var(--bg-neural);
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
}

/* ------------------------------------------------------------
   3. CORE APP CONTAINER (SINGLE SOURCE OF TRUTH)
------------------------------------------------------------ */
.app-container,
.main-wrapper,
.cockpit-wrapper {
    width: 90% !important;      /* TRUE 90% – no overflow */
    max-width: 500px;

    height: 85vh;
    height: 85dvh;

    margin: 0 auto;

    display: flex;
    flex-direction: column;

    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 40px rgba(30, 64, 175, 0.12);

    overflow: hidden;
}

/* Neutralise nested app containers INSIDE modules only */
.main-wrapper .app-container {
    all: unset;
    display: contents;
}

/* ------------------------------------------------------------
   4. HEADER & FOOTER
------------------------------------------------------------ */
.static-header,
.static-footer {
    width: 100%;
    flex-shrink: 0;

    background: #ffffff;
    padding: 8px var(--app-padding);

    display: flex;
    align-items: center;
    justify-content: space-between;

    z-index: 5;
}

.static-header {
    min-height: 64px;
    border-bottom: 1px solid var(--border-color);
}

.static-footer {
    min-height: 64px;
    border-top: 1px solid var(--border-color);
}

/* ------------------------------------------------------------
   5. SCROLLABLE CONTENT (NO CENTERING!)
------------------------------------------------------------ */
.scroll-window,
.dynamic-content,
.neural-center {
    flex: 1;
    width: 100%;

    overflow-y: auto;
    padding: var(--app-padding);

    display: flex;
    flex-direction: column;
    gap: 12px;

    align-items: stretch;     /* ✅ LEFT ALIGN FIX */
}

.scroll-window::-webkit-scrollbar {
    display: none;
}

/* ------------------------------------------------------------
   6. TEXT & TITLES
------------------------------------------------------------ */
.section-title {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.page-title {
    text-align: center;
    font-weight: 800;
    color: var(--accent);
}

/* ------------------------------------------------------------
   7. SUBJECT TOGGLE (FORCE SINGLE ROW)
------------------------------------------------------------ */
.subject-toggle {
    display: flex !important;
    gap: 8px;
}

.subject-btn {
    flex: 1;
    height: 34px;
    font-size: 0.78rem;
    padding: 0;
    justify-content: center;
}

/* ------------------------------------------------------------
   8. CHAPTER LIST (COMPACT MODE)
------------------------------------------------------------ */
.chapter-item {
    min-height: 38px;
    padding: 0 10px;
    margin-bottom: 6px;

    border-radius: var(--radius-lg);
    background: var(--primary-light);
    border: 1px solid #dbeafe;

    display: flex;
    align-items: center;
    justify-content: flex-start;

    cursor: pointer;
}

.chapter-item:hover {
    background: #dbeafe;
}

.chapter-state {
    margin-right: 10px;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.chapter-name {
    font-size: 0.8rem;      /* ✅ 80% */
    font-weight: 600;
    color: var(--accent);

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    text-align: left;
}

/* =========================================================
   ✅ Chapter Selected State – Contrast Fix
========================================================= */

/* When a chapter row is selected */
.chapter-item.primary-action {
    color: #ffffff;              /* default text */
}

/* Override chapter name color when selected */
.chapter-item.primary-action .chapter-name {
    color: #ffffff;              /* FIX: white on blue */
}

/* Optional: slightly soften the state icon */
.chapter-item.primary-action .chapter-state {
    opacity: 0.9;
}

/* ------------------------------------------------------------
   9. BUTTONS (UNIFIED)
------------------------------------------------------------ */
.card-btn {
    width: 100%;
    min-height: 48px;

    border-radius: var(--radius-lg);
    border: 1px solid #dbeafe;
    background: var(--primary-light);

    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;
}

.card-btn:hover {
    background: #dbeafe;
}

.primary-action {
    background: var(--accent);
    color: #ffffff;
    border: none;
}

.primary-action:hover {
    background: var(--accent-hover);
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-muted);
}

/* ------------------------------------------------------------
   10. MODAL (SINGLE SYSTEM – CENTERED)
------------------------------------------------------------ */
.ds-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);

    display: none;
    align-items: center;
    justify-content: center;

    z-index: 9999;
}

.ds-modal-card {
    width: 85%;
    max-width: 420px;

    background: #ffffff;
    border-radius: var(--radius-xl);
    padding: 24px;

    box-shadow: 0 20px 25px rgba(0,0,0,0.12);
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
/* ------------------------------------------------------------
   NEURAL GRID ADDITIONS
------------------------------------------------------------ */

/* 3-Column Layout using your Design Tokens */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px; /* Aligns with your gap: 12px design language */
    width: 100%;
}

/* Square Card Overrides */
.card-btn.square-btn {
    aspect-ratio: 1 / 1;    /* Force Square shape */
    flex-direction: column; /* Stack Icon over Text */
    height: auto;           /* Override min-height if necessary */
    min-height: unset; 
    padding: 8px 4px !important;
    font-size: 0.72rem;     /* Optimized for 3-across labels */
    line-height: 1.2;
    border-radius: var(--radius-lg); /* Uses your design token */
}

/* Icon scaling for the square layout */
.btn-icon {
    font-size: 1.6rem; 
    margin-bottom: 4px;
    display: block;
}

/* The Eliminator Unique Identity */
.eliminate-btn {
    background: #fffcf0 !important; /* Subtle "Alert/Attention" tint */
    border: 1px solid #fef3c7 !important;
    color: var(--warning) !important;
}

.eliminate-btn:hover {
    background: #fef3c7 !important;
}

/* Mobile Adjustment: Ensure content fits within your 85vh container */
@media (max-height: 700px) {
    .btn-icon { font-size: 1.3rem; }
    .card-btn.square-btn { font-size: 0.65rem; }
}