/* Terms of Service, Legal & Cookies Pages - Glass Morphism with Navy & Teal Theme */

:root {
    /* Light theme - Navy & Teal */
    --bg-primary: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow-light: 0 1px 3px 0 rgba(30, 41, 59, 0.1), 0 1px 2px 0 rgba(30, 41, 59, 0.06);
    --shadow-medium: 0 4px 6px -1px rgba(30, 41, 59, 0.1), 0 2px 4px -1px rgba(30, 41, 59, 0.06);
    --shadow-large: 0 20px 25px -5px rgba(30, 41, 59, 0.1), 0 10px 10px -5px rgba(30, 41, 59, 0.04);
    --accent-primary: #1e3a8a;
    --accent-secondary: #0d9488;
    --accent-danger: #dc2626;
    --accent-warning: #d97706;
    --accent-success: #059669;
    --glass-bg: rgba(255, 255, 255, 0.25);
    --glass-border: rgba(30, 58, 138, 0.18);
    --toc-bg: rgba(255, 255, 255, 0.8);
    --section-bg: rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #475569;
    --shadow-light: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-medium: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-large: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    --accent-primary: #3b82f6;
    --accent-secondary: #14b8a6;
    --glass-bg: rgba(51, 65, 85, 0.25);
    --glass-border: rgba(59, 130, 246, 0.18);
    --toc-bg: rgba(30, 41, 59, 0.8);
    --section-bg: rgba(30, 41, 59, 0.6);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 120px; /* Adjusted for fixed navbar */
}
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -3;
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease;
}
html[data-theme="dark"] {
    color-scheme: dark;
}
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding-top: 100px; /* Space for navbar */
    padding-bottom: 3rem;
    overflow-x: hidden;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Animated Background */
.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background: linear-gradient(-45deg, #1e3a8a, #0d9488, #1e40af, #0891b2);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    opacity: 0.1;
}

[data-theme="dark"] .animated-bg {
    opacity: 0.05;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Floating Orbs */
.orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.5;
    animation: float 20s infinite ease-in-out;
    z-index: -1;
}

.orb1 {
    width: 400px;
    height: 400px;
    background: var(--accent-primary);
    top: -200px;
    left: -200px;
    animation-delay: 0s;
}

.orb2 {
    width: 300px;
    height: 300px;
    background: var(--accent-secondary);
    bottom: -150px;
    right: -150px;
    animation-delay: 5s;
}

.orb3 {
    width: 350px;
    height: 350px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
}

/* Scroll Progress Bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    width: 0;
    background: linear-gradient(90deg, var(--accent-secondary), var(--accent-primary));
    z-index: 1065;
    transition: width 0.3s ease;
}

/* Legal Wrapper Layout */
.legal-wrapper {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Table of Contents */
.table-of-contents {
    position: sticky;
    top: 120px; /* Adjusted for navbar */
    height: calc(100vh - 140px);
    background: var(--toc-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    overflow-y: auto;
    box-shadow: var(--shadow-medium);
    transition: all 0.3s ease;
}

.table-of-contents h3 {
    color: var(--accent-primary);
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

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

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

.toc-list a {
    color: var(--text-secondary);
    text-decoration: none;
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.toc-list a:hover, 
.toc-list a.active {
    color: var(--accent-primary);
    background: var(--glass-bg);
    transform: translateX(5px);
}

/* Main Legal Document */
.legal-document {
    background: var(--section-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: var(--shadow-large);
}

.legal-document h1 {
    font-size: clamp(2rem, 5vw, 2.5rem);
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.effective-date {
    color: var(--text-muted);
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

/* Document Sections */
section {
    margin-bottom: 2.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

section.fade-in {
    opacity: 1;
    transform: translateY(0);
}

section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

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

section strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Contact Section */
.contact-section {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 3rem;
}

.contact-section a {
    color: var(--accent-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.contact-section a:hover {
    color: var(--accent-primary);
    text-decoration: underline;
}

/* Animation Classes */
.fade-in {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .legal-wrapper {
        grid-template-columns: 250px 1fr;
    }
}

@media (max-width: 768px) {
    body {
        padding-top: 80px;
    }
    
    .legal-wrapper {
        grid-template-columns: 1fr;
    }
    
    .table-of-contents {
        position: relative;
        top: 0;
        height: auto;
        margin-bottom: 1.5rem;
        max-height: 300px;
    }
    
    .legal-document {
        padding: 1.5rem;
    }
    
    .orb1, .orb2, .orb3 {
        display: none;
    }
}

@media (max-width: 480px) {
    .legal-document {
        padding: 1.25rem;
    }
    
    .legal-document h1 {
        font-size: 1.75rem;
    }
    
    section h2 {
        font-size: 1.25rem;
    }
}

/* Special Element Styling */
/* Links */
.legal-document a:not(.contact-section a) {
    color: var(--accent-secondary);
    text-decoration: none;
    border-bottom: 1px dotted var(--accent-secondary);
    transition: all 0.3s ease;
}

.legal-document a:hover:not(.contact-section a:hover) {
    color: var(--accent-primary);
    border-bottom: 1px solid var(--accent-primary);
}

/* Lists */
.legal-document ul, 
.legal-document ol {
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
}

.legal-document li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

/* Blockquotes */
.legal-document blockquote {
    border-left: 4px solid var(--accent-secondary);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
}

/* Current section highlight */
section:target {
    animation: highlight 2s ease;
}

@keyframes highlight {
    0% { background: var(--glass-bg); }
    50% { background: var(--glass-bg); }
    100% { background: transparent; }
}

/* Print styles */
@media print {
    body {
        padding: 0;
        background: white;
        color: black;
    }
    
    .animated-bg,
    .orb,
    .scroll-progress,
    .table-of-contents {
        display: none;
    }
    
    .legal-wrapper {
        display: block;
        max-width: 100%;
        padding: 0;
    }
    
    .legal-document {
        background: none;
        box-shadow: none;
        border: none;
        padding: 0;
    }
    
    section {
        page-break-inside: avoid;
    }
    
    a {
        color: black !important;
        text-decoration: underline !important;
        border-bottom: none !important;
    }
}
[data-theme="dark"] body {
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .animated-bg {
    opacity: 0.05 !important;
    background: linear-gradient(-45deg, #3b82f6, #14b8a6, #60a5fa, #2dd4bf) !important;
}

[data-theme="dark"] .orb1 {
    background: var(--accent-primary) !important;
    opacity: 0.3 !important;
}

[data-theme="dark"] .orb2 {
    background: var(--accent-secondary) !important;
    opacity: 0.3 !important;
}

[data-theme="dark"] .orb3 {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)) !important;
    opacity: 0.3 !important;
}

[data-theme="dark"] .legal-document,
[data-theme="dark"] .table-of-contents,
[data-theme="dark"] .contact-section {
    background: var(--section-bg) !important;
    border-color: var(--glass-border) !important;
}
/* Mobile Responsiveness Fixes for iOS and Android */
@media (max-width: 767px) {
    /* Layout adjustments */
    .legal-wrapper {
        display: block;
        padding: 0 1rem;
    }
    
    /* Table of contents mobile optimization */
    .table-of-contents {
        position: relative;
        max-height: 250px;
        margin-bottom: 1.5rem;
        padding: 1rem;
        border-radius: 12px;
    }
    
    /* Improve scrolling on mobile */
    .table-of-contents::-webkit-scrollbar {
        width: 4px;
    }
    
    .table-of-contents::-webkit-scrollbar-thumb {
        background: var(--accent-secondary);
        border-radius: 2px;
    }
    
    /* Mobile-friendly link targets */
    .toc-list a {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
    }
    
    /* Main content adjustments */
    .legal-document {
        padding: 1.5rem 1rem;
        border-radius: 12px;
    }
    
    /* Typography adjustments for readability */
    .legal-document h1 {
        font-size: 1.75rem;
    }
    
    section h2 {
        font-size: 1.25rem;
    }
    
    /* Touch-friendly spacing */
    section p {
        margin-bottom: 1.25rem;
        font-size: 0.95rem;
        line-height: 1.7;
    }
    
    section {
        margin-bottom: 2rem;
    }
    
    /* Prevent x-overflow */
    body {
        overflow-x: hidden;
        width: 100%;
        position: relative;
    }
}

/* iPhone SE and other very small devices */
@media (max-width: 375px) {
    body {
        padding-top: 70px;
    }
    
    .legal-document {
        padding: 1rem 0.75rem;
    }
    
    .legal-document h1 {
        font-size: 1.5rem;
    }
    
    section h2 {
        font-size: 1.125rem;
    }
}

/* Fix for iOS Safari specific issues with sticky elements */
@supports (-webkit-touch-callout: none) {
    .table-of-contents {
        position: relative;
        top: 0;
    }
}

/* Fix for preventing content shifting on initial scroll */
html {
    scroll-padding-top: 120px;
    height: auto; /* Don't force 100% height */
}