/* Legal Pages Styling */

/* CRITICAL FIXES FOR STICKY POSITIONING */
html,
body {
    overflow-x: hidden;
    /* Maintain explicit hidden X-overflow from style.css */
    overflow-y: visible !important;
    /* Ensure vertical overflow is visible */
    height: auto !important;
    /* Prevent height constraints */
}

.legal-page {
    padding-top: 150px;
    padding-bottom: 80px;
    background-color: var(--background-color);
    overflow: visible !important;
    height: auto !important;
}

.legal-page .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5%;
    /* Switch to Flexbox for more reliable sticky behavior */
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    /* Crucial: Do not stretch, allow sticky to move */
    gap: 60px;
    overflow: visible !important;
    position: relative;
    height: auto !important;
}

.legal-sidebar {
    width: 250px;
    /* Fixed width */
    flex-shrink: 0;
    /* Prevent shrinking */
    align-self: flex-start;
    /* Ensure it doesn't stretch and allows sticking */
    position: -webkit-sticky;
    /* Safari prefix */
    position: sticky;
    top: 120px;
    /* Stick 120px from top (Head is 100px + 20px gap) */
    padding: 20px 0;
    background-color: transparent;
    border-right: 1px solid rgba(160, 82, 45, 0.2);
    height: fit-content;
    max-height: calc(100vh - 140px);
    /* Ensure it fits in viewport */
    overflow-y: auto;
    /* Scroll internal sidebar if too tall */
    z-index: 900;
    /* Below header (1000) but above content */
    transition: top 0.3s ease;
}

.legal-sidebar h3 {
    font-family: var(--font-primary);
    font-size: 22px;
    margin-bottom: 25px;
    color: var(--primary-color);
    padding-left: 10px;
}

.legal-sidebar ul {
    list-style: none !important;
    margin: 0;
    padding: 0;
}

.legal-sidebar li {
    margin-bottom: 10px;
}

.legal-sidebar a {
    font-family: var(--font-secondary);
    font-size: 16px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.3s ease;
    display: block;
    padding: 10px 15px;
    border-left: 3px solid transparent;
    opacity: 0.7;
}

.legal-sidebar a:hover,
.legal-sidebar a.active {
    color: var(--primary-color);
    font-weight: 600;
    border-left: 3px solid var(--primary-color);
    background: linear-gradient(90deg, rgba(160, 82, 45, 0.05) 0%, transparent 100%);
    opacity: 1;
}

.legal-content h1 {
    font-family: var(--font-primary);
    font-size: clamp(32px, 5vw, 48px);
    color: var(--primary-color);
    text-align: left;
    margin-bottom: 40px;
    position: relative;
    padding-bottom: 20px;
}

.legal-content h1::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background-color: var(--primary-color);
    transform: none;
}

.legal-content {
    flex-grow: 1;
    /* Take remaining space */
    max-width: calc(100% - 310px);
    /* Total width minus sidebar (250) and gap (60) */
}

/* Response for smaller screens */
@media (max-width: 900px) {
    .legal-page .container {
        flex-direction: column;
        /* Stack vertically on mobile */
        gap: 40px;
    }

    .legal-sidebar {
        position: static;
        width: 100%;
        margin-bottom: 30px;
        border-right: none;
        border-bottom: 1px solid rgba(160, 82, 45, 0.2);
        max-height: none;
        overflow: visible;
    }

    .legal-content {
        max-width: 100%;
    }
}

.legal-page section {
    margin-bottom: 40px;
}

.legal-page h3 {
    font-family: var(--font-primary);
    font-size: 24px;
    color: var(--text-color);
    margin-bottom: 15px;
    border-left: 3px solid var(--primary-color);
    padding-left: 15px;
}

.legal-page p {
    font-family: var(--font-secondary);
    font-size: 16px;
    line-height: 1.8;
    color: #333;
    margin-bottom: 15px;
    text-align: justify;
}

.legal-content ul {
    list-style: disc;
    margin-left: 20px;
    margin-bottom: 20px;
}

.legal-page li {
    font-family: var(--font-secondary);
    font-size: 16px;
    line-height: 1.8;
    color: #333;
    margin-bottom: 10px;
}

.legal-page strong {
    font-weight: 700;
    color: var(--text-color);
}

@media (max-width: 768px) {
    .legal-page {
        padding-top: 120px;
    }

    .legal-page h1 {
        margin-bottom: 40px;
    }

    .legal-page p {
        text-align: left;
    }
}