/* ========================================
   LEGAL PAGES CSS - Modern & Professional
   Terms, Privacy, Cookie Policy Styles
   ======================================== */

/* Legal Page Container */
.legal-page {
    min-height: 100vh;
    padding-top: 9rem;
    background: var(--primary-bg);
}

.legal-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 2rem 3rem;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 3rem;
    position: relative;
}

/* ========================================
   TABLE OF CONTENTS SIDEBAR
   ======================================== */

.legal-toc {
    position: sticky;
    top: 8rem;
    height: fit-content;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.toc-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.toc-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    transition: all 0.3s ease;
}

.toc-toggle:hover {
    color: var(--accent-primary);
    transform: rotate(180deg);
}

.toc-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toc-nav li {
    transition: transform 0.3s ease;
}

.toc-nav li:hover {
    transform: translateX(5px);
}

.toc-nav a {
    display: block;
    padding: 0.6rem 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.toc-nav a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--accent-primary);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.toc-nav a:hover,
.toc-nav a.active {
    color: var(--accent-primary);
    background: rgba(0, 212, 255, 0.05);
}

.toc-nav a:hover::before,
.toc-nav a.active::before {
    transform: scaleY(1);
}

/* ========================================
   MAIN LEGAL CONTENT
   ======================================== */

.legal-content {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 3rem;
    position: relative;
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header Section */
.legal-header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.legal-title {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.2;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.legal-updated {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 6px;
    color: var(--accent-primary);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.legal-intro {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-secondary);
    max-width: 900px;
}

/* Content Sections */
.legal-section {
    margin-bottom: 3rem;
    scroll-margin-top: 10rem;
}

.legal-section:last-of-type {
    margin-bottom: 2rem;
}

.legal-section h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
    position: relative;
}

.legal-section h2::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
}

.legal-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.legal-section p {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
}

.legal-section ul,
.legal-section ol {
    margin: 1.25rem 0;
    padding-left: 2rem;
    color: var(--text-secondary);
}

.legal-section li {
    margin-bottom: 0.75rem;
    line-height: 1.7;
}

.legal-section li::marker {
    color: var(--accent-primary);
}

.legal-section a {
    color: var(--accent-primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
}

.legal-section a:hover {
    border-bottom-color: var(--accent-primary);
}

/* Highlight Boxes */
.highlight-box {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.05), rgba(0, 255, 136, 0.05));
    border-left: 4px solid var(--accent-primary);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
    transition: all 0.3s ease;
}

.highlight-box:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.08), rgba(0, 255, 136, 0.08));
    transform: translateX(5px);
}

.highlight-box.warning {
    background: linear-gradient(135deg, rgba(255, 165, 2, 0.05), rgba(255, 99, 71, 0.05));
    border-left-color: var(--warning);
}

.highlight-box p {
    margin: 0;
    color: var(--text-primary);
}

.highlight-box strong {
    color: var(--accent-primary);
}

.highlight-box.warning strong {
    color: var(--warning);
}

/* Contact Box */
.contact-box {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.contact-box p {
    margin-bottom: 0.75rem;
}

.contact-box p:last-child {
    margin-bottom: 0;
}

.contact-box strong {
    color: var(--text-primary);
}

.contact-box a {
    color: var(--accent-primary);
}

/* Cookie Type Cards */
.cookie-type-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    transition: all 0.3s ease;
}

.cookie-type-card:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 8px 25px rgba(0, 212, 255, 0.15);
    transform: translateY(-2px);
}

.cookie-type-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.cookie-type-header h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.cookie-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cookie-badge.essential {
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: white;
}

.cookie-badge.performance {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    color: white;
}

.cookie-badge.functional {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.cookie-badge.targeting {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
}

.cookie-type-card p {
    margin-bottom: 1rem;
}

.cookie-type-card ul {
    margin-top: 0.5rem;
}

/* Browser Links */
.browser-links {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    margin: 1.5rem 0;
}

.browser-links p {
    margin-bottom: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.browser-links ul {
    margin: 0;
}

.browser-links li {
    margin-bottom: 0.5rem;
}

/* Additional Info */
.additional-info {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-style: italic;
    color: var(--text-muted);
}

/* Legal Navigation */
.legal-nav {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 2rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

.legal-nav-link {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.25rem 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
    flex: 1 1 0;
    min-width: 0;
}

.legal-nav-link:hover {
    border-color: var(--accent-primary);
    background: rgba(0, 212, 255, 0.05);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 212, 255, 0.2);
}

.legal-nav-link .nav-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 500;
}

.legal-nav-link .nav-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.legal-nav-link:hover .nav-title {
    color: var(--accent-primary);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1200px) {
    .legal-container {
        grid-template-columns: 250px 1fr;
        gap: 2rem;
        padding: 2rem 1.5rem 3rem;
    }
    
    .legal-content {
        padding: 2.5rem;
    }
    
    .legal-title {
        font-size: 2.5rem;
    }
}

@media (max-width: 992px) {
    .legal-container {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 1.5rem 1.5rem 2rem;
    }
    
    .legal-toc {
        position: relative;
        top: 0;
        order: -1;
    }
    
    .toc-header {
        cursor: pointer;
        user-select: none;
    }
    
    .toc-toggle {
        display: block;
    }
    
    .toc-nav {
        max-height: 500px;
        overflow-y: auto;
        transition: max-height 0.3s ease;
    }
    
    .legal-toc.collapsed .toc-nav {
        max-height: 0;
        overflow: hidden;
    }
    
    .legal-toc.collapsed .toc-toggle {
        transform: rotate(-90deg);
    }
}

@media (max-width: 768px) {
    .legal-page {
        padding-top: 10rem;
    }
    
    .legal-container {
        padding: 1rem 1rem 2rem;
    }
    
    .legal-content {
        padding: 2rem 1.5rem;
    }
    
    .legal-title {
        font-size: 2rem;
    }
    
    .legal-section h2 {
        font-size: 1.5rem;
    }
    
    .legal-section h3 {
        font-size: 1.15rem;
    }
    
    .legal-intro {
        font-size: 1rem;
    }
    
    .legal-nav {
        flex-direction: column;
        gap: 1rem;
    }
    
    .legal-nav-link {
        width: 100%;
        min-width: auto;
    }
    
    .highlight-box,
    .contact-box,
    .cookie-type-card {
        padding: 1.25rem;
    }
}

@media (max-width: 480px) {
    .legal-page {
        padding-top: 12rem;
    }
    
    .legal-container {
        padding: 0.75rem 0.75rem 2rem;
    }
    
    .legal-content {
        padding: 1.5rem 1rem;
        border-radius: 12px;
    }
    
    .legal-header {
        margin-bottom: 2rem;
        padding-bottom: 1.5rem;
    }
    
    .legal-title {
        font-size: 1.75rem;
    }
    
    .legal-section {
        margin-bottom: 2rem;
    }
    
    .legal-section h2 {
        font-size: 1.35rem;
    }
    
    .legal-section h3 {
        font-size: 1.1rem;
        margin-top: 1.5rem;
    }
    
    .legal-section ul,
    .legal-section ol {
        padding-left: 1.5rem;
    }
    
    .toc-header h3 {
        font-size: 0.9rem;
    }
    
    .toc-nav a {
        font-size: 0.85rem;
        padding: 0.5rem 0.6rem;
    }
    
    .legal-nav-link {
        padding: 1rem 1.25rem;
    }
    
    .legal-nav-link .nav-title {
        font-size: 0.95rem;
    }
}

/* ========================================
   SMOOTH SCROLLING & ANIMATIONS
   ======================================== */

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
    
    .legal-section {
        transition: all 0.3s ease;
    }
    
    .legal-section:target {
        animation: highlight 2s ease;
    }
    
    @keyframes highlight {
        0% {
            background: rgba(0, 212, 255, 0.1);
        }
        100% {
            background: transparent;
        }
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Focus states */
.toc-nav a:focus-visible,
.legal-nav-link:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* High contrast support */
@media (prefers-contrast: high) {
    .legal-content {
        border-width: 2px;
    }
    
    .highlight-box {
        border-width: 3px;
    }
    
    .legal-section h2::after {
        height: 3px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   BACK TO TOP BUTTON
   ======================================== */

.legal-page .back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    border-radius: 50%;
    color: var(--primary-bg);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.9);
    z-index: 1000;
}

.legal-page .back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.legal-page .back-to-top:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.6);
    background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
}

.legal-page .back-to-top:active {
    transform: translateY(-2px) scale(1.02);
}

@media (max-width: 768px) {
    .legal-page .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .legal-page .back-to-top {
        bottom: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

/* Print styles */
@media print {
    .legal-toc,
    .legal-nav,
    .back-to-top {
        display: none !important;
    }
    
    .legal-container {
        grid-template-columns: 1fr;
        padding: 0;
    }
    
    .legal-content {
        border: none;
        padding: 0;
        box-shadow: none;
    }
    
    .legal-section {
        page-break-inside: avoid;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
}
