/* ==========================================
   LEGAL PAGES - PREMIUM STYLING
   ========================================== */

/* Legal Header */
.legal-header {
    background: transparent;
    color: var(--text-main);
    padding: var(--section-padding) var(--container-padding);
    margin-top: 80px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.legal-header::before {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 60%;
    height: 80%;
    background: radial-gradient(circle, rgba(15, 69, 240, 0.05) 0%, transparent 70%);
    z-index: 0;
}

.legal-header::after {
    content: '';
    position: absolute;
    bottom: -10%;
    left: -10%;
    width: 50%;
    height: 60%;
    background: radial-gradient(circle, rgba(73, 15, 240, 0.04) 0%, transparent 70%);
    z-index: 0;
}

.legal-header-content {
    max-width: 900px;
    /* Matching About/Profile width */
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.95rem;
    /* rem instead of px */
    margin-bottom: 24px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.back-link:hover {
    color: var(--accent);
    transform: translateX(-5px);
}

.legal-header h1 {
    font-size: var(--fs-h2);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 16px;
    letter-spacing: -0.04em;
    color: var(--text-main);
    font-family: var(--font-heading);
}

.header-subtitle {
    font-size: var(--fs-lead);
    line-height: 1.5;
    color: var(--text-dim);
    font-family: var(--font-body);
    margin-bottom: 40px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* Legal Navigation */
.legal-nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

.legal-nav-link {
    padding: 14px 28px;
    border-radius: 980px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition-mid);
    display: inline-block;
    background: var(--gradient-premium);
    background-size: 200% auto;
    color: white;
    border: none;
    box-shadow: 0 10px 30px rgba(15, 69, 240, 0.2);
}

.legal-nav-link:hover,
.legal-nav-link.active {
    background-position: right center;
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(15, 69, 240, 0.35);
}

/* Legal Content Container */
.legal-content {
    padding: 60px 20px;
    background: var(--bg-soft);
}

.legal-container {
    max-width: 1000px;
    margin: 0 auto;
    background: var(--bg-white);
    border-radius: 32px;
    box-shadow: var(--shadow-premium);
    padding: 60px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Section Styling */
.legal-section {
    margin-bottom: 50px;
}

.legal-section:last-child {
    margin-bottom: 0;
}

.legal-section h2 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 24px;
    font-family: var(--font-heading);
    letter-spacing: -0.02em;
}

.legal-section h3 {
    font-size: 1.3rem;
    color: #222;
    margin-top: 25px;
    margin-bottom: 15px;
}

.legal-section p {
    line-height: 1.6;
    color: var(--text-dim);
    margin-bottom: 20px;
    font-family: var(--font-body);
    font-size: 1.05rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.legal-section ul,
.legal-section ol {
    margin-left: 20px;
    font-family: var(--font-body);
    font-size: 1.05rem;
    color: var(--text-dim);
    line-height: 1.6;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.legal-section li {
    margin-bottom: 12px;
}

/* Main Title */
.main-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 24px;
    line-height: 1.2;
    font-family: var(--font-heading);
    letter-spacing: -0.03em;
}

/* Meta Information */
.meta-info {
    background: var(--bg-soft);
    border-left: 4px solid var(--accent);
    padding: 24px;
    margin: 30px 0;
    border-radius: 16px;
}

.meta-info p {
    margin-bottom: 8px;
    color: var(--text-main);
}

.meta-info p:last-child {
    margin-bottom: 0;
}

/* POPIA Statement */
.popia-statement {
    background: var(--gradient-premium);
    color: white;
    padding: 32px;
    border-radius: 24px;
    margin: 40px 0;
    box-shadow: 0 10px 30px rgba(15, 69, 240, 0.15);
}

.popia-statement h3 {
    color: white;
    margin-top: 0;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.popia-statement p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0;
    font-size: 1.05rem;
}

/* Table of Contents */
.toc-section {
    background: var(--bg-soft);
    padding: 32px;
    border-radius: 24px;
    border: none;
}

.toc-list {
    list-style: none;
    counter-reset: toc-counter;
    margin-left: 0;
}

.toc-list li {
    counter-increment: toc-counter;
    margin-bottom: 12px;
}

.toc-list li::before {
    content: counter(toc-counter) ". ";
    color: var(--accent);
    font-weight: 700;
    margin-right: 8px;
}

.toc-list a {
    color: var(--text-main);
    text-decoration: none;
    transition: var(--transition-mid);
    font-weight: 500;
}

.toc-list a:hover {
    color: var(--accent);
    padding-left: 5px;
}

/* Info Cards */
.info-card {
    background: var(--bg-white);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.02);
}

.info-card h3 {
    color: var(--text-main);
    font-weight: 700;
    margin-top: 0;
    font-size: 1.25rem;
    margin-bottom: 16px;
}

.info-list {
    list-style: none;
    margin-left: 0;
}

.info-list li {
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    color: var(--text-dim);
}

.info-list li strong {
    color: var(--text-main);
    font-weight: 600;
}

.info-list li:last-child {
    border-bottom: none;
}

/* Legal Basis Grid */
.legal-basis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-top: 30px;
}

.basis-card {
    background: var(--bg-white);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    transition: var(--transition-mid);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.basis-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent);
}

.basis-card i {
    font-size: 2.5rem;
    color: var(--accent);
    margin-bottom: 15px;
}

.basis-card h3 {
    color: var(--text-main);
    margin: 16px 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.basis-card p {
    color: var(--text-dim);
    margin: 0;
    font-size: 0.95rem;
}

/* Data Category */
.data-category {
    background: var(--bg-soft);
    border-left: 4px solid var(--accent);
    padding: 30px;
    margin-bottom: 30px;
    border-radius: 16px;
    box-shadow: none;
}

.data-category h3 {
    color: var(--text-main);
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 1.25rem;
    font-weight: 700;
}

.data-category ul {
    margin-left: 0;
    list-style: none;
}

.data-category li {
    padding: 8px 0;
}

/* Note Box */
.note-box {
    background: #fff9e6;
    border: 2px solid #ffd700;
    border-radius: 8px;
    padding: 20px;
    margin-top: 15px;
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.note-box i {
    color: #ffa500;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.note-box p {
    margin: 0;
    color: #666;
}

/* Usage Grid */
.usage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 30px;
}

.usage-card {
    background: var(--bg-white);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    padding: 30px;
    transition: var(--transition-mid);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.02);
}

.usage-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent);
}

.usage-card i {
    font-size: 2rem;
    color: var(--accent);
    margin-bottom: 16px;
}

.usage-card h3 {
    color: var(--text-main);
    margin: 16px 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.usage-card p {
    color: var(--text-dim);
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Sharing List */
.sharing-list {
    margin-top: 30px;
}

.sharing-item {
    background: var(--bg-soft);
    border-left: 4px solid var(--accent);
    padding: 24px;
    margin-bottom: 20px;
    border-radius: 16px;
}

.sharing-item h3 {
    color: var(--text-main);
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
}

.sharing-item h3 i {
    color: var(--accent);
    font-size: 1.4rem;
}

.sharing-item p {
    margin: 0;
    color: var(--text-dim);
    line-height: 1.6;
}

/* Rights Section */
.highlight-section {
    background: var(--bg-soft);
    border-radius: 24px;
    padding: 40px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* Removed heavy border */
}

.rights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 30px;
}

.right-card {
    background: var(--bg-white);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    padding: 30px;
    transition: var(--transition-mid);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.02);
}

.right-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent);
}

.right-card i {
    font-size: 2.5rem;
    color: var(--accent);
    margin-bottom: 20px;
}

.right-card h3 {
    color: var(--text-main);
    margin: 16px 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.right-card p {
    color: var(--text-dim);
    margin: 0 0 16px 0;
    font-size: 0.95rem;
    line-height: 1.6;
}

.response-time {
    display: block;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 700;
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.exercise-rights {
    background: var(--bg-white);
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* Standardized */
    border-radius: 20px;
    padding: 30px;
    margin-top: 30px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.exercise-rights h3 {
    color: var(--text-main);
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 12px;
}

.exercise-rights a {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
}

/* Security Section */
.security-section {
    margin-top: 30px;
}

.security-list li {
    background: var(--bg-soft);
    border-left: 4px solid var(--accent);
    padding: 16px 24px;
    margin-bottom: 16px;
    border-radius: 12px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    color: var(--text-dim);
}

/* Retention Table */
.retention-table {
    margin-top: 30px;
    overflow-x: auto;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.retention-table table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
    background: var(--bg-white);
}

.retention-table th,
.retention-table td {
    padding: 20px;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    color: var(--text-dim);
}

.retention-table th {
    background: var(--bg-soft);
    color: var(--text-main);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

.retention-table tr:hover {
    background: var(--bg-soft);
}

/* Cookie Types */
.cookie-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-top: 30px;
}

.cookie-type {
    background: var(--bg-white);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.02);
}

.cookie-type h3 {
    color: var(--text-main);
    font-weight: 700;
    margin-top: 20px;
}

.cookie-type p {
    color: var(--text-dim);
}

/* Contact Section */
.contact-section {
    background: var(--bg-soft);
    border-radius: 24px;
    padding: 40px;
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.contact-card {
    background: var(--bg-white);
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* Removed heavy border */
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
}

.contact-card h3 {
    color: var(--text-main);
    margin-top: 0;
    margin-bottom: 20px;
    font-weight: 700;
}

.contact-card p {
    color: var(--text-dim);
    margin-bottom: 12px;
}

/* Document Control */
.document-control {
    background: var(--bg-soft);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    margin-top: 60px;
}

.control-info p {
    color: var(--text-dim);
}

.disclaimer {
    font-style: italic;
    color: var(--text-dim);
    margin-top: 20px;
    font-size: 0.95rem;
    opacity: 0.8;
}


/* Mobile Responsive */
@media (max-width: 768px) {
    .legal-header {
        padding: 100px 20px 40px;
    }

    .legal-header h1 {
        font-size: 1.8rem;
    }

    .header-subtitle {
        font-size: 1rem;
    }

    .legal-nav {
        flex-direction: column;
        gap: 10px;
    }

    .legal-nav-link {
        width: 100%;
        text-align: center;
    }

    .legal-container {
        padding: 30px 15px;
        /* Reduced side padding slightly to give more room */
    }

    .main-title {
        font-size: 1.6rem;
        word-break: break-word;
        /* Ensure titles don't overflow */
    }

    .legal-section h2 {
        font-size: 1.5rem;
        word-break: break-word;
    }

    .legal-basis-grid,
    .usage-grid,
    .rights-grid,
    .cookie-types,
    .contact-grid {
        grid-template-columns: 1fr;
    }

    .retention-table {
        font-size: 0.85rem;
        /* Slightly smaller for table room */
    }

    .retention-table th,
    .retention-table td {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .legal-header {
        padding: 80px 15px 30px;
    }

    .legal-container {
        padding: 20px 15px;
    }

    .basis-card,
    .usage-card,
    .right-card {
        padding: 20px;
    }
}