:root {
    /* Primary Brand Colors from docs/style.css */
    --dl-color-branded-blue: #054168;
    --dl-color-branded-coral: #d3564c;
    --dl-color-branded-maroon: #6d2931;
    --dl-color-branded-mustard: #dcab4f;
    
    /* Grey Scale */
    --dl-color-branded-grey100: #e2e2e4;
    --dl-color-branded-grey200: #d1d3d6;
    --dl-color-branded-grey300: #a2a5a9;
    --dl-color-branded-grey500: #737678;
    --dl-color-branded-grey600: #54585f;
    --dl-color-branded-grey900: #2d2926;
    --dl-color-branded-background: #f3f3f3;
    --dl-color-branded-white: #ffffff;
    --dl-color-branded-black: #000000;
    
    /* Radius */
    --dl-radius-radius2: 2px;
    --dl-radius-radius4: 4px;
    
    /* Spacing */
    --dl-space-halfunit: 8px;
}

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

html, body {
    height: 100%;
}

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: var(--dl-color-branded-grey900);
    background-color: var(--dl-color-branded-white);
    line-height: 1.6;
    font-size: 15px;
    font-weight: 400;
}

/* Header & Navigation */
header {
    background-color: var(--dl-color-branded-white);
    border-bottom: 1px solid var(--dl-color-branded-grey200);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.navbar {
    padding: var(--dl-space-halfunit) 0 !important;
    display: flex;
    align-items: center;
}

.navbar-brand {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--dl-color-branded-blue) !important;
    letter-spacing: -0.3px;
    font-family: 'Montserrat', sans-serif;
}

.navbar img {
    display: block;
    margin: auto;
    height: auto;
}

.nav-link {
    color: var(--dl-color-branded-grey500) !important;
    margin-left: 2rem !important;
    transition: color 0.2s ease;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: 'Montserrat', sans-serif;
}

.nav-link:hover {
    color: var(--dl-color-branded-coral) !important;
}

/* Hero Section */
.hero-section {
    background-color: var(--dl-color-branded-background);
    color: var(--dl-color-branded-grey900);
    padding: 2.5rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--dl-color-branded-grey200);
    text-align: center;
}

.hero-section h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    letter-spacing: -0.5px;
    font-family: 'Montserrat', sans-serif;
    color: var(--dl-color-branded-blue);
}

.hero-section p {
    font-size: 0.95rem;
    color: var(--dl-color-branded-grey500);
}

.last-updated {
    font-size: 0.85rem;
    color: var(--dl-color-branded-grey500);
    margin-top: 0.8rem;
    font-weight: 500;
}

/* Main Container Layout */
.terms-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin: 2rem 0;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

/* Table of Contents */
.toc-sidebar {
    background: var(--dl-color-branded-background);
    border: 1px solid var(--dl-color-branded-grey200);
    border-radius: var(--dl-radius-radius4);
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 100px;
}

.toc-sidebar h5 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--dl-color-branded-blue);
    margin-bottom: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
    font-family: 'Montserrat', sans-serif;
}

.toc-list {
    list-style: none;
}

.toc-list li {
    margin-bottom: 0.35rem;
}

.toc-list a {
    color: var(--dl-color-branded-grey500);
    text-decoration: none;
    display: block;
    padding: 0.5rem 0.75rem;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    line-height: 1.4;
    border-radius: var(--dl-radius-radius2);
}

.toc-list a:hover {
    color: var(--dl-color-branded-coral);
    border-left-color: var(--dl-color-branded-coral);
    background-color: rgba(0, 116, 240, 0.05);
    padding-left: 1rem;
}

.toc-list a.active {
    color: var(--dl-color-branded-white);
    background-color: var(--dl-color-branded-coral);
    border-left-color: transparent;
    font-weight: 600;
}

/* Mobile TOC Toggle */
.toc-toggle {
    display: none;
    width: 100%;
    margin-bottom: 1.5rem;
    background-color: var(--dl-color-branded-background);
    border: 1px solid var(--dl-color-branded-grey200);
    color: var(--dl-color-branded-blue);
    border-radius: var(--dl-radius-radius4);
    font-weight: 500;
    font-family: 'Montserrat', sans-serif;
}

.toc-toggle:hover {
    background-color: #eeeff0;
}

.toc-toggle.show {
    display: block;
}

/* Content Area */
.content-area {
    background: var(--dl-color-branded-white);
}

.section {
    margin-bottom: 2.8rem;
    scroll-margin-top: 100px;
}

.section-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--dl-color-branded-blue);
    margin-bottom: 1.3rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--dl-color-branded-grey200);
    letter-spacing: -0.3px;
    font-family: 'Montserrat', sans-serif;
}

.subsection {
    margin-bottom: 1.3rem;
}

.subsection-heading {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dl-color-branded-grey600);
    margin-bottom: 0.4rem;
    font-family: 'Montserrat', sans-serif;
}

.subsection-text {
    color: var(--dl-color-branded-grey500);
    line-height: 1.7;
    font-size: 0.95rem;
}

/* Alert Box */
.alert {
    border-left: 4px solid var(--dl-color-branded-coral);
    border-radius: var(--dl-radius-radius4);
    margin-top: 2rem;
    background-color: rgba(0, 116, 240, 0.05);
    border: 1px solid rgba(0, 116, 240, 0.1);
}

.alert-heading {
    color: var(--dl-color-branded-blue);
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
}

/* Footer */
footer {
    background-color: var(--dl-color-branded-background);
    color: var(--dl-color-branded-grey900);
    padding: 2rem;
    margin-top: 3rem;
    text-align: center;
    border-top: 1px solid var(--dl-color-branded-grey200);
}

footer p {
    font-size: 0.9rem;
    margin: 0.3rem 0;
}

footer a {
    color: var(--dl-color-branded-coral);
    text-decoration: none;
    transition: color 0.2s ease;
    font-weight: 500;
}

footer a:hover {
    color: var(--dl-color-branded-blue);
    text-decoration: underline;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--dl-color-branded-coral);
    color: var(--dl-color-branded-white);
    width: 50px;
    height: 50px;
    border-radius: var(--dl-radius-radius4);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    border: none;
    z-index: 99;
    font-size: 1.3rem;
    font-weight: 700;
}

.back-to-top:hover {
    background-color: var(--dl-color-branded-maroon);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.back-to-top.show {
    display: flex;
}

/* Responsive Design - Mobile First */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    .hero-section {
        padding: 2rem 0;
    }

    .hero-section h1 {
        font-size: 1.65rem;
    }

    .terms-container {
        gap: 1.5rem;
    }

    .toc-sidebar {
        position: static;
        top: auto;
        margin-bottom: 0;
        order: 2;
    }

    .toc-sidebar {
        display: none;
        max-height: 350px;
        overflow-y: auto;
    }

    .toc-sidebar.show {
        display: block;
    }

    .section-title {
        font-size: 1.15rem;
    }

    .subsection-heading {
        font-size: 0.95rem;
    }

    .subsection-text {
        font-size: 0.9rem;
    }

    .back-to-top {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
}

@media (max-width: 576px) {
    body {
        font-size: 13px;
    }

    .hero-section {
        padding: 1.5rem 0;
    }

    .hero-section h1 {
        font-size: 1.4rem;
    }

    .hero-section p {
        font-size: 0.9rem;
    }

    .navbar-brand {
        font-size: 1.2rem;
    }

    .nav-link {
        margin-left: 1rem !important;
    }

    .toc-list a {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }

    .section {
        margin-bottom: 2rem;
    }

    .section-title {
        font-size: 1.05rem;
        margin-bottom: 1rem;
    }

    .subsection-heading {
        font-size: 0.9rem;
    }

    .subsection-text {
        font-size: 0.85rem;
    }

    footer {
        padding: 1.5rem 1rem;
    }

    footer p {
        font-size: 0.8rem;
    }

    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 42px;
        height: 42px;
        font-size: 1rem;
    }
}

/* Tablet and Desktop */
@media (min-width: 992px) {
    .terms-container {
        grid-template-columns: 1fr 260px;
        gap: 3rem;
    }

    .content-area {
        order: 1;
    }

    .toc-sidebar {
        display: block !important;
        order: 2;
    }

    .toc-toggle {
        display: none !important;
    }
}

/* Print Styles */
@media print {
    header, footer, .back-to-top, .toc-toggle, .toc-sidebar {
        display: none;
    }

    .hero-section {
        page-break-after: avoid;
    }

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

    body {
        background-color: var(--dl-color-branded-white);
        color: var(--dl-color-branded-grey900);
    }
}
