/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Roboto+Mono:wght@300;400;500;600&display=swap');

/* OKLCH Color Theme */
:root {
  --background: oklch(0.9809 0.0025 228.7836);
  --foreground: oklch(0.3211 0 0);
  --card: oklch(1.0000 0 0);
  --card-foreground: oklch(0.3211 0 0);
  --popover: oklch(1.0000 0 0);
  --popover-foreground: oklch(0.3211 0 0);
  --primary: oklch(0.8677 0.0735 7.0855);
  --primary-foreground: oklch(0 0 0);
  --secondary: oklch(0.8148 0.0819 225.7537);
  --secondary-foreground: oklch(0 0 0);
  --muted: oklch(0.8828 0.0285 98.1033);
  --muted-foreground: oklch(0.5382 0 0);
  --accent: oklch(0.9308 0.0364 344.2753);
  --accent-foreground: oklch(0 0 0);
  --destructive: oklch(0.6368 0.2078 25.3313);
  --destructive-foreground: oklch(1.0000 0 0);
  --border: oklch(0.8699 0 0);
  --input: oklch(0.8699 0 0);
  --ring: oklch(0.8677 0.0735 7.0855);
  --chart-1: oklch(0.8181 0.1063 43.5719);
  --chart-2: oklch(0.8148 0.0819 225.7537);
  --chart-3: oklch(0.7891 0.1201 20.1106);
  --chart-4: oklch(0.8344 0.1029 304.8647);
  --chart-5: oklch(0.9271 0.1358 144.3828);
  --sidebar: oklch(0.9809 0.0025 228.7836);
  --sidebar-foreground: oklch(0.3211 0 0);
  --sidebar-primary: oklch(0.8677 0.0735 7.0855);
  --sidebar-primary-foreground: oklch(0 0 0);
  --sidebar-accent: oklch(0.9308 0.0364 344.2753);
  --sidebar-accent-foreground: oklch(0 0 0);
  --sidebar-border: oklch(0.8699 0 0);
  --sidebar-ring: oklch(0.8677 0.0735 7.0855);
  --font-sans: 'Poppins', sans-serif;
  --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  --font-mono: 'Roboto Mono', monospace;
  --radius: 0.5rem;
  --shadow-x: 0;
  --shadow-y: 1px;
  --shadow-blur: 3px;
  --shadow-spread: 0px;
  --shadow-opacity: 0.1;
  --shadow-color: oklch(0 0 0);
  --shadow-2xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
  --shadow-xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
  --shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 1px 2px -1px hsl(0 0% 0% / 0.10);
  --shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 1px 2px -1px hsl(0 0% 0% / 0.10);
  --shadow-md: 0 4px 6px -1px hsl(0 0% 0% / 0.10), 0 2px 4px -2px hsl(0 0% 0% / 0.10);
  --shadow-lg: 0 10px 15px -3px hsl(0 0% 0% / 0.10), 0 4px 6px -4px hsl(0 0% 0% / 0.10);
  --shadow-xl: 0 20px 25px -5px hsl(0 0% 0% / 0.10), 0 8px 10px -6px hsl(0 0% 0% / 0.10);
  --shadow-2xl: 0 25px 50px -12px hsl(0 0% 0% / 0.25);
}

/* Dark theme */
.dark {
  --background: oklch(0.2303 0.0125 264.2926);
  --foreground: oklch(0.9219 0 0);
  --card: oklch(0.3210 0.0078 223.6661);
  --card-foreground: oklch(0.9219 0 0);
  --popover: oklch(0.3210 0.0078 223.6661);
  --popover-foreground: oklch(0.9219 0 0);
  --primary: oklch(0.8027 0.1355 349.2347);
  --primary-foreground: oklch(0 0 0);
  --secondary: oklch(0.7395 0.2268 142.8504);
  --secondary-foreground: oklch(0 0 0);
  --muted: oklch(0.3867 0 0);
  --muted-foreground: oklch(0.7155 0 0);
  --accent: oklch(0.8148 0.0819 225.7537);
  --accent-foreground: oklch(0 0 0);
  --destructive: oklch(0.6368 0.2078 25.3313);
  --destructive-foreground: oklch(1.0000 0 0);
  --border: oklch(0.3867 0 0);
  --input: oklch(0.3867 0 0);
  --ring: oklch(0.8027 0.1355 349.2347);
  --chart-1: oklch(0.8027 0.1355 349.2347);
  --chart-2: oklch(0.7395 0.2268 142.8504);
  --chart-3: oklch(0.8148 0.0819 225.7537);
  --chart-4: oklch(0.9680 0.2110 109.7692);
  --chart-5: oklch(0.8652 0.1768 90.3816);
  --sidebar: oklch(0.2303 0.0125 264.2926);
  --sidebar-foreground: oklch(0.9219 0 0);
  --sidebar-primary: oklch(0.8027 0.1355 349.2347);
  --sidebar-primary-foreground: oklch(0 0 0);
  --sidebar-accent: oklch(0.8148 0.0819 225.7537);
  --sidebar-accent-foreground: oklch(0 0 0);
  --sidebar-border: oklch(0.3867 0 0);
  --sidebar-ring: oklch(0.8027 0.1355 349.2347);
  --shadow-2xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
  --shadow-xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
  --shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 1px 2px -1px hsl(0 0% 0% / 0.10);
  --shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 1px 2px -1px hsl(0 0% 0% / 0.10);
  --shadow-md: 0 4px 6px -1px hsl(0 0% 0% / 0.10), 0 2px 4px -2px hsl(0 0% 0% / 0.10);
  --shadow-lg: 0 10px 15px -3px hsl(0 0% 0% / 0.10), 0 4px 6px -4px hsl(0 0% 0% / 0.10);
  --shadow-xl: 0 20px 25px -5px hsl(0 0% 0% / 0.10), 0 8px 10px -6px hsl(0 0% 0% / 0.10);
  --shadow-2xl: 0 25px 50px -12px hsl(0 0% 0% / 0.25);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    line-height: 1.6;
    color: var(--foreground);
    background: var(--background);
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* Navigation */
.navbar {
    background: color-mix(in oklch, var(--card) 90%, transparent);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.nav-title {
    color: var(--primary);
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    font-weight: 700;
    white-space: nowrap;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.nav-link, .nav-button {
    color: var(--foreground);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.95rem;
    border: none;
    background: none;
    cursor: pointer;
    font-family: var(--font-sans);
}

.nav-link:hover, .nav-button:hover {
    background: var(--primary);
    color: var(--primary-foreground);
    transform: translateY(-2px);
}

.nav-button {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--foreground);
}

/* Sections */
.section {
    padding: 3rem 0;
}

.section.bg-light {
    background: color-mix(in oklch, var(--muted) 30%, transparent);
}

/* Headings */
h2 {
    font-size: clamp(2rem, 5vw, 2.8rem);
    margin-bottom: 2rem;
    text-align: center;
    color: var(--primary);
    font-weight: 700;
}

h3 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin-bottom: 1rem;
    color: var(--primary);
    font-weight: 600;
}

h4 {
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    margin-bottom: 0.8rem;
    color: var(--chart-2);
    font-weight: 600;
}

/* Cards */
.card {
    background: var(--card);
    color: var(--card-foreground);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    border: 1px solid var(--border);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

/* Overview Grid */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.overview-card {
    background: var(--card);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transition: all 0.3s;
    border: 1px solid var(--border);
}

.overview-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.overview-card h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.overview-card ul {
    list-style: none;
    padding-left: 0;
}

.overview-card li {
    padding: 0.6rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--card-foreground);
}

.overview-card li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
    font-size: 1.1rem;
}

/* Lab Cards */
.lab-card {
    background: var(--card);
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.lab-card h3 {
    color: var(--primary);
    border-bottom: 3px solid var(--primary);
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
    font-size: clamp(1.3rem, 3vw, 1.8rem);
}

.lab-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: 2rem;
}

.concept-block ul {
    list-style: none;
    padding-left: 0;
}

.concept-block li {
    padding: 0.7rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--card-foreground);
}

.concept-block li::before {
    content: "▸";
    position: absolute;
    left: 0;
    color: var(--chart-2);
    font-weight: bold;
}

.concept-block li ul {
    margin-top: 0.5rem;
    padding-left: 1.5rem;
}

/* Memory Aid */
.memory-aid {
    background: color-mix(in oklch, var(--accent) 20%, transparent);
    padding: 1.5rem;
    border-radius: var(--radius);
    border-left: 5px solid var(--accent);
}

.memory-box {
    background: var(--card);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.memory-box ol, .memory-box ul {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
}

.mnemonic {
    background: color-mix(in oklch, var(--accent) 40%, var(--card) 60%);
    padding: 1rem;
    border-radius: var(--radius);
    margin-top: 1rem;
    border-left: 4px solid var(--accent);
}

.mnemonic strong {
    color: var(--destructive);
}

.highlight {
    background: var(--accent);
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
}

/* Code Block */
.code-example {
    background: var(--muted);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin: 1.5rem 0;
    border-left: 5px solid var(--primary);
    overflow-x: auto;
}

.code-example h4 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.code-block {
    background: color-mix(in oklch, var(--background) 80%, var(--muted) 20%);
    padding: 1rem;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--foreground);
    overflow-x: auto;
    border: 1px solid var(--border);
}

.code-block code {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.code-block .keyword {
    color: var(--primary);
    font-weight: 600;
}

.code-block .function {
    color: var(--chart-1);
}

.code-block .comment {
    color: var(--muted-foreground);
    font-style: italic;
}

/* Calculation Section */
.calculation-section {
    background: color-mix(in oklch, var(--secondary) 15%, transparent);
    padding: 2rem;
    border-radius: var(--radius);
    margin: 1.5rem 0;
    border: 2px solid var(--secondary);
}

.calculation-section h4 {
    color: var(--secondary);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.calculation-steps {
    background: var(--card);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-top: 1rem;
}

.calculation-step {
    margin: 1rem 0;
    padding: 1rem;
    background: color-mix(in oklch, var(--muted) 10%, transparent);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary);
}

.calculation-step .step-number {
    display: inline-block;
    background: var(--primary);
    color: var(--primary-foreground);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    text-align: center;
    line-height: 30px;
    font-weight: 700;
    margin-right: 1rem;
}

.formula {
    background: var(--card);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin: 1rem 0;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 1.1rem;
    border: 2px solid var(--border);
    overflow-x: auto;
}

/* Visualization */
.visualization {
    background: color-mix(in oklch, var(--secondary) 20%, transparent);
    padding: 1.5rem;
    border-radius: var(--radius);
    text-align: center;
}

.visual-placeholder {
    background: var(--card);
    padding: 2rem;
    border-radius: var(--radius);
    margin-top: 1rem;
    border: 2px dashed var(--border);
}

.arrow {
    font-size: 2rem;
    color: var(--primary);
    margin: 1rem 0;
}

/* Topics Grid */
.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
    gap: 2rem;
}

.topic-card {
    background: var(--card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.topic-card h3 {
    color: var(--primary);
    border-bottom: 3px solid var(--chart-2);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.topic-content h4 {
    color: var(--chart-2);
    margin-top: 1rem;
    font-size: 1.2rem;
}

.topic-content ul {
    list-style: none;
    padding-left: 0;
}

.topic-content li {
    padding: 0.6rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--card-foreground);
}

.topic-content li::before {
    content: "★";
    position: absolute;
    left: 0;
    color: var(--accent);
}

/* Glossary */
.glossary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr));
    gap: 1.5rem;
}

.glossary-term {
    background: var(--card);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    transition: all 0.3s;
    border: 1px solid var(--border);
}

.glossary-term:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.glossary-term h4 {
    color: var(--primary);
    margin-bottom: 0.6rem;
    font-size: 1.2rem;
}

.glossary-term p {
    color: var(--muted-foreground);
    font-size: 0.95rem;
}

/* Practice Questions */
.practice-questions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
    gap: 1.5rem;
}

.question-card {
    background: var(--card);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.question-card h4 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.show-answer-btn {
    background: var(--primary);
    color: var(--primary-foreground);
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
    margin-top: 1rem;
    transition: all 0.3s;
    font-weight: 500;
    font-family: var(--font-sans);
}

.show-answer-btn:hover {
    background: color-mix(in oklch, var(--primary) 80%, var(--chart-1) 20%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.answer {
    background: color-mix(in oklch, var(--chart-4) 20%, transparent);
    padding: 1rem;
    border-radius: var(--radius);
    margin-top: 1rem;
    border-left: 4px solid var(--chart-4);
}

/* Cheat Sheet */
.cheat-sheet {
    background: var(--card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.cheat-sheet h3 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 2rem;
    font-size: clamp(1.3rem, 3vw, 1.8rem);
}

.cheat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr));
    gap: 1rem;
}

.cheat-item {
    background: linear-gradient(135deg, var(--primary) 0%, var(--chart-2) 100%);
    color: var(--primary-foreground);
    padding: 1.25rem;
    border-radius: var(--radius);
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.cheat-item:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-xl);
}

.cheat-item strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.cheat-item p {
    font-size: 0.85rem;
    opacity: 0.95;
}

/* Footer */
footer {
    background: color-mix(in oklch, var(--card) 90%, transparent);
    padding: 2rem 0;
    text-align: center;
    margin-top: 4rem;
    border-top: 1px solid var(--border);
}

footer p {
    color: var(--primary);
    font-weight: 600;
    font-size: 1.1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0.75rem;
    }

    .nav-container {
        flex-direction: column;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-link, .nav-button {
        padding: 0.75rem;
        text-align: center;
    }

    h2 {
        font-size: 2rem;
    }

    .lab-content {
        grid-template-columns: 1fr;
    }

    .cheat-grid {
        grid-template-columns: 1fr;
    }

    .overview-grid,
    .topics-grid,
    .glossary-grid,
    .practice-questions {
        grid-template-columns: 1fr;
    }

    .calculation-section,
    .memory-aid,
    .code-example {
        padding: 1rem;
    }

    .formula {
        font-size: 0.9rem;
        padding: 1rem;
    }

    .code-block {
        font-size: 0.8rem;
        padding: 0.75rem;
    }

    .section {
        padding: 2rem 0;
    }
}

@media (max-width: 480px) {
    .nav-title {
        font-size: 1rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.2rem;
    }

    .card,
    .lab-card,
    .overview-card,
    .topic-card {
        padding: 1rem;
    }

    .cheat-item {
        padding: 1rem;
    }

    .cheat-item strong {
        font-size: 0.9rem;
    }

    .cheat-item p {
        font-size: 0.8rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section {
    animation: fadeIn 0.6s ease-out;
}

/* Print Styles */
@media print {
    .navbar {
        position: static;
    }

    .nav-links {
        display: none;
    }

    .show-answer-btn {
        display: none;
    }

    .answer {
        display: block !important;
    }

    .mobile-menu-toggle {
        display: none;
    }

    body {
        background: white;
    }

    .section {
        page-break-inside: avoid;
    }
}

/* Interactive Elements */
.interactive-demo {
    background: var(--card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    margin: 1.5rem 0;
    border: 2px solid var(--border);
}

.interactive-demo h4 {
    color: var(--primary);
    margin-bottom: 1rem;
}

.demo-placeholder {
    background: color-mix(in oklch, var(--muted) 30%, transparent);
    padding: 2rem;
    border-radius: var(--radius);
    text-align: center;
    color: var(--muted-foreground);
    border: 2px dashed var(--border);
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    margin: 1rem 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

th {
    background: var(--primary);
    color: var(--primary-foreground);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--card-foreground);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background: color-mix(in oklch, var(--muted) 20%, transparent);
}
