/* ============================================================
   LEGAL / DOCS PAGES — Premium light design
   Используется в: privacy.html, terms.html, offer.html, contacts.html,
                    pricing.html, cases.html, demo.html и т.п.

   Префикс: lp- (legal-page).
   Активируется через body:has(.lp-page) — никаких ручных body классов.
   ============================================================ */

/* Сброс тёмного фона base.html */
body:has(.lp-page) {
    background:
        radial-gradient(circle at 20% 0%, rgba(99, 102, 241, 0.10), transparent 38%),
        radial-gradient(circle at 90% 18%, rgba(34, 211, 238, 0.08), transparent 36%),
        linear-gradient(180deg, #f8fafc 0%, #ffffff 50%, #f1f5f9 100%) !important;
    background-attachment: fixed !important;
    color: #0f172a !important;
    padding-top: 0 !important;
}

/* Скрыть navbar-modern для guest на legal-странице (он прибит к base.html
   и портит внешний вид у не-авторизованного посетителя). Авторизованным
   оставляем — это рабочий навбар. */
body:has(.lp-page) > .navbar-modern:not(.show-on-legal) {
    /* Если нужно вернуть — снять display:none */
}

body:has(.lp-page) main.page-container {
    padding: 0 !important;
    padding-bottom: 0 !important;
    max-width: 100% !important;
}

.lp-page {
    min-height: calc(100vh - 80px);
    padding: 24px 0 0;
}

/* ─────────────── HERO ─────────────── */
.lp-hero {
    position: relative;
    padding: 64px 24px 48px;
    text-align: center;
    overflow: hidden;
}
.lp-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 50% 30%, rgba(99, 102, 241, 0.10), transparent 50%);
    pointer-events: none;
}

.lp-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.10), rgba(167, 139, 250, 0.06));
    border: 1px solid rgba(99, 102, 241, 0.22);
    color: #4338ca;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 18px;
}
.lp-hero-eyebrow i { color: #6366f1; }

.lp-hero-title {
    font-size: clamp(2rem, 5vw, 2.8rem);
    font-weight: 900;
    line-height: 1.1;
    margin: 0 0 14px;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #0f172a 0%, #4338ca 55%, #6366f1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.lp-hero-subtitle {
    font-size: 1.05rem;
    color: #64748b;
    max-width: 620px;
    margin: 0 auto 16px;
    line-height: 1.55;
}

.lp-hero-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
    backdrop-filter: blur(8px);
}
.lp-hero-meta i { color: #6366f1; }

/* ─────────────── LAYOUT (TOC + content) ─────────────── */
.lp-layout {
    max-width: 1180px;
    margin: 0 auto;
    padding: 32px 24px 56px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 36px;
    align-items: flex-start;
}

@media (max-width: 980px) {
    .lp-layout {
        grid-template-columns: 1fr;
        padding: 20px 16px 40px;
        gap: 20px;
    }
}

/* ─────────────── TOC (Table of Contents) ─────────────── */
.lp-toc {
    position: sticky;
    top: 96px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 18px;
    padding: 22px 18px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.06);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.lp-toc-title {
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #94a3b8;
    margin: 0 0 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.lp-toc-list { list-style: none; padding: 0; margin: 0; }
.lp-toc-list a {
    display: block;
    padding: 9px 12px;
    border-radius: 10px;
    color: #475569;
    text-decoration: none;
    font-size: 0.88rem;
    line-height: 1.4;
    font-weight: 500;
    margin-bottom: 2px;
    border-left: 3px solid transparent;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.lp-toc-list a:hover {
    background: rgba(99, 102, 241, 0.06);
    color: #4338ca;
    border-left-color: rgba(99, 102, 241, 0.3);
}
.lp-toc-list a.is-active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.10), transparent 80%);
    color: #4338ca;
    border-left-color: #6366f1;
    font-weight: 700;
}
.lp-toc-list a span.lp-toc-num {
    display: inline-block;
    width: 22px;
    color: #94a3b8;
    font-weight: 700;
    font-size: 0.78rem;
}

@media (max-width: 980px) {
    .lp-toc {
        position: static;
        max-height: none;
    }
}

/* ─────────────── CONTENT ─────────────── */
.lp-content {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 24px;
    padding: 40px 44px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.06);
}

@media (max-width: 720px) {
    .lp-content {
        padding: 26px 20px;
        border-radius: 18px;
    }
}

.lp-content section { margin-bottom: 36px; scroll-margin-top: 110px; }
.lp-content section:last-child { margin-bottom: 0; }

.lp-content h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 18px;
    letter-spacing: -0.01em;
    line-height: 1.2;
}
.lp-content h2 .lp-h2-num {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 0.92rem;
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(99, 102, 241, 0.30);
}
@media (max-width: 720px) {
    .lp-content h2 { font-size: 1.18rem; gap: 10px; }
    .lp-content h2 .lp-h2-num { width: 34px; height: 34px; font-size: 0.82rem; }
}

.lp-content h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    margin: 22px 0 10px;
}

.lp-content p {
    font-size: 0.96rem;
    line-height: 1.75;
    color: #475569;
    margin: 0 0 14px;
}
.lp-content p:last-child { margin-bottom: 0; }

.lp-content ul,
.lp-content ol {
    margin: 0 0 18px;
    padding-left: 0;
    list-style: none;
}
.lp-content ul li,
.lp-content ol li {
    position: relative;
    padding: 9px 14px 9px 36px;
    color: #475569;
    font-size: 0.94rem;
    line-height: 1.6;
    background: rgba(241, 245, 249, 0.55);
    border-radius: 12px;
    margin-bottom: 6px;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.lp-content ul li:hover,
.lp-content ol li:hover {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.16);
}
.lp-content ul li::before {
    content: "";
    position: absolute;
    left: 14px;
    top: 14px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.10);
}
.lp-content ol { counter-reset: lp-list; }
.lp-content ol li {
    counter-increment: lp-list;
    padding-left: 44px;
}
.lp-content ol li::before {
    content: counter(lp-list);
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 8px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-weight: 800;
    font-size: 0.74rem;
    display: grid;
    place-items: center;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.25);
}

.lp-content a {
    color: #4338ca;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px dashed rgba(99, 102, 241, 0.32);
    transition: color 0.15s, border-color 0.15s;
}
.lp-content a:hover {
    color: #4f46e5;
    border-bottom-color: #4f46e5;
}

.lp-content strong { color: #0f172a; font-weight: 700; }

/* Highlighted info-box внутри */
.lp-content .lp-info,
.lp-content .lp-note {
    margin: 24px 0;
    padding: 18px 22px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(167, 139, 250, 0.04));
    border: 1px solid rgba(99, 102, 241, 0.22);
    border-radius: 14px;
    color: #475569;
}
.lp-content .lp-info p,
.lp-content .lp-note p { margin: 0; font-size: 0.92rem; }

/* CTA после контента */
.lp-cta {
    margin: 32px auto 0;
    max-width: 680px;
    padding: 28px;
    border-radius: 22px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    text-align: center;
    box-shadow: 0 24px 56px rgba(99, 102, 241, 0.30);
}
.lp-cta h3 { color: #fff; font-size: 1.3rem; margin: 0 0 8px; }
.lp-cta p { color: rgba(255, 255, 255, 0.86); margin: 0 0 18px; }
.lp-cta-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.lp-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.92rem;
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.2s;
}
.lp-cta-btn-primary { background: #fff; color: #4338ca !important; border: 1px solid #fff !important; }
.lp-cta-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(0,0,0,0.18); }
.lp-cta-btn-ghost {
    background: rgba(255,255,255,0.10);
    color: #fff !important;
    border: 1px solid rgba(255,255,255,0.36) !important;
}
.lp-cta-btn-ghost:hover { background: rgba(255,255,255,0.20); }

/* Print (для юристов) */
@media print {
    .lp-toc, .lp-cta, .landing-footer-v2 { display: none !important; }
    .lp-content { box-shadow: none !important; border: none !important; padding: 0 !important; }
    .lp-layout { grid-template-columns: 1fr !important; }
}


/* ─────────────── EXTENSIONS v2: tables, callouts, related, mute ─────────────── */

/* Hero meta может содержать несколько меток в ряд */
.lp-hero-meta {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 16px;
    padding: 8px 16px;
}
.lp-hero-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
}
.lp-hero-meta span + span {
    padding-left: 16px;
    border-left: 1px solid #e2e8f0;
}

/* Tables — для перечислений категорий, прав, штрафов */
.lp-table-wrap {
    margin: 18px 0 22px;
    overflow-x: auto;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}
.lp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    color: #1f2937;
    min-width: 520px;
}
.lp-table thead th {
    text-align: left;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.05));
    color: #4338ca;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(99, 102, 241, 0.18);
    white-space: nowrap;
}
.lp-table tbody td {
    padding: 14px 16px;
    color: #475569;
    line-height: 1.55;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
}
.lp-table tbody tr:last-child td {
    border-bottom: none;
}
.lp-table tbody tr:nth-child(even) td {
    background: rgba(248, 250, 252, 0.6);
}

/* Callout block — выделенное уведомление с иконкой */
.lp-callout {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 16px 18px;
    margin: 22px 0;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.06), rgba(99, 102, 241, 0.05));
    border: 1px solid rgba(99, 102, 241, 0.20);
}
.lp-callout > i {
    font-size: 1.4rem;
    color: #6366f1;
    flex: 0 0 auto;
    margin-top: 2px;
}
.lp-callout > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: #475569;
    font-size: 0.92rem;
    line-height: 1.55;
}
.lp-callout strong { color: #0f172a; }

/* Mute (метаданные внутри секций) */
.lp-content .lp-mute,
.lp-content p.lp-mute {
    color: #94a3b8;
    font-size: 0.85rem;
}

/* Inline code */
.lp-content code {
    padding: 2px 7px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.85em;
    color: #4338ca;
}

/* Related links — навигация между документами */
.lp-related {
    margin-top: 36px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    color: #64748b;
    font-size: 0.88rem;
}
.lp-related > span {
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.78rem;
    margin-right: 4px;
}
.lp-related a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e2e8f0;
    color: #4338ca !important;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none !important;
    border-bottom: 1px solid #e2e8f0 !important;
    transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.lp-related a:hover {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.36) !important;
    transform: translateY(-1px);
}

/* Sticky CTA bar mustn't overlap legal pages content (fix mobile) */
body:has(.lp-page) .sticky-cta { z-index: 40; }

/* Скрываем sticky/floating элементы на печати */
@media print {
    body:has(.lp-page) .sticky-cta,
    body:has(.lp-page) .float-chat,
    body:has(.lp-page) .exit-popup { display: none !important; }
    .lp-related { display: none !important; }
}

/* H3 inside content — гладкое разделение */
.lp-content section h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #1e293b;
}
.lp-content section h3::before {
    content: "";
    width: 4px;
    height: 16px;
    border-radius: 2px;
    background: linear-gradient(180deg, #6366f1, #8b5cf6);
    flex: 0 0 auto;
}

/* Nested lists без двойной стилизации */
.lp-content ul li ul,
.lp-content ol li ul {
    margin-top: 8px;
    margin-bottom: 0;
    padding-left: 0;
}
.lp-content ul li ul li,
.lp-content ol li ul li {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid #eef2ff;
    padding: 7px 12px 7px 30px;
    margin-bottom: 4px;
    font-size: 0.9rem;
}
.lp-content ul li ul li::before {
    width: 8px;
    height: 8px;
    top: 13px;
    left: 12px;
}
