/* Legal pages (hub, privacy-policy, terms-conditions) */

.legal-page {
    background: var(--bg-light, #f1f4f8);
    min-height: 100vh;
}

.legal-main {
    min-height: calc(100vh - 200px);
}

.legal-hero {
    background: linear-gradient(135deg, #296ff9 0%, #662acc 100%);
    color: #fff;
    padding: calc(2.5rem + var(--navbar-clearance, 56px) + var(--smart-app-banner-height, 0px)) 0 6.5rem;
    text-align: center;
}

.legal-hero-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.legal-hero h1,
.legal-hero .hero-title {
    margin: 0 0 0.5rem;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    line-height: 1.2;
    color: #fff;
}

.legal-hero .hero-subtitle,
.legal-hero p {
    margin: 0 auto;
    max-width: 600px;
    font-size: 1.05rem;
    line-height: 1.45;
    opacity: 0.95;
    color: #fff;
    text-align: center !important;
}

.legal-content {
    padding: 0 0 4rem;
}

/* Hub cards */
.legal-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    max-width: 1000px;
    margin: -3.5rem auto 0;
    position: relative;
    z-index: 2;
}

.legal-card {
    background: #fff;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    color: inherit;
    text-decoration: none;
    display: block;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

a.legal-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.legal-card__icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.legal-card__icon--terms {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color, #4361ee);
}

.legal-card__icon--privacy {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.legal-card__icon--company {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.legal-card__title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    color: var(--text-dark, #111827);
}

.legal-card__desc {
    color: var(--text-light, #757575);
    line-height: 1.6;
    margin: 0 0 1.5rem;
    font-size: 0.95rem;
}

.legal-card__cta {
    color: var(--primary-color, #4361ee);
    font-weight: 500;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.legal-card__list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
    color: var(--text-light, #757575);
}

.legal-card__list li {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.legal-card__list i {
    color: var(--primary-color, #4361ee);
    margin-top: 0.25rem;
    flex-shrink: 0;
}

.legal-card__list a {
    color: inherit;
    text-decoration: none;
}

.legal-card__list a:hover {
    color: var(--primary-color, #4361ee);
}

/* Privacy / Terms article */
.legal-article {
    background: #fff;
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    max-width: 900px;
    margin: -3.5rem auto 0;
    position: relative;
    z-index: 2;
}

/* English legal copy stays LTR even when the site UI is Arabic RTL */
html[dir="rtl"] .legal-hero-content[dir="ltr"],
html[dir="rtl"] .legal-hero-content[dir="ltr"] h1,
html[dir="rtl"] .legal-hero-content[dir="ltr"] p,
html[dir="rtl"] .legal-article[dir="ltr"],
html[dir="rtl"] .legal-article[dir="ltr"] p,
html[dir="rtl"] .legal-article[dir="ltr"] span:not(.fas):not(.far):not(.fab):not([class*="fa-"]),
html[dir="rtl"] .legal-article[dir="ltr"] div:not([class*="icon"]):not([class*="fa-"]),
html[dir="rtl"] .legal-article[dir="ltr"] h1,
html[dir="rtl"] .legal-article[dir="ltr"] h2,
html[dir="rtl"] .legal-article[dir="ltr"] h3,
html[dir="rtl"] .legal-article[dir="ltr"] h4,
html[dir="rtl"] .legal-article[dir="ltr"] a:not([class*="fa-"]),
html[dir="rtl"] .legal-article[dir="ltr"] li:not([class*="fa-"]),
html[dir="rtl"] .legal-article[dir="ltr"] ul {
    direction: ltr;
    text-align: left;
}

html[dir="rtl"] .legal-hero-content[dir="ltr"],
html[dir="rtl"] .legal-hero-content[dir="ltr"] h1,
html[dir="rtl"] .legal-hero-content[dir="ltr"] p {
    text-align: center;
}

html[dir="rtl"] .legal-article[dir="ltr"] ul {
    margin-left: 1.5rem;
    margin-right: 0;
}

.legal-article[dir="rtl"],
.legal-hero-content[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

.legal-hero-content[dir="rtl"],
.legal-hero-content[dir="rtl"] h1,
.legal-hero-content[dir="rtl"] p {
    text-align: center;
}

.legal-article[dir="rtl"] ul {
    margin-right: 1.5rem;
    margin-left: 0;
}

.legal-text-content,
.legal-full-content {
    color: var(--text-light, #757575);
}

.legal-text-content > div,
.legal-full-content > div {
    margin-bottom: 2.5rem;
}

.legal-text-content > div:last-child,
.legal-full-content > div:last-child {
    margin-bottom: 0;
}

.legal-text-content h2,
.legal-full-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 1rem;
    color: var(--text-dark, #111827);
    line-height: 1.3;
}

.legal-text-content h3,
.legal-full-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.5rem 0 0.5rem;
    color: var(--text-dark, #111827);
}

.legal-text-content h2 + h3,
.legal-full-content h2 + h3 {
    margin-top: 1rem;
}

.legal-text-content p,
.legal-full-content p {
    font-size: 0.975rem;
    line-height: 1.7;
    color: var(--text-light, #757575);
    margin: 0 0 1rem;
}

.legal-text-content p:last-child,
.legal-full-content p:last-child {
    margin-bottom: 0;
}

.legal-text-content ul,
.legal-full-content ul {
    margin: 0.5rem 0 1rem 1.5rem;
    padding: 0;
    color: var(--text-light, #757575);
    line-height: 1.6;
}

.legal-text-content li,
.legal-full-content li {
    margin-bottom: 0.35rem;
    font-size: 0.975rem;
}

.legal-text-content a,
.legal-full-content a {
    color: var(--primary-color, #4361ee);
    text-decoration: none;
    font-weight: 500;
}

.legal-text-content a:hover,
.legal-full-content a:hover {
    text-decoration: underline;
}

.legal-text-content strong,
.legal-full-content strong {
    font-weight: 600;
    color: var(--text-dark, #111827);
}

/* RTL */
html[dir="rtl"] .legal-hero h1,
html[dir="rtl"] .legal-hero .hero-title,
html[dir="rtl"] .legal-hero .hero-subtitle,
html[dir="rtl"] .legal-card__title,
html[dir="rtl"] .legal-card__desc,
html[dir="rtl"] .legal-card__cta,
html[dir="rtl"] .legal-text-content,
html[dir="rtl"] .legal-text-content h2,
html[dir="rtl"] .legal-text-content h3,
html[dir="rtl"] .legal-text-content p,
html[dir="rtl"] .legal-text-content li,
html[dir="rtl"] .legal-full-content,
html[dir="rtl"] .legal-full-content h2,
html[dir="rtl"] .legal-full-content p,
html[dir="rtl"] .legal-full-content li {
    font-family: 'GM', 'Segoe UI', Tahoma, sans-serif;
}

html[dir="rtl"] .legal-text-content ul,
html[dir="rtl"] .legal-full-content ul {
    margin-left: 0;
    margin-right: 1.5rem;
    padding-right: 0;
    padding-left: 0;
}

html[dir="rtl"] .legal-card__cta .fa-arrow-right {
    transform: scaleX(-1);
}

html[dir="rtl"] .legal-hero .hero-subtitle,
html[dir="rtl"] .legal-hero p {
    text-align: center !important;
}

@media (max-width: 640px) {
    .legal-hero {
        padding: calc(2.5rem + var(--navbar-clearance, 56px) + var(--smart-app-banner-height, 0px)) 0 4.5rem;
    }

    .legal-hero h1,
    .legal-hero .hero-title {
        font-size: 1.75rem;
    }

    .legal-content {
        padding-bottom: 3rem;
    }

    .legal-cards-grid,
    .legal-article {
        margin-top: -2.5rem;
    }

    .legal-card {
        padding: 1.5rem;
    }

    .legal-article {
        padding: 1.5rem;
        border-radius: 16px;
    }

    .legal-text-content h2,
    .legal-full-content h2 {
        font-size: 1.25rem;
    }
}
