/* ================================================================
   GabayRN — Legal Modals (Privacy Policy + Terms & Conditions)
   Shared by landing (Home/Index) and auth (Signup). Strictly no
   border color — shadow only. Medium size: ~720px desktop.
   ================================================================ */

/* -- Overlay -- */
.lp-legal-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.28s ease;
    padding: 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.lp-legal-overlay.active {
    display: flex;
    opacity: 1;
}

/* -- Card -- */
.lp-legal-modal {
    background: #fff;
    border: none;
    border-radius: 20px;
    width: min(720px, 92vw);
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
    transform: translateY(14px) scale(0.99);
    transition: transform 0.28s ease;
}

.lp-legal-overlay.active .lp-legal-modal {
    transform: translateY(0) scale(1);
}

/* -- Header (sticky) -- */
.lp-legal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 28px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
    background: #fff;
}

.lp-legal-header h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    line-height: 1.3;
}

.lp-legal-meta {
    font-family: 'Poppins', sans-serif;
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 500;
    margin-top: 2px;
}

.lp-legal-close {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    font-size: 1rem;
    line-height: 1;
}

.lp-legal-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.lp-legal-close:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* -- Body (scrollable) -- */
.lp-legal-body {
    padding: 24px 32px 28px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
    -webkit-overflow-scrolling: touch;
}

.lp-legal-body::-webkit-scrollbar {
    width: 6px;
}

.lp-legal-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.lp-legal-body::-webkit-scrollbar-track {
    background: transparent;
}

/* Markdown-rendered typography */
.lp-legal-body h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 8px;
    line-height: 1.25;
}

.lp-legal-body h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.02rem;
    font-weight: 700;
    color: #0f172a;
    margin: 22px 0 10px;
    padding-top: 14px;
    border-top: 1px solid #f1f5f9;
    line-height: 1.35;
}

.lp-legal-body h2:first-child {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.lp-legal-body h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    color: #1e293b;
    margin: 16px 0 8px;
}

.lp-legal-body p {
    font-family: 'Poppins', sans-serif;
    font-size: 0.875rem;
    color: #334155;
    line-height: 1.7;
    margin: 0 0 12px;
}

.lp-legal-body ul,
.lp-legal-body ol {
    margin: 0 0 14px 20px;
    padding: 0;
}

.lp-legal-body li {
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    color: #334155;
    line-height: 1.65;
    margin-bottom: 6px;
}

.lp-legal-body strong {
    color: #0f172a;
    font-weight: 600;
}

.lp-legal-body a {
    color: #2563eb;
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-word;
}

.lp-legal-body hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 18px 0;
}

.lp-legal-body em {
    color: #64748b;
}

/* -- Footer — single pill -- */
.lp-legal-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px 18px;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
    background: #fff;
}

.lp-legal-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: #2563eb;
    background: #eff6ff;
    border: none;
    border-radius: 999px;
    padding: 7px 14px;
}

/* -- Loading / error state -- */
.lp-legal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 12px;
    color: #64748b;
    font-family: 'Poppins', sans-serif;
    font-size: 0.88rem;
}

.lp-legal-loading i {
    font-size: 1.4rem;
    color: #2563eb;
    animation: lp-legal-spin 0.9s linear infinite;
}

@keyframes lp-legal-spin {
    to { transform: rotate(360deg); }
}

/* -- Auth (signup) page variant tweak -- */
/* Signup uses same modal but needs font fallback if Poppins not loaded */
.auth-container ~ .lp-legal-overlay .lp-legal-body,
.auth-container ~ .lp-legal-overlay .lp-legal-header h2 {
    font-family: 'Poppins', 'Segoe UI', sans-serif;
}

/* ================================================================
   Responsive
   ================================================================ */
@media (max-width: 640px) {
    .lp-legal-overlay {
        padding: 12px;
        align-items: flex-start;
        padding-top: 5vh;
    }

    .lp-legal-modal {
        width: 94vw;
        max-height: 85vh;
        border-radius: 16px;
    }

    .lp-legal-header {
        padding: 16px 18px;
    }

    .lp-legal-header h2 {
        font-size: 0.98rem;
    }

    .lp-legal-body {
        padding: 18px 18px 22px;
    }

    .lp-legal-body h1 {
        font-size: 1.15rem;
    }

    .lp-legal-body h2 {
        font-size: 0.95rem;
    }

    .lp-legal-body p,
    .lp-legal-body li {
        font-size: 0.82rem;
    }

    .lp-legal-footer {
        padding: 12px 18px 16px;
    }
}

@media (max-width: 380px) {
    .lp-legal-header h2 {
        font-size: 0.92rem;
    }

    .lp-legal-body {
        padding: 16px 14px 20px;
    }
}
