/* Import Inter Font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* Color Variables & Theme Configurations */
:root {
    --bg-primary: #0a0c10;
    --bg-secondary: #121620;
    --bg-panel: rgba(22, 28, 45, 0.45);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(99, 102, 241, 0.5);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --accent-color: #6366f1; /* Indigo */
    --accent-hover: #4f46e5;
    --accent-success: #10b981; /* Emerald */
    --accent-warning: #f59e0b; /* Amber */
    --accent-danger: #ef4444; /* Rose */
    
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --glass-blur: blur(12px);
    --transition-speed: 0.2s;
}

/* Reset Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.1) 0px, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Header Styling */
header {
    background: rgba(18, 22, 32, 0.8);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title h1 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, #a5b4fc 0%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    line-height: 1.4;
    padding: 0.1rem 0;
}

.header-title p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.author-tag {
    font-size: 0.85rem;
    color: var(--accent-success);
    font-weight: 600;
    margin-top: 0.2rem;
    opacity: 0.95;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

/* Main Layout Grid */
main {
    flex: 1;
    display: grid;
    grid-template-columns: 480px 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
    max-width: 1800px;
    margin: 0 auto;
    width: 100%;
    height: calc(100vh - 80px);
}

.left-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.right-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Glassmorphism Cards */
.card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    transition: transform var(--transition-speed), border-color var(--transition-speed);
}

.card:hover {
    border-color: rgba(99, 102, 241, 0.2);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #a5b4fc;
}

/* Input Fields & Forms */
.form-group {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.75rem;
}

label {
    display: block;
    font-size: 0.825rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
    line-height: 1.2;
}

input[type="number"], select {
    width: 100%;
    background: rgba(10, 12, 16, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    outline: none;
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

input[type="number"]:focus, select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--border-focus);
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Custom Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition-speed), transform 0.1s;
    user-select: none;
}

.btn:hover {
    background: var(--accent-hover);
}

.btn:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background: var(--accent-danger);
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: var(--accent-success);
}

.btn-success:hover {
    background: #059669;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.775rem;
    border-radius: 6px;
}

/* Soil Layers Table */
.soil-table-container {
    overflow-x: auto;
    margin-top: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(18, 22, 32, 0.2);
}

.soil-table {
    width: 100%;
    min-width: 1100px; /* Prevent columns from squeezing */
    border-collapse: collapse;
    font-size: 0.8rem;
    text-align: left;
}

.soil-table th {
    background: rgba(10, 12, 16, 0.5);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 0.75rem 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.soil-table td {
    padding: 0.625rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.soil-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.soil-table input[type="text"],
.soil-table input[type="number"] {
    width: 100%;
    padding: 0.375rem 0.5rem;
    font-size: 0.8rem;
    background: rgba(10, 12, 16, 0.8) !important;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.soil-table input[type="text"]:focus,
.soil-table input[type="number"]:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--border-focus);
}

.color-indicator {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    display: inline-block;
    vertical-align: middle;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.1);
}

/* Visual Canvas Layout */
.canvas-container {
    width: 100%;
    background: #0d111a;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

canvas {
    display: block;
    max-width: 100%;
}

.canvas-legend {
    position: absolute;
    bottom: 8px;
    right: 12px;
    background: rgba(18, 22, 32, 0.85);
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Output Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.metric-card {
    background: rgba(10, 12, 16, 0.4);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-success);
    margin: 0.25rem 0;
}

.metric-value.warning {
    color: var(--accent-warning);
}

.metric-value.danger {
    color: var(--accent-danger);
}

.metric-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Two-column layout for visualisations */
.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Report Table Styling */
.report-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.775rem;
    text-align: right;
    margin-bottom: 1.5rem;
}

.table-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #a5b4fc;
    margin-bottom: 0.5rem;
    margin-top: 1.25rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.report-table th, .report-table td {
    padding: 0.5rem 0.625rem;
    border-bottom: 1px solid var(--border-color);
}

.report-table th {
    background: rgba(10, 12, 16, 0.5);
    position: sticky;
    top: 0;
    color: var(--text-secondary);
    font-weight: 600;
    text-align: right;
}

.report-table th:first-child, .report-table td:first-child {
    text-align: left;
}

.report-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.report-table tr.layer-header-row:hover,
.report-table tr.layer-total-row:hover,
.report-table tr.grand-total-row:hover {
    background: transparent !important;
}

.report-table tr.layer-header-row td {
    background: rgba(99, 102, 241, 0.12) !important;
    color: #a5b4fc !important;
    font-weight: bold;
    text-align: left !important;
    border-bottom: 2px solid var(--border-color) !important;
}

.report-table tr.layer-total-row td {
    background: rgba(124, 58, 237, 0.08) !important;
    color: #cbd5e1 !important;
    font-weight: bold;
}

.report-table tr.layer-total-row td:first-child {
    color: #c084fc !important;
}

.report-table tr.layer-total-row td:last-child {
    color: #c084fc !important;
    font-size: 0.85rem;
}

.report-table tr.grand-total-row td {
    background: rgba(2, 132, 199, 0.15) !important;
    color: #38bdf8 !important;
    font-weight: bold;
    border-top: 2px solid #0284c7 !important;
    border-bottom: 2px solid #0284c7 !important;
}

.report-table tr.grand-total-row td:last-child {
    font-size: 0.95rem;
}

/* Switch styling for configurations */
.switch-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.15);
    transition: .3s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-color);
}

input:checked + .slider:before {
    transform: translateX(18px);
}

/* Tabs styling */
.tab-container {
    margin-top: 1rem;
}

.tab-buttons {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
    gap: 4px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-speed);
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: #a5b4fc;
    border-bottom-color: var(--accent-color);
}

.tab-content {
    display: none;
    padding-top: 0.75rem;
}

.tab-content.active {
    display: block;
}

#chart-stress, #chart-time, #chart-depth {
    cursor: crosshair;
}

/* Info tooltip helper styles */
.info-tooltip {
    display: inline-block;
    width: 14px;
    height: 14px;
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-secondary);
    border-radius: 50%;
    text-align: center;
    font-size: 9px;
    line-height: 14px;
    cursor: help;
    margin-left: 4px;
    font-weight: 700;
}

.info-tooltip:hover {
    background: var(--accent-color);
    color: white;
}

/* Verification check banner */
.alert-banner {
    display: flex;
    gap: 0.75rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.825rem;
    color: #a7f3d0;
}

/* Media Queries for Responsive Design */
@media (max-width: 1024px) {
    main {
        grid-template-columns: 1fr;
        height: auto;
    }
    .left-panel, .right-panel {
        overflow-y: visible;
        height: auto;
    }
}

/* Printing styles for PDF export */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    
    header, .btn, .header-actions, .switch-group, .soil-table th:last-child, .soil-table td:last-child {
        display: none !important;
    }
    
    main {
        display: flex !important;
        flex-direction: column !important;
        padding: 0 !important;
        margin: 0 !important;
        height: auto !important;
    }
    
    .left-panel, .right-panel {
        display: contents !important;
    }
    
    /* Order of sections: Inputs first, then Results */
    #emb-card { order: 1 !important; }
    #general-card { order: 2 !important; }
    #treatment-card { order: 3 !important; }
    #layers-card { order: 4 !important; } /* Geological soil layers (input) */
    
    #sketch-card { order: 5 !important; } /* 2D cross section (result) */
    #metrics-card { order: 6 !important; } /* Settlement summary (result) */
    #charts-card { order: 7 !important; } /* Detail charts (result) */
    #detailed-table-card { order: 8 !important; } /* Phân tầng calculation table (result) */
    
    .card {
        background: transparent !important;
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        padding: 1.2rem !important;
        margin-bottom: 1.5rem !important;
        page-break-inside: avoid !important;
        border-radius: 8px !important;
    }
    
    .card-title {
        color: black !important;
        border-bottom: 2px solid #333 !important;
        font-size: 1.1rem !important;
        margin-bottom: 1rem !important;
        padding-bottom: 0.25rem !important;
    }
    
    /* Style inputs in print to look like plain text values */
    input[type="number"], input[type="text"], select {
        border: none !important;
        background: transparent !important;
        color: black !important;
        padding: 0 !important;
        font-size: 0.9rem !important;
        font-weight: bold !important;
        text-align: left !important;
        box-shadow: none !important;
        appearance: none !important;
        -webkit-appearance: none !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    /* Fix soil table layout clipping in print */
    .soil-table-container {
        overflow: visible !important;
        max-height: none !important;
        border: none !important;
        background: transparent !important;
        width: 100% !important;
    }
    
    .soil-table {
        min-width: 0 !important;
        width: 100% !important;
        table-layout: auto !important;
    }
    
    .soil-table th, .soil-table td {
        padding: 4px 2px !important;
        font-size: 0.72rem !important;
    }
    
    .soil-table input[type="text"],
    .soil-table input[type="number"] {
        font-size: 0.72rem !important;
        padding: 0 !important;
        width: 100% !important;
        font-weight: bold !important;
        background: transparent !important;
        border: none !important;
        color: black !important;
    }
    
    .soil-table td div {
        display: flex !important;
        gap: 2px !important;
        justify-content: flex-end !important;
        align-items: center !important;
        width: 100% !important;
    }
    
    .soil-table td div input[type="number"] {
        width: 48% !important;
    }
    
    /* For grid layouts in print */
    .form-grid-2, .form-grid-3 {
        display: grid !important;
        gap: 1rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .form-grid-2 {
        grid-template-columns: 1fr 1fr !important;
    }
    
    .form-grid-3 {
        grid-template-columns: 1fr 1fr 1fr !important;
    }
    
    label {
        color: #555 !important;
        font-size: 0.8rem !important;
        min-height: 0 !important;
        height: auto !important;
    }
    
    .canvas-container {
        border: 1px solid #ccc !important;
        background: white !important;
    }
    
    .report-container {
        max-height: none !important;
        overflow-y: visible !important;
        border: none !important;
    }
    
    .report-table {
        color: black !important;
        margin-bottom: 1.5rem !important;
    }

    .table-title {
        font-size: 0.9rem !important;
        font-weight: bold !important;
        color: black !important;
        margin-top: 1.5rem !important;
        margin-bottom: 0.5rem !important;
        page-break-after: avoid !important;
    }
    
    .report-table th {
        background: #eee !important;
        color: black !important;
        border-bottom: 2px solid black !important;
    }
    
    .report-table td {
        border-bottom: 1px solid #ccc !important;
    }

    .report-table .layer-header-row td {
        background: #f1f5f9 !important;
        color: black !important;
        font-weight: bold !important;
        border-bottom: 1px solid #aaa !important;
        text-align: left !important;
    }
    
    .report-table .layer-total-row td {
        background: #faf5ff !important;
        color: black !important;
        font-weight: bold !important;
        border-bottom: 1px solid #ccc !important;
    }
    
    .report-table .grand-total-row td {
        background: #e0f2fe !important;
        color: black !important;
        font-weight: bold !important;
        border-top: 2px solid black !important;
        border-bottom: 2px solid black !important;
    }

    #cdm-verification-card {
        order: 8 !important;
        background: transparent !important;
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        padding: 1.2rem !important;
        margin-bottom: 1.5rem !important;
        page-break-inside: avoid !important;
        border-radius: 8px !important;
    }

    .verification-content {
        color: black !important;
    }

    .modal {
        display: none !important;
    }

    /* Print styling when only printing the theory section */
    body.print-theory-only header,
    body.print-theory-only main {
        display: none !important;
    }
    body.print-theory-only #theory-modal,
    body.print-theory-only #theory-modal .modal-content,
    body.print-theory-only #theory-modal .theory-container,
    body.print-theory-only #theory-modal .theory-content,
    body.print-theory-only #theory-modal .theory-sub-content.active {
        display: block !important;
    }
    body.print-theory-only #theory-modal {
        position: relative !important;
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        height: auto !important;
        z-index: auto !important;
        overflow: visible !important;
    }
    body.print-theory-only #theory-modal .modal-content {
        border: none !important;
        box-shadow: none !important;
        width: 100% !important;
        height: auto !important;
        padding: 0 !important;
        background: transparent !important;
        backdrop-filter: none !important;
    }
    body.print-theory-only #theory-modal .modal-header,
    body.print-theory-only #theory-modal .theory-sidebar,
    body.print-theory-only #theory-modal .modal-footer {
        display: none !important;
    }
    body.print-theory-only #theory-modal .theory-container {
        display: block !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    body.print-theory-only #theory-modal .theory-content {
        border: none !important;
        background: transparent !important;
        padding: 0 !important;
        height: auto !important;
        overflow: visible !important;
    }
    body.print-theory-only .verification-formula {
        background: #f1f5f9 !important;
        color: black !important;
        border: 1px solid #cbd5e1 !important;
        padding: 8px 12px !important;
        margin: 10px 0 !important;
        text-align: center !important;
        font-family: monospace !important;
        font-size: 11pt !important;
    }
    body.print-theory-only h3,
    body.print-theory-only h4,
    body.print-theory-only p,
    body.print-theory-only li,
    body.print-theory-only strong,
    body.print-theory-only span {
        color: black !important;
    }
}

/* Styles for CDM Verification Card in Screen Mode */
.verification-content {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.verification-section {
    background: rgba(18, 22, 32, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
}

.verification-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #a5b4fc;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 0.25rem;
}

.verification-formula {
    background: rgba(10, 12, 16, 0.5);
    border-radius: 6px;
    padding: 0.5rem;
    font-family: monospace;
    color: #a5b4fc;
    text-align: center;
    margin: 0.5rem 0;
}

.verification-status {
    font-weight: 600;
    margin-top: 0.5rem;
}

.verification-status.pass {
    color: var(--accent-success);
}

.verification-status.fail {
    color: var(--accent-danger);
}

/* Modal Dialog Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(10, 12, 16, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 92%;
    max-width: 1200px;
    height: 85%;
    display: flex;
    flex-direction: column;
    box-shadow: var(--card-shadow);
    padding: 1.5rem !important;
    animation: modalFadeIn 0.25s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
    height: 40px;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #a5b4fc;
    background: linear-gradient(135deg, #a5b4fc 0%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: color var(--transition-speed);
}

.modal-close-btn:hover {
    color: var(--accent-danger);
}

/* Theory Tab Styles in Screen Mode */
.theory-container {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 1.5rem;
    align-items: start;
    margin-top: 0.5rem;
    height: calc(100% - 60px);
}

.theory-sidebar {
    background: rgba(10, 12, 16, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    height: 100%;
    overflow-y: auto;
}

.theory-menu-item {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.825rem;
    font-weight: 500;
    text-align: left;
    transition: all var(--transition-speed);
    outline: none;
}

.theory-menu-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.theory-menu-item.active {
    color: #a5b4fc;
    background: rgba(99, 102, 241, 0.15);
    border-left: 3px solid var(--accent-color);
    border-radius: 4px 8px 8px 4px;
    font-weight: 600;
}

.theory-content {
    background: rgba(10, 12, 16, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    height: 100%;
    overflow-y: auto;
}

.theory-sub-content {
    display: none;
}

.theory-sub-content.active {
    display: block;
}

.theory-sub-content h3 {
    color: #a5b4fc;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.theory-sub-content h4 {
    color: #cbd5e1;
    font-size: 0.9rem;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.theory-sub-content p {
    font-size: 0.825rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.theory-sub-content ul, .theory-sub-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
    font-size: 0.825rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.theory-sub-content li strong {
    color: #e2e8f0;
}
