/* =====================================================================
   Legal pages (privacy-policy.php, terms.php) — shared styling.
   Built on the site's own CSS variables (style.css) so it always matches
   the rest of Vivahkalp, in the user panel and as a standalone page.
   ===================================================================== */

html:has(.legal) { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html:has(.legal) { scroll-behavior: auto; } }

.legal-page-body { margin: 0; background: var(--bg, #fff5f7); color: var(--text, #2b2b2b); }

.legal {
    --lg-maroon: #7a1f3d;
    --lg-body: #4a4a4a;
    font-family: 'Poppins', 'Segoe UI', Arial, sans-serif;
    color: var(--text, #2b2b2b);
    box-sizing: border-box;
}
.legal *, .legal *::before, .legal *::after { box-sizing: border-box; }
.legal--standalone { max-width: 1120px; margin: 0 auto; padding: 20px 20px 80px; }
.legal--shell { max-width: 1100px; margin: 0 auto; }

/* ---------- Standalone top bar ---------- */
.legal-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.legal-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--lg-maroon); font-weight: 700; font-size: 1.1rem; }
.legal-brand img { width: 44px; height: 38px; object-fit: contain; }
.legal-back {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 999px; background: #fff; border: 1px solid var(--border, #f0d9df);
    color: var(--text, #2b2b2b); text-decoration: none; font-weight: 600; font-size: 0.88rem;
}
.legal-back:hover { border-color: var(--pink, #e91e63); color: var(--pink-dark, #c2185b); }

/* ---------- Hero ---------- */
.legal-hero {
    display: flex; align-items: center; gap: 22px;
    padding: 30px 32px; border-radius: 20px; color: #fff;
    background: linear-gradient(120deg, #c2185b 0%, #8e24aa 55%, #5e35b1 100%);
    box-shadow: 0 10px 30px rgba(142, 36, 170, 0.22);
}
.legal-hero-ic {
    flex: 0 0 64px; width: 64px; height: 64px; border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, 0.18); border: 1px solid rgba(255, 255, 255, 0.3);
}
.legal-hero-text { min-width: 0; }
.legal-kicker { margin: 0 0 4px; font-size: 0.74rem; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600; opacity: 0.85; }
.legal-hero h1 { margin: 0 0 12px; font-family: 'Playfair Display', Georgia, serif; font-size: 2.2rem; line-height: 1.15; font-weight: 700; color: #fff; }
.legal-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.legal-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px; border-radius: 999px; font-size: 0.78rem; font-weight: 500;
    background: rgba(255, 255, 255, 0.16); border: 1px solid rgba(255, 255, 255, 0.28);
}
.legal-chip .icon { flex-shrink: 0; }

/* ---------- Privacy / Terms switcher ---------- */
.legal-tabs {
    display: inline-flex; gap: 4px; margin: 20px 0 0; padding: 4px;
    background: #fff; border: 1px solid var(--border, #f0d9df); border-radius: 999px;
}
.legal-tabs a {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 18px; border-radius: 999px; text-decoration: none;
    color: var(--muted, #777); font-weight: 600; font-size: 0.88rem;
}
.legal-tabs a:hover { color: var(--pink-dark, #c2185b); }
.legal-tabs a.is-active { background: linear-gradient(135deg, var(--pink, #e91e63), #8e24aa); color: #fff; }

/* ---------- Layout ---------- */
.legal-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; margin-top: 22px; align-items: start; }
.legal-content { min-width: 0; }

/* ---------- Table of contents ---------- */
.legal-toc {
    background: #fff; border: 1px solid var(--border, #f0d9df); border-radius: 16px; padding: 8px 10px;
}
.legal-toc-label { display: none; margin: 8px 10px 6px; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 700; color: var(--muted, #777); }
.legal-toc-toggle {
    width: 100%; display: flex; align-items: center; justify-content: space-between;
    padding: 10px; background: none; border: 0; cursor: pointer; font: inherit; font-weight: 600; font-size: 0.92rem; color: var(--text, #2b2b2b);
}
.legal-toc-toggle .icon { transition: transform 0.2s ease; }
.legal-toc.is-open .legal-toc-toggle .icon { transform: rotate(180deg); }
.legal-toc-list { display: none; list-style: none; margin: 0; padding: 4px 0 6px; }
.legal-toc.is-open .legal-toc-list { display: block; }
.legal-toc-list a {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 8px 10px; border-radius: 10px; text-decoration: none;
    font-size: 0.84rem; line-height: 1.4; color: var(--muted, #777);
}
.legal-toc-list a:hover { background: #fdf3f6; color: var(--text, #2b2b2b); }
.legal-toc-list a.is-active { background: #fdf3f6; color: var(--pink-dark, #c2185b); font-weight: 600; }
.legal-toc-num {
    flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 700; background: #f4f0f2; color: var(--muted, #777);
}
.legal-toc-list a.is-active .legal-toc-num { background: var(--pink, #e91e63); color: #fff; }

/* Desktop: TOC becomes a sticky side column. Standalone has the full
   viewport; inside the user panel the sidebar takes ~260px, so the
   two-column layout starts later there. */
@media (min-width: 960px) {
    .legal--standalone .legal-layout { grid-template-columns: 252px minmax(0, 1fr); gap: 26px; }
    .legal--standalone .legal-toc { position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow-y: auto; }
    .legal--standalone .legal-toc-toggle { display: none; }
    .legal--standalone .legal-toc-label { display: block; }
    .legal--standalone .legal-toc-list { display: block; }
}
@media (min-width: 1200px) {
    .legal--shell .legal-layout { grid-template-columns: 240px minmax(0, 1fr); gap: 24px; }
    .legal--shell .legal-toc { position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow-y: auto; }
    .legal--shell .legal-toc-toggle { display: none; }
    .legal--shell .legal-toc-label { display: block; }
    .legal--shell .legal-toc-list { display: block; }
}

/* ---------- Intro + at-a-glance ---------- */
.legal-intro {
    background: #fff; border: 1px solid var(--border, #f0d9df); border-left: 4px solid var(--pink, #e91e63);
    border-radius: 16px; padding: 20px 24px;
}
.legal-intro p { margin: 0; font-size: 0.96rem; line-height: 1.8; color: var(--lg-body); }

.legal-glance { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 16px 0 22px; }
@media (max-width: 560px) { .legal-glance { grid-template-columns: minmax(0, 1fr); } }
.legal-glance-card {
    display: flex; gap: 12px; align-items: flex-start;
    background: #fff; border: 1px solid var(--border, #f0d9df); border-radius: 14px; padding: 16px;
}
.legal-glance-ic {
    flex: 0 0 38px; width: 38px; height: 38px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: #fdf3f6; color: var(--pink-dark, #c2185b);
}
.legal-glance-card strong { display: block; font-size: 0.9rem; line-height: 1.3; margin-bottom: 4px; }
.legal-glance-card p { margin: 0; font-size: 0.8rem; line-height: 1.55; color: var(--muted, #777); }

/* ---------- Sections ---------- */
.legal-sec {
    background: #fff; border: 1px solid var(--border, #f0d9df); border-radius: 16px;
    padding: 24px 26px 14px; margin-bottom: 16px; scroll-margin-top: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}
.legal-sec-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.legal-num {
    flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.88rem; color: #fff;
    background: linear-gradient(135deg, var(--pink, #e91e63), #8e24aa);
}
.legal-sec-head h2 { margin: 0; font-size: 1.12rem; line-height: 1.3; font-weight: 600; color: var(--lg-maroon); }

.legal-body p { margin: 0 0 14px; font-size: 0.94rem; line-height: 1.8; color: var(--lg-body); }
.legal-body ul { list-style: none; margin: 0 0 14px; padding: 0; }
.legal-body li { position: relative; padding-left: 22px; margin-bottom: 8px; font-size: 0.94rem; line-height: 1.7; color: var(--lg-body); }
.legal-body li::before {
    content: ''; position: absolute; left: 4px; top: 0.72em;
    width: 7px; height: 7px; border-radius: 50%;
    background: linear-gradient(135deg, var(--pink, #e91e63), #8e24aa);
}
.legal-body a, .legal-intro a { color: var(--pink-dark, #c2185b); font-weight: 600; text-decoration: none; border-bottom: 1px solid rgba(194, 24, 91, 0.3); }
.legal-body a:hover, .legal-intro a:hover { border-bottom-color: var(--pink-dark, #c2185b); }
.legal-body strong { color: var(--text, #2b2b2b); font-weight: 600; }
.legal-sub { margin: 20px 0 4px; font-size: 0.9rem; font-weight: 600; color: var(--text, #2b2b2b); }
.legal-sub:first-child { margin-top: 0; }

/* Callouts: key promises (green), notes (blue), warnings (amber) */
.legal-callout {
    display: flex; gap: 12px; align-items: flex-start;
    margin: 6px 0 16px; padding: 14px 16px; border-radius: 12px; border-left: 4px solid;
}
.legal-callout p { margin: 0; font-size: 0.9rem; line-height: 1.7; }
.legal-callout-ic { flex: 0 0 20px; margin-top: 2px; display: inline-flex; }
.legal-callout--success { background: #eefaf2; border-color: #2e9e5b; }
.legal-callout--success p, .legal-callout--success .legal-callout-ic { color: #1b5a36; }
.legal-callout--info { background: #eef5ff; border-color: #3b82f6; }
.legal-callout--info p, .legal-callout--info .legal-callout-ic { color: #1e4a96; }
.legal-callout--warning { background: #fff6e5; border-color: #f59e0b; }
.legal-callout--warning p, .legal-callout--warning .legal-callout-ic { color: #7a4700; }

/* ---------- Help card + footer ---------- */
.legal-help {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
    margin-top: 22px; padding: 22px 24px; border-radius: 16px;
    background: #fdf3f6; border: 1px solid var(--border, #f0d9df);
}
.legal-help h3 { margin: 0 0 4px; font-size: 1.02rem; color: var(--lg-maroon); }
.legal-help p { margin: 0; font-size: 0.86rem; color: var(--muted, #777); }
.legal-help-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.legal-btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px;
    text-decoration: none; font-weight: 600; font-size: 0.86rem;
}
.legal-btn--primary { background: var(--pink, #e91e63); color: #fff; }
.legal-btn--primary:hover { background: var(--pink-dark, #c2185b); }
.legal-btn--ghost { background: #fff; border: 1px solid var(--border, #f0d9df); color: var(--text, #2b2b2b); }
.legal-btn--ghost:hover { border-color: var(--pink, #e91e63); color: var(--pink-dark, #c2185b); }
.legal-copy { text-align: center; margin: 24px 0 0; font-size: 0.78rem; color: var(--muted, #777); }

/* Back-to-top button (sits just left of the floating support button) */
.legal-top-btn {
    position: fixed; right: 92px; bottom: 26px; z-index: 9000;
    width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border, #f0d9df);
    display: flex; align-items: center; justify-content: center;
    background: #fff; color: var(--pink-dark, #c2185b); cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    opacity: 0; visibility: hidden; transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}
.legal-top-btn.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.legal-top-btn:hover { background: #fdf3f6; }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
    .legal--standalone { padding: 14px 14px 80px; }
    .legal-hero { flex-direction: column; align-items: flex-start; gap: 14px; padding: 22px 20px; }
    .legal-hero h1 { font-size: 1.7rem; }
    .legal-tabs { display: flex; width: 100%; }
    .legal-tabs a { flex: 1; justify-content: center; padding: 9px 8px; font-size: 0.8rem; }
    .legal-sec { padding: 18px 18px 8px; }
    .legal-intro { padding: 16px 18px; }
    .legal-top-btn { right: 78px; bottom: 20px; }
}

/* ---------- Print: just the document ---------- */
@media print {
    .legal-topbar, .legal-tabs, .legal-toc, .legal-help, .legal-top-btn, .vk-support-widget { display: none !important; }
    .legal-hero { background: none; color: #000; box-shadow: none; padding: 0; }
    .legal-hero h1 { color: #000; }
    .legal-chip { border-color: #999; background: none; color: #000; }
    .legal-sec, .legal-intro, .legal-glance-card { box-shadow: none; break-inside: avoid; }
    .legal-layout { display: block; }
}
