/* Modern Academic Design System v2.0 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Merriweather:ital,wght@0,300;0,400;0,700;1,400&family=JetBrains+Mono:wght@400&display=swap');

:root {
    /* Color Palette - Premium Academic */
    --primary: #0f172a;
    /* Deep Navy */
    --primary-light: #1e293b;
    --secondary: #334155;
    /* Slate */
    --accent: #0ea5e9;
    /* Sky Blue */
    --accent-dark: #0284c7;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;

    --border: #e2e8f0;
    --border-hover: #cbd5e1;

    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
}

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

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    background-color: var(--bg-body);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Inter', sans-serif;
    color: var(--primary);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.75rem;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 2rem;
    letter-spacing: -0.02em;
    margin-top: 2.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border);
}

h3 {
    font-size: 1.5rem;
    margin-top: 2rem;
    color: var(--secondary);
}

p {
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
    color: var(--secondary);
}

a {
    color: var(--accent-dark);
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
}

a:hover {
    color: var(--accent);
}

/* Layout */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Navbar */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 5rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 2.5rem;
    list-style: none;
    align-items: center;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--primary);
    cursor: pointer;
}

/* Dropdown Menu */
.nav-item {
    position: relative;
}

.nav-link {
    color: var(--secondary);
    font-weight: 500;
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
}

.nav-link:hover {
    color: var(--accent-dark);
}

.nav-link i.fa-chevron-down {
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--bg-card);
    min-width: 260px;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.nav-item:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.dropdown-link {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--secondary);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
}

.dropdown-link:hover {
    background: var(--bg-body);
    color: var(--accent-dark);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #0f172a 100%);
    color: var(--white);
    padding: 6rem 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 50%, rgba(14, 165, 233, 0.15), transparent 70%);
    z-index: 1;
}

.hero h1 {
    color: #ffffff;
    margin-bottom: 1.5rem;
}

.hero p {
    color: #cbd5e1;
    font-size: 1.25rem;
    max-width: 700px;
    margin: 0 auto 2.5rem;
}

.hero .container {
    position: relative;
    z-index: 2;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    background: var(--accent);
    color: #ffffff;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.btn-outline {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #ffffff;
    color: #ffffff;
    box-shadow: none;
}

/* Cards & Grid */
.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    padding: 2rem 0;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.card-icon {
    width: 3rem;
    height: 3rem;
    background: #e0f2fe;
    color: var(--accent-dark);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
}

.card h3 {
    font-size: 1.25rem;
    margin-top: 0;
    margin-bottom: 0.75rem;
    color: var(--primary);
}

.card p {
    font-size: 0.95rem;
    margin-bottom: 0;
    flex-grow: 1;
}

/* Academic Components */
.formula-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: var(--radius-md);
    font-family: 'Merriweather', serif;
    font-size: 1.1rem;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.example-box {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin: 2rem 0;
}

.example-title {
    color: #15803d;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.definition-box {
    background: #fffbeb;
    border: 1px solid #fde68a;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    margin: 2rem 0;
}

/* Tables */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 2rem 0;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
}

th,
td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--primary);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

tr:nth-child(even) {
    background: #f8fafc;
}

/* Sidebar Layout */
.page-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 4rem;
    padding: 4rem 0;
}

.sidebar {
    position: sticky;
    top: 7rem;
    height: fit-content;
}

.sidebar h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.sidebar-nav {
    list-style: none;
    border-left: 2px solid var(--border);
}

.sidebar-link {
    display: block;
    padding: 0.5rem 0 0.5rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    border-left: 2px solid transparent;
    margin-left: -2px;
    transition: all 0.2s;
}

.sidebar-link:hover,
.sidebar-link.active {
    color: var(--accent-dark);
    border-left-color: var(--accent);
    font-weight: 600;
}

.content-area {
    min-width: 0;
}

/* Prevents overflow */

/* Calculator Styles */
.calculator-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.calculator-section:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--accent);
}

.calculator-section h2 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: none;
    padding-bottom: 0;
}

.calculator-section h2 i {
    color: var(--accent);
    font-size: 1.5rem;
    background: #e0f2fe;
    padding: 0.5rem;
    border-radius: var(--radius-md);
}

.calc-input-group {
    margin-bottom: 1.5rem;
}

.calc-input-group label {
    display: block;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.calc-input-group input,
.calc-input-group select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
    background-color: #f8fafc;
    color: var(--primary);
}

.calc-input-group input:focus,
.calc-input-group select:focus {
    outline: none;
    border-color: var(--accent);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
}

.calc-input-group input::placeholder {
    color: var(--text-light);
}

.calc-result {
    margin-top: 2rem;
    background: #f0fdf4;
    /* Light green tint */
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    animation: slideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.calc-result p {
    margin-bottom: 0.75rem;
    font-size: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed #bbf7d0;
    padding-bottom: 0.75rem;
    color: var(--secondary);
}

.calc-result p:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.calc-result strong {
    font-weight: 600;
}

.calc-result span {
    font-weight: 700;
    color: #15803d;
    /* Darker green */
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    background: #ffffff;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-sm);
    border: 1px solid #bbf7d0;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Reusing generic form styles if needed elsewhere, but keeping calculator specific above */
.form-group {
    margin-bottom: 1.5rem;
}

/* Footer */
footer {
    background: var(--primary);
    color: var(--text-light);
    padding: 5rem 0 2rem;
    margin-top: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 4rem;
    margin-bottom: 4rem;
}

.footer-col h4 {
    color: #ffffff;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: var(--text-light);
    font-weight: 400;
}

.footer-links a:hover {
    color: #ffffff;
}

/* Responsive */
@media (max-width: 1024px) {
    .page-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .sidebar {
        position: static;
        margin-bottom: 2rem;
        border-bottom: 1px solid var(--border);
        padding-bottom: 1rem;
    }

    .sidebar h3 {
        display: none;
    }

    .sidebar-nav {
        border-left: none;
        display: flex;
        overflow-x: auto;
        gap: 1rem;
        padding-bottom: 0.5rem;
    }

    .sidebar-link {
        border-left: none;
        border-bottom: 2px solid transparent;
        padding: 0.5rem 0;
        margin-left: 0;
        white-space: nowrap;
    }

    .sidebar-link:hover,
    .sidebar-link.active {
        border-left-color: transparent;
        border-bottom-color: var(--accent);
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

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

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .hero h1 {
        font-size: 2rem;
    }
}