/* =========================================
   Master Course Styles (Global)
   ========================================= */

:root {
    --primary: #0f172a;
    /* Slate 900 */
    --primary-light: #334155;
    /* Slate 700 */
    --accent: #d97706;
    /* Amber 600 */
    --accent-bg: #fffbeb;
    /* Amber 50 */
    --bg-body: #f8fafc;
    /* Slate 50 */
    --bg-card: #ffffff;
    --text-main: #334155;
    /* Slate 700 */
    --text-heading: #0f172a;
    --border: #e2e8f0;
    /* Slate 200 */

    --sidebar-w: 260px;
    --header-h: 60px;

    --font-serif: "Noto Serif SC", serif;
    --font-sans: "Noto Sans SC", sans-serif;
}

[data-theme="dark"] {
    --primary: #020617;
    /* Slate 950 */
    --primary-light: #94a3b8;
    /* Slate 400 */
    --accent: #f59e0b;
    /* Amber 500 */
    --accent-bg: #451a03;
    /* Dark Amber */
    --bg-body: #0f172a;
    /* Slate 900 */
    --bg-card: #1e293b;
    /* Slate 800 */
    --text-main: #cbd5e1;
    /* Slate 300 */
    --text-heading: #f1f5f9;
    /* Slate 100 */
    --border: #334155;
    /* Slate 700 */
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--bg-body);
    color: var(--text-main);
    line-height: 1.7;
    display: flex;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

/* Sidebar Navigation */
.sidebar {
    width: var(--sidebar-w);
    background: #0f172a;
    /* Always dark for contrast, or use logic */
    color: #cbd5e1;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    padding: 20px;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .sidebar {
    background: #020617;
    border-right: 1px solid var(--border);
}

.brand {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 20px;
    color: #f1f5f9;
}

.nav-group {
    margin-bottom: 30px;
}

.nav-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.nav-link {
    display: block;
    padding: 10px 15px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 6px;
    margin-bottom: 4px;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.nav-link.active {
    background: var(--accent);
    color: #fff;
    font-weight: 500;
}

/* Main Content */
.main-wrapper {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Fix flex overflow */
    transition: margin-left 0.3s;
}

.top-bar {
    height: var(--header-h);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    position: sticky;
    top: 0;
    z-index: 90;
    transition: background 0.3s, border-color 0.3s;
}

.breadcrumbs {
    color: var(--text-main);
    font-size: 0.9rem;
}

.actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

.menu-toggle {
    display: none;
    margin-right: 15px;
}

/* Hamburger */

.content {
    max-width: 900px;
    margin: 0 auto;
    padding: 60px 40px;
    width: 100%;
}

/* Typography */
h1,
h2,
h3 {
    color: var(--text-heading);
    margin-top: 0;
}

h1 {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    margin-bottom: 20px;
}

h2 {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    margin-top: 50px;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 10px;
    margin-bottom: 30px;
}

h3 {
    font-size: 1.3rem;
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--text-heading);
    opacity: 0.9;
}

p {
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
    text-align: justify;
}

blockquote {
    border-left: 4px solid var(--accent);
    margin: 30px 0;
    padding: 10px 20px;
    background: var(--accent-bg);
    color: var(--text-heading);
    /* Improved contrast in dark mode */
    font-style: italic;
    border-radius: 0 4px 4px 0;
}

ul,
ol {
    margin-bottom: 1.5rem;
    padding-left: 20px;
}

li {
    margin-bottom: 0.5rem;
}

/* Components */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.card {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, border-color 0.2s;
}

[data-theme="dark"] .card {
    box-shadow: none;
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
}

.card h4 {
    margin-top: 0;
    color: var(--accent);
    margin-bottom: 10px;
}

.card-label {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-body);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-main);
    opacity: 0.8;
    margin-bottom: 10px;
    border: 1px solid var(--border);
}

.highlight-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    /* More visual pop */
    padding: 20px;
    border-radius: 8px;
    margin: 30px 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background: var(--accent);
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.2s;
    border: none;
    cursor: pointer;
}

.btn:hover {
    background: #b45309;
}

/* Darker amber */
.btn-outline {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
}

.btn-outline:hover {
    background: var(--accent-bg);
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 40px 0;
}

/* Mobile / Tablet Responsive */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.2);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    /* Show hamburger */
    .top-bar {
        padding: 0 20px;
    }

    .content {
        padding: 40px 20px;
    }

    /* Overlay when menu is open */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 95;
        display: none;
        backdrop-filter: blur(2px);
    }

    .sidebar-overlay.active {
        display: block;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}