/* Modern Color Scheme & Design System V5 */
:root {
    /* Brand Colors */
    --primary-color: #FEBD59;
    /* Brand Orange/Yellow */
    --secondary-color: #000000;
    /* Black */
    --accent-color: #F0F0D5;
    /* Light Beige/Yellowish */

    /* Backgrounds */
    --bg-body: #FAF8F3;
    /* Off-white Cream - Page BG */
    --bg-surface: #FFFFFF;
    /* Pure White - Card BG */
    --bg-alt: #F0F0D5;
    /* Secondary BG (Accent) */

    /* Texts */
    --text-primary: #000000;
    /* Black */
    --text-secondary: #333333;
    /* Dark Grey */
    --text-tertiary: #666666;
    /* Medium Grey */
    --text-on-primary: #000000;
    /* Black text on primary (contrast) */

    /* Borders & Shadows */
    --border-color: #E5E5E5;
    --border-hover: #FEBD59;

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

    /* Metrics */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --header-height: 80px;
    --container-width: 1200px;
}

/* Dark Mode Overrides */
[data-theme="dark"] {
    --bg-body: #111111;
    --bg-surface: #1A1A1A;
    --bg-alt: #222222;

    --text-primary: #FFFFFF;
    --text-secondary: #CCCCCC;
    --text-tertiary: #999999;

    --border-color: #333333;

    /* Ensure Download buttons remain readable */
    --text-on-primary: #000000;
}

/* Base Reset */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background 0.3s, color 0.3s;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Typography */
h1,
h2,
h3,
h4 {
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.3;
}

h1 {
    margin-bottom: 1.5rem;
    font-size: 2.25rem;
}

h2 {
    margin-top: 2.5rem;
    margin-bottom: 1.25rem;
    font-size: 1.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(0, 0, 0, 0.05);
    /* Subtle separator */
}

[data-theme="dark"] h2 {
    border-color: rgba(255, 255, 255, 0.1);
}

h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.35rem;
}

p {
    margin-bottom: 1.25rem;
    color: var(--text-secondary);
}

ul,
ol {
    padding-left: 2rem;
    /* Indentation fix */
    margin-bottom: 1.5rem;
}

li {
    margin-bottom: 0.6rem;
    /* Spacing between list items */
    color: var(--text-secondary);
}

b,
strong {
    color: var(--text-primary);
}

a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s;
}

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

/* Container */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
.site-header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .site-header {
    background: rgba(26, 26, 26, 0.85);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.brand-logo {
    font-weight: 800;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.75rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: 0.95rem;
    border: 2px solid transparent;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--text-on-primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    filter: brightness(1.05);
}

.btn-secondary {
    background-color: transparent;
    border: 2px solid var(--text-primary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--text-primary);
    color: var(--bg-surface);
}

/* Download Button Sidebar Special */
.download-btn-sidebar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: var(--primary-color);
    color: var(--text-on-primary);
    padding: 1rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.download-btn-sidebar:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
    color: var(--text-on-primary) !important;
}

[data-theme="dark"] .download-btn-sidebar {
    color: #000000 !important;
}

/* Layouts */
.page-wrapper {
    padding: 4rem 0;
    flex-grow: 1;
    /* Pushes footer down */
}

/* STRICT LAYOUT DEFINITION */
.policy-layout {
    display: grid;
    /* Grid Areas enforce position regardless of HTML order */
    grid-template-columns: 300px 1fr;
    grid-template-areas: "sidebar content";
    gap: 4rem;
    align-items: start;
    position: relative;
}

.toc-sidebar {
    grid-area: sidebar;
    /* FORCE LEFT */
    position: sticky;
    top: calc(var(--header-height) + 2rem);
    max-height: calc(100vh - var(--header-height) - 4rem);
    overflow-y: auto;
    padding-right: 1rem;
    background: transparent;
}

/* TOC Navigation Fixes */
.toc-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.toc-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.toc-link {
    display: block;
    padding: 0.6rem 0.75rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all 0.2s;
    line-height: 1.4;
    border-left: 2px solid transparent;
}

.toc-link:hover {
    background-color: rgba(254, 189, 89, 0.15);
    /* Light Orange tint */
    color: var(--text-primary);
}

.toc-link.active {
    background-color: #FFF8E1;
    /* Lighter Orange/Yellow */
    color: #E65100;
    /* Darker Orange */
    font-weight: 600;
    border-left-color: var(--primary-color);
}

.content-area {
    grid-area: content;
    /* FORCE RIGHT */
    background: var(--bg-surface);
    padding: 3rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    min-width: 0;
}

/* Highlight Box */
.highlight-box {
    background: #FFFCF5;
    /* Very light warm bg */
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    margin: 2rem 0;
    border: 1px solid #FFE0B2;
}

/* Dark Mode Fixes for Highlight Box */
[data-theme="dark"] .highlight-box {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}

.highlight-box h3 {
    margin-top: 0;
    color: #F57C00;
    /* Deep Orange */
}

[data-theme="dark"] .highlight-box h3 {
    color: var(--primary-color);
}

/* Back Link */
.back-link {
    display: inline-block;
    margin-bottom: 2rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

.back-link:hover {
    color: var(--primary-color);
}

/* Footer Styling */
.site-footer {
    text-align: center;
    padding: 3rem 1.5rem 4rem;
    /* Top Side Bottom */
    border-top: 1px solid var(--border-color);
    color: var(--text-tertiary);
    margin-top: auto;
    width: 100%;
}

.footer-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 0.5rem;
}

/* Form Styles */
.form-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s;
}

.form-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(254, 189, 89, 0.2);
}

/* Mobile TOC Toggle (Hidden on Desktop) */
.mobile-toc-toggle {
    display: none;
}

/* Responsive */
@media (max-width: 900px) {
    .policy-layout {
        display: block;
    }

    /* Show Toggle on Mobile */
    .mobile-toc-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: var(--bg-surface);
        padding: 1rem;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        margin-bottom: 1rem;
        cursor: pointer;
        font-weight: 600;
        color: var(--text-primary);
    }

    .mobile-toc-toggle::after {
        content: '▼';
        font-size: 0.8rem;
    }

    .toc-sidebar {
        display: none;
        /* Mobile logic handles this via JS usually */
        width: 100%;
        position: relative;
        top: 0;
        max-height: 400px;
        overflow-y: auto;
        margin-bottom: 2rem;
        padding-right: 0;
        background: var(--bg-surface);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        padding: 1rem;
        box-shadow: var(--shadow-sm);
    }

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

    .content-area {
        padding: 1.5rem;
    }
}


/* Permissions Table */
.permissions-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.95rem;
}

.permissions-table th,
.permissions-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.permissions-table th {
    background: var(--bg-alt);
    font-weight: 600;
}

.permissions-table tr:hover {
    background: var(--bg-alt);
}
