/* --- 1. VARIABLES (SYSTEM WIDE) --- */
:root {
    /* Colors */
    --bg-main: #030712;
    --bg-secondary: #0f172a;
    --primary: #2563eb;
    --primary-glow: rgba(37, 99, 235, 0.4);
    --accent: #06b6d4;
    --accent-glow: rgba(6, 182, 212, 0.4);
    --error: #ef4444;
    
    /* Text */
    --text-white: #f8fafc;
    --text-gray: #94a3b8;
    --text-muted: #64748b;

    /* UI */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --nav-height: 80px; /* Base height desktop */
    --font-main: 'Outfit', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- 2. RESET & BASE --- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    background-color: var(--bg-main);
    color: var(--text-gray);
    font-family: var(--font-main);
    line-height: 1.7;
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3 { color: var(--text-white); font-weight: 700; text-wrap: balance; }
a { text-decoration: none; color: inherit; transition: var(--transition); }
button { font-family: inherit; border: none; background: none; cursor: pointer; }

/* Ambient Glows */
.ambient-glow {
    position: fixed; width: 600px; height: 600px;
    border-radius: 50%; filter: blur(140px); z-index: -1; opacity: 0.2;
    pointer-events: none;
}
.glow-1 { top: -100px; left: -100px; background: var(--primary); }
.glow-2 { bottom: 0; right: -100px; background: var(--accent); }

/* --- 3. UNIFIED NAVIGATION (DESKTOP HEADER) --- */
.glass-nav {
    position: sticky; top: 0; left: 0; width: 100%; 
    height: auto;
    min-height: var(--nav-height);
    z-index: 1000; 
    background: rgba(3, 7, 18, 0.9); 
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    transition: all 0.3s ease;
}

.nav-container {
    max-width: 1240px; margin: 0 auto; padding: 0 24px;
    display: flex; justify-content: space-between; align-items: center;
    min-height: var(--nav-height);
    flex-wrap: nowrap;
}

/* Logo */
.nav-logo { height: 50px; width: auto; display: block; }

/* Center Tabs (Desktop Only) */
.nav-center { display: flex; justify-content: center; flex: 1; }
.legal-tabs { 
    display: flex; gap: 4px; background: rgba(255,255,255,0.05); 
    padding: 4px; border-radius: 50px; border: 1px solid rgba(255,255,255,0.05);
}
.tab-item {
    padding: 8px 24px; border-radius: 40px; font-size: 0.9rem; font-weight: 500; 
    color: var(--text-gray); white-space: nowrap; transition: var(--transition);
}
.tab-item:hover { color: var(--text-white); }
.tab-item.active {
    background: rgba(255,255,255,0.1); color: var(--text-white); font-weight: 600;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* Back Button Pill */
.btn-pill-back {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 16px; border-radius: 50px; font-size: 0.85rem; font-weight: 500;
    color: var(--text-white); border: 1px solid rgba(255,255,255,0.15);
    background: transparent; transition: var(--transition);
}
.btn-pill-back:hover { background: rgba(255,255,255,0.08); border-color: var(--text-white); }

/* --- MOBILE BOTTOM NAV (HIDDEN ON DESKTOP) --- */
.mobile-bottom-nav { display: none; }

/* --- 4. LAYOUT --- */
.legal-wrapper { padding-top: 40px; padding-bottom: 80px; }
.container { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

.grid-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    align-items: start;
}

/* --- 5. SIDEBAR (TOC) --- */
.sidebar { position: sticky; top: 120px; }

.glass-panel-sm {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 20px;
    backdrop-filter: blur(10px);
}

.toc-header {
    font-weight: 600; color: var(--text-white); margin-bottom: 16px;
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.95rem;
}
.mobile-only { display: none; }

.toc-list { list-style: none; border-left: 2px solid rgba(255,255,255,0.05); padding: 0; }
.toc-list li { margin-bottom: 0; }
.toc-list a {
    display: block; padding: 8px 0 8px 16px; color: var(--text-gray);
    font-size: 0.9rem; border-left: 2px solid transparent; margin-left: -2px;
}
.toc-list a:hover { color: var(--accent); }
.toc-list a.active {
    color: var(--accent); border-left-color: var(--accent); font-weight: 500;
    background: linear-gradient(90deg, rgba(6,182,212,0.05), transparent);
}

/* --- 6. MAIN CONTENT --- */
.glass-panel {
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: 60px;
    position: relative;
    box-shadow: 0 25px 60px -15px rgba(0,0,0,0.5);
}

.glass-panel::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(6, 182, 212, 0.3), transparent);
}

.doc-header { margin-bottom: 40px; }
.badge-legal {
    display: inline-block; padding: 4px 12px; border-radius: 20px;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    font-size: 0.75rem; letter-spacing: 1px; color: var(--accent); margin-bottom: 16px;
    font-weight: 600;
}
.doc-header h1 { font-size: 2.8rem; margin-bottom: 10px; letter-spacing: -1px; }
.last-updated { font-size: 0.9rem; color: var(--text-muted); }
.last-updated strong { color: var(--accent); }

.summary-box {
    background: rgba(6, 182, 212, 0.05);
    border: 1px solid rgba(6, 182, 212, 0.15);
    border-radius: var(--radius-md);
    padding: 24px; margin-bottom: 40px;
}
.summary-box h3 { color: var(--accent); font-size: 1.1rem; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.s-item strong { display: block; color: var(--text-white); margin-bottom: 4px; font-size: 0.9rem; }
.s-item p { font-size: 0.85rem; line-height: 1.5; margin: 0; }

.divider { height: 1px; background: rgba(255,255,255,0.1); margin: 40px 0; }

section { margin-bottom: 50px; scroll-margin-top: 140px; }
section h2 { font-size: 1.6rem; margin-bottom: 16px; color: var(--text-white); }
section h3 { font-size: 1.1rem; margin-bottom: 10px; color: var(--text-white); margin-top: 20px; }
section p { margin-bottom: 16px; text-align: left; }

.link-highlight { color: var(--accent); border-bottom: 1px solid rgba(6,182,212,0.3); }
.link-highlight:hover { border-bottom-color: var(--accent); }

ul { list-style: none; padding-left: 20px; margin-bottom: 20px; }
li { position: relative; padding-left: 10px; margin-bottom: 8px; }
li::before {
    content: "\f054"; font-family: 'Font Awesome 6 Free'; font-weight: 900;
    position: absolute; left: -15px; top: 6px; font-size: 0.7rem; color: var(--accent);
}

.clause-warning {
    background: rgba(239, 68, 68, 0.05); border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 30px; border-radius: var(--radius-md);
}
.clause-warning h2 { color: var(--error); display: flex; align-items: center; gap: 10px; }
.danger-list li::before { color: var(--error); content: "\f00d"; }

.cookie-type {
    background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05);
    padding: 20px; border-radius: var(--radius-sm); margin-bottom: 16px;
}
.cookie-type h3 { margin-top: 0; display: flex; align-items: center; gap: 10px; }
.cookie-type h3 i { color: var(--primary); font-size: 1rem; }

.note-box {
    background: rgba(239, 68, 68, 0.05); border-left: 3px solid var(--error);
    padding: 16px; border-radius: 4px; font-size: 0.9rem; color: #fca5a5;
}

/* Generic Buttons (Terms support) */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    padding: 10px 24px; border-radius: 50px; font-weight: 500; font-size: 0.95rem;
    text-decoration: none; transition: var(--transition); cursor: pointer;
}
.btn-outline {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-white);
}
.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-white);
}

/* Footer */
.simple-footer {
    border-top: 1px solid rgba(255,255,255,0.1); padding: 30px 0;
    color: var(--text-muted); font-size: 0.85rem;
}
.text-center { text-align: center; }

/* --- 7. RESPONSIVE BREAKPOINTS (STRICT) --- */

@media(min-width:1200px){ }

@media(max-width:1199px) and (min-width:992px){
    .grid-layout { grid-template-columns: 240px 1fr; gap: 30px; }
    .glass-panel { padding: 50px; }
}

@media(max-width:991px) and (min-width:768px){
    /* --- TABLET UX FIX: ANCHORED TOC --- */
    .grid-layout { grid-template-columns: 1fr; gap: 0; }
    
    /* Pull wrapper closer to header */
    .legal-wrapper { padding-top: 20px; }

    /* Sticky Sidebar sits perfectly under 80px header */
    .sidebar { 
        position: sticky; 
        top: 80px; /* Anchored to header bottom */
        z-index: 90; 
        margin-bottom: 24px; 
    }
    
    .toc-container { padding: 0; overflow: hidden; }
    .toc-header { padding: 16px 20px; margin: 0; cursor: pointer; background: rgba(255,255,255,0.02); }
    .mobile-only { display: block; transition: transform 0.3s; }
    
    .toc-list { 
        max-height: 0; opacity: 0; transition: all 0.3s ease; border-left: none; padding: 0;
    }
    .toc-list.open { max-height: 500px; opacity: 1; border-top: 1px solid rgba(255,255,255,0.1); }
    .toc-list a { padding: 12px 20px; border-left: 3px solid transparent; }
    
    .toc-container.active .mobile-only { transform: rotate(180deg); }
    .glass-panel { padding: 40px; }
}

@media(max-width:767px){
    /* --- MOBILE HEADER FIX (2 ROWS) --- */
    .glass-nav { 
        height: auto; 
        padding-bottom: 12px;
    }
    
    .nav-container {
        flex-wrap: wrap; 
        padding: 12px 16px;
        row-gap: 16px;
    }

    /* ROW 1: Logo & Back Button */
    .nav-left { order: 1; flex: 0 0 auto; }
    .nav-right { order: 2; flex: 0 0 auto; margin-left: auto; }
    
    /* Smaller button for mobile */
    .btn-pill-back {
        padding: 6px 14px;
        font-size: 0.8rem;
    }

    /* ROW 2: Mobile Bottom Nav (Floating Glass Pill) */
    .nav-center { display: none !important; } /* Hide Desktop Tabs */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 16px;
        left: 50%;
        transform: translateX(-50%);
        width: min(560px, calc(100% - 24px));
        background: rgba(15, 23, 42, 0.85);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 999px;
        padding: 6px;
        z-index: 1200;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
        justify-content: space-between;
        align-items: center;
    }

    .mobile-tab-item {
        flex: 1;
        text-align: center;
        padding: 10px 0;
        border-radius: 999px;
        font-size: 0.85rem;
        color: var(--text-gray);
        font-weight: 500;
        transition: all 0.3s ease;
        display: flex; justify-content: center; align-items: center;
        min-height: 40px;
    }

    .mobile-tab-item:hover { color: var(--text-white); }
    
    .mobile-tab-item.active {
        background: rgba(255, 255, 255, 0.12);
        color: var(--text-white);
        font-weight: 600;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    }

    /* Content Layout */
    body { padding-bottom: 100px; } /* Ensure footer/content isn't covered */
    .legal-wrapper { padding-top: 20px; }
    .grid-layout { grid-template-columns: 1fr; gap: 0; }
    .sidebar { position: relative; top: 0; margin-bottom: 24px; }
    
    .toc-container { border-radius: 8px; }
    .toc-header { padding: 14px 16px; font-size: 0.9rem; }
    .toc-list.open { max-height: 60vh; overflow-y: auto; }

    .glass-panel { padding: 24px; border-radius: 16px; }
    .doc-header h1 { font-size: 2rem; }
    
    .summary-grid { grid-template-columns: 1fr; }
    section h2 { font-size: 1.4rem; }
}