:root {
    --bg-dark: #090d16;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent-blue: #346bb2;
    --accent-light: #4a7bc8;
    --accent-gradient: linear-gradient(135deg, #346bb2 0%, #4a7bc8 50%, #6fa0e6 100%);
    --card-bg: rgba(15, 23, 42, 0.65);
    --border-glass: rgba(255, 255, 255, 0.08);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Cairo', 'Tajawal', 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
    line-height: 1.7;
}

/* Background Grid & Glow */
.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: 0;
    pointer-events: none;
}

.bg-glow {
    position: fixed;
    top: -150px;
    left: 50%;
    transform: translateX(-50%);
    width: 750px;
    height: 450px;
    background: radial-gradient(circle, rgba(52, 107, 178, 0.18) 0%, rgba(74, 123, 200, 0.05) 50%, transparent 70%);
    filter: blur(60px);
    z-index: 0;
    pointer-events: none;
}

/* Header */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 5%;
    background: rgba(9, 13, 22, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-glass);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--text-main);
    text-decoration: none;
    letter-spacing: 0.5px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.2rem;
    color: #fff;
    box-shadow: 0 0 20px rgba(52, 107, 178, 0.4);
}

nav {
    display: flex;
    align-items: center;
    gap: 1.75rem;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: var(--text-main);
}

.nav-link.active {
    color: #6fa0e6;
}

.btn-portal {
    background: var(--accent-gradient);
    color: #fff;
    padding: 0.6rem 1.4rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(52, 107, 178, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-portal:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 107, 178, 0.5);
}

/* Main Content Container */
.legal-container {
    position: relative;
    z-index: 10;
    max-width: 1080px;
    margin: 3.5rem auto 5rem;
    padding: 0 5%;
}

.legal-header {
    text-align: center;
    margin-bottom: 3.5rem;
}

.legal-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1.1rem;
    border-radius: 999px;
    background: rgba(52, 107, 178, 0.15);
    border: 1px solid rgba(74, 123, 200, 0.35);
    color: #6fa0e6;
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
}

.legal-title {
    font-size: clamp(2.2rem, 5vw, 3.2rem);
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 1rem;
    line-height: 1.25;
}

[dir="rtl"] .legal-title {
    line-height: 1.45;
}

.legal-subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.7;
}

/* Table of Contents Navigation Bar */
.toc-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 3.5rem;
    padding: 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    backdrop-filter: blur(12px);
}

.toc-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.toc-link:hover {
    color: var(--text-main);
    background: rgba(52, 107, 178, 0.18);
    border-color: rgba(74, 123, 200, 0.4);
}

/* Legal Document Box */
.legal-content-card {
    background: var(--card-bg);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(16px);
}

@media (max-width: 768px) {
    .legal-content-card {
        padding: 1.75rem 1.25rem;
    }
}

.legal-section {
    margin-bottom: 3rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.legal-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.legal-section-title {
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(52, 107, 178, 0.2);
    color: #6fa0e6;
    font-size: 0.95rem;
    font-weight: 800;
    flex-shrink: 0;
}

.legal-paragraph {
    color: var(--text-muted);
    font-size: 1.02rem;
    line-height: 1.8;
    margin-bottom: 1.25rem;
}

.legal-paragraph:last-child {
    margin-bottom: 0;
}

/* Callout Box for highlights */
.legal-callout {
    background: rgba(52, 107, 178, 0.12);
    border: 1px solid rgba(74, 123, 200, 0.35);
    border-radius: 16px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.legal-callout-title {
    color: #6fa0e6;
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legal-callout p {
    color: var(--text-main);
    font-size: 0.98rem;
    line-height: 1.75;
    margin: 0;
}

.legal-list {
    margin: 1rem 0 1.25rem;
    padding-inline-start: 1.5rem;
    color: var(--text-muted);
}

.legal-list li {
    margin-bottom: 0.75rem;
    line-height: 1.75;
}

.legal-list li strong {
    color: var(--text-main);
}

/* RTL Specific Rules */
[dir="rtl"] .legal-section-title {
    line-height: 1.5;
}

[dir="rtl"] .legal-paragraph,
[dir="rtl"] .legal-list li,
[dir="rtl"] .legal-callout p {
    line-height: 1.85;
}

/* Footer */
footer {
    margin-top: auto;
    position: relative;
    z-index: 10;
    background: rgba(9, 13, 22, 0.95);
    border-top: 1px solid var(--border-glass);
    padding: 2.5rem 5%;
    text-align: center;
}

.footer-nav {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.footer-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: #6fa0e6;
}

.footer-copy {
    color: rgba(148, 163, 184, 0.7);
    font-size: 0.88rem;
}
