/* Shared CSS Layout System for Mathematical Mastery Roadmap */

:root {
    --bg-color: #08090d;
    --card-bg: rgba(15, 18, 30, 0.75);
    --card-border: rgba(255, 255, 255, 0.06);
    --text-color: #e2e8f0;
    --text-muted: #8a99ad;
    
    /* Global Themes Colors */
    --color-cyan: #38bdf8;
    --color-cyan-glow: rgba(56, 189, 248, 0.35);
    --color-rose: #f43f5e;
    --color-rose-glow: rgba(244, 63, 94, 0.35);
    --color-emerald: #10b981;
    --color-emerald-glow: rgba(16, 185, 129, 0.35);
    --color-amber: #ffb000;
    --color-amber-glow: rgba(255, 176, 0, 0.35);
    --color-purple: #a855f7;
    --color-purple-glow: rgba(168, 85, 247, 0.35);
    
    --sidebar-width: 280px;
    --transition-speed: 0.3s;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Typography helper for numerical readouts to prevent font-width layout jitter */
.number, .math-value {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
}

/* Sidebar Syllabus Layout */
aside {
    width: var(--sidebar-width);
    background: rgba(10, 11, 18, 0.85);
    border-right: 1px solid var(--card-border);
    backdrop-filter: blur(20px);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding: 0;
    transition: transform var(--transition-speed) ease;
    overflow: hidden;
}

aside.collapsed {
    transform: translateX(-100%);
}

.sidebar-scroll-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    padding: 2rem 1.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.sidebar-scroll-container::-webkit-scrollbar {
    width: 5px;
}

.sidebar-scroll-container::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-scroll-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}

.sidebar-scroll-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.sidebar-header {
    margin-bottom: 2rem;
}

.sidebar-nav {
    flex-grow: 1;
    margin-bottom: 2rem;
}

/* Floating Sidebar Toggle Button */
.sidebar-toggle-btn {
    position: fixed;
    left: calc(var(--sidebar-width) - 14px);
    top: 24px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #0a0b12;
    border: 1px solid var(--card-border);
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: left var(--transition-speed) ease, transform var(--transition-speed) ease, background var(--transition-speed) ease, border-color var(--transition-speed) ease;
    z-index: 110;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    outline: none;
    padding: 0;
}

.sidebar-toggle-btn:hover {
    background: var(--color-cyan);
    color: var(--bg-color);
    border-color: var(--color-cyan);
}

.sidebar-toggle-btn.collapsed {
    left: 16px;
}

.sidebar-toggle-btn .toggle-icon {
    transition: transform var(--transition-speed) ease;
}

.sidebar-toggle-btn.collapsed .toggle-icon {
    transform: rotate(180deg);
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--color-cyan);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 2rem;
    transition: transform 0.2s ease;
}

.back-btn:hover {
    transform: translateX(-4px);
}

.logo-container {
    margin-bottom: 2.5rem;
}

.logo-title {
    font-size: 1.2rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-color);
}

.logo-accent {
    color: var(--color-cyan);
    text-shadow: 0 0 10px var(--color-cyan-glow);
}

.logo-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 400;
}

.syllabus-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex-grow: 1;
}

.syllabus-item a {
    display: flex;
    flex-direction: column;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-muted);
    border: 1px solid transparent;
    transition: all var(--transition-speed) ease;
}

.syllabus-item a:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
}

.syllabus-item.active a {
    color: var(--bg-color);
    background: var(--color-cyan);
    font-weight: 600;
    box-shadow: 0 4px 20px var(--color-cyan-glow);
}

.syllabus-item.active a .syllabus-title {
    color: var(--bg-color);
}

.syllabus-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 2px;
    color: var(--text-color);
}

.syllabus-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.syllabus-item.active .syllabus-desc {
    color: rgba(0, 0, 0, 0.6);
}

.sidebar-footer {
    margin-top: auto;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 1.5rem;
}

/* Main Workspace Content */
main {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    padding: 3rem;
    max-width: 1200px;
    width: calc(100% - var(--sidebar-width));
    transition: margin-left var(--transition-speed) ease, width var(--transition-speed) ease;
}

body.sidebar-collapsed main {
    margin-left: 0;
    width: 100%;
}

header {
    margin-bottom: 3.5rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff 30%, #38bdf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 300;
}

/* Layout Grid columns */
.workspace-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 960px) {
    .workspace-grid {
        grid-template-columns: 1fr;
    }
}

.panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1.75rem;
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.canvas-container {
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    touch-action: none;
}

canvas {
    display: block;
    background: transparent;
}

/* Custom interactive buttons and inputs */
.btn {
    background: var(--color-cyan);
    color: var(--bg-color);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    box-shadow: 0 4px 15px var(--color-cyan-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.4);
}

.btn:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.2);
    box-shadow: none;
    cursor: not-allowed;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

/* Preset grids */
.presets-grid {
    display: flex;
    gap: 8px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.btn-preset {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    border: 1px solid var(--card-border);
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.btn-preset:hover, .btn-preset.active {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Formula & Information Cards */
.math-card {
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.math-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding-bottom: 0.5rem;
}

.panel-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.4;
}

.panel-hint svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    fill: var(--text-muted);
}

/* Custom Scrollbar for all pages */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

html {
    scroll-behavior: smooth;
}

/* Reusable Slider Controls */
.control-group {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.control-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 500;
}

.control-label {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.control-value {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.85rem;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-cyan, #38bdf8);
    box-shadow: 0 0 8px var(--color-cyan-glow, rgba(56, 189, 248, 0.35));
    cursor: pointer;
    transition: transform 0.15s ease;
}

/* Reusable Math Formula & Fraction Styling */
.math-equation {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.15rem;
    margin: 0.75rem 0;
    flex-wrap: wrap;
}

.math-fraction {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: middle;
    padding: 0 4px;
}

.math-fraction .numerator {
    border-bottom: 1px solid var(--text-color);
    padding-bottom: 2px;
    text-align: center;
    width: 100%;
}

.math-fraction .denominator {
    padding-top: 2px;
    text-align: center;
    width: 100%;
}

/* Category Dashboard & Dictionary Layout Styles */
.btn-back-container {
    margin-bottom: 2rem;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.6rem 1.2rem;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateX(-3px);
}

.dictionary-details {
    width: 100%;
    max-width: 600px;
    margin: 0 auto 2.5rem auto;
    background: rgba(13, 16, 23, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    backdrop-filter: blur(20px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    text-align: left;
}

.dictionary-details[open] {
    border-color: rgba(255, 176, 0, 0.3);
    box-shadow: 0 4px 25px rgba(255, 176, 0, 0.15);
}

.dictionary-details summary {
    font-weight: 600;
    cursor: pointer;
    outline: none;
    color: var(--text-color);
    user-select: none;
    font-size: 0.95rem;
}

.dictionary-details summary::marker {
    color: #ffb000; /* Amber color */
}

.dictionary-content {
    margin-top: 1rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
    padding-top: 1rem;
}

.dictionary-card-display {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-color);
    animation: fadeIn 0.25s ease-out;
}

.dictionary-card-display h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: #ffb000;
}

.dictionary-card-display p {
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.dictionary-card-display code {
    font-family: 'JetBrains Mono', monospace;
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    color: #38bdf8;
}

.dictionary-card-display .example-box {
    margin-top: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-left: 3px solid #ffb000;
    padding: 0.75rem 1rem;
    border-radius: 0 8px 8px 0;
}

.dictionary-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 4px;
}

.dictionary-list-grid::-webkit-scrollbar {
    width: 6px;
}
.dictionary-list-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 3px;
}
.dictionary-list-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.dictionary-term-btn {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    transition: all 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dictionary-term-btn:hover {
    color: #ffb000;
    background: rgba(255, 176, 0, 0.05);
}

.dictionary-term-btn.active {
    color: #ffb000;
    background: rgba(255, 176, 0, 0.08);
    font-weight: 600;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dashboard Single Column Container */
.dashboard-card-wrapper {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

/* Scrollable Canvas Container utility */
.scrollable-canvas-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

.scrollable-canvas-container canvas {
    display: block;
    min-width: 650px;
    height: 380px;
}

/* Global Subtopic Lists & Bullets */
.subtopics-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0.5rem;
    margin-bottom: 0;
    padding-left: 0;
}

.subtopic-item {
    position: relative;
    padding: 1.1rem 1.25rem 1.1rem 2.25rem !important;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    transition: all 0.25s ease;
    line-height: 1.6;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.subtopic-item:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.subtopic-item .orange-dot {
    position: absolute;
    left: 1.1rem;
    top: 1.45rem;
}

.subtopic-name {
    display: block;
}

.subtopic-name strong {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
}

.orange-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--color-accent, #38bdf8);
    box-shadow: 0 0 6px var(--color-accent-glow, rgba(56, 189, 248, 0.35));
    flex-shrink: 0;
}

/* Greater line spacing for text-heavy panels inside the workspace-grid */
.panel p, .panel div, .panel li {
    line-height: 1.65;
}

.panel p {
    margin-bottom: 1rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.formula-steps {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
