/* ==========================================================================
   legal.css - Terms and Conditions + Privacy Notice (feat/terms-consent)

   Used by:
     - login.html        the consent checkboxes on sign-up step 2 + the popup
     - consent.html      the "Before you continue" screen
     - terms.html / privacy.html   the two document pages
   Load it AFTER style.css. Class names start with "legal-" or "consent-"
   so they cannot clash with other pages.
   ========================================================================== */

/* --- Consent checkboxes (sign-up step 2 and the consent screen) --- */
.consent-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 4px 0 18px;
    text-align: left;
}

.consent-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.consent-row[hidden] {
    display: none;
}

.consent-row input[type="checkbox"] {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    accent-color: #139C38;
    cursor: pointer;
}

.consent-row label {
    font-size: 13.5px;
    font-weight: 400;
    line-height: 1.5;
    color: #333333;
    cursor: pointer;
}

.consent-error {
    font-size: 13px;
    color: #e02424;
}

.consent-error[hidden] {
    display: none;
}

/* A button that looks like a text link: opens a document in the popup */
.legal-link {
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    font-weight: 600;
    color: #139C38;
    cursor: pointer;
}

.legal-link:hover,
.legal-link:focus-visible {
    text-decoration: underline;
}

/* --- Document popup (built by legal-popup.js) --- */
.legal-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.45);
    text-align: left;
}

.legal-popup-overlay[hidden] {
    display: none;
}

.legal-popup-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 680px;
    max-height: calc(100vh - 32px);
    padding: 24px 28px;
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    font-family: 'Inter', sans-serif;
}

.legal-popup-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: none;
    font-size: 26px;
    line-height: 1;
    color: #666666;
    cursor: pointer;
}

.legal-popup-close:hover,
.legal-popup-close:focus-visible {
    color: #139C38;
    background: #f1f5f9;
    outline: none;
}

.legal-popup-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-right: 48px;
}

.legal-popup-tab {
    min-height: 40px;
    padding: 8px 16px;
    border: none;
    border-radius: 999px;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
}

.legal-popup-tab:hover {
    background: #f1f5f9;
}

.legal-popup-tab.is-active {
    background: #dcf5e3;
    color: #0a5c21;
}

.legal-popup-tab:focus-visible {
    outline: 2px solid #139C38;
    outline-offset: 2px;
}

.legal-popup-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 18px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.legal-popup-status {
    font-size: 14px;
    color: #64748b;
}

.legal-popup-actions {
    display: flex;
    justify-content: flex-end;
}

.legal-popup-done {
    min-height: 44px;
    padding: 10px 28px;
    border: 1px solid #94a3b8;
    border-radius: 25px;
    background: #FFFFFF;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    cursor: pointer;
}

.legal-popup-done:hover {
    background: #f8fafc;
}

/* --- The document text (same in the popup and on its own page) --- */
.legal-doc {
    font-family: 'Inter', sans-serif;
    color: #334155;
}

.legal-doc h1 {
    margin: 0 0 4px;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: 0;
    color: #111111;
}

.legal-doc .legal-version {
    margin: 0 0 18px;
    font-size: 13px;
    color: #64748b;
}

.legal-doc h2 {
    margin: 20px 0 6px;
    font-size: 16px;
    font-weight: 700;
    color: #111111;
}

.legal-doc p,
.legal-doc li {
    font-size: 14.5px;
    line-height: 1.65;
}

.legal-doc p {
    margin: 0 0 10px;
}

.legal-doc ul {
    margin: 0 0 10px;
    padding-left: 22px;
}

.legal-doc li {
    margin-bottom: 4px;
}

.legal-doc .legal-short {
    margin: 0 0 8px;
    padding: 14px 16px;
    border: 1px solid #cfe8d6;
    border-radius: 12px;
    background: #f1faf4;
}

.legal-doc .legal-short h2 {
    margin-top: 0;
}

.legal-doc .legal-short ul {
    margin-bottom: 0;
}

.legal-table-wrap {
    margin: 0 0 10px;
    overflow-x: auto;
}

.legal-doc table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.legal-doc th,
.legal-doc td {
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: top;
    line-height: 1.5;
}

.legal-doc th {
    background: #f8fafc;
    font-weight: 700;
    color: #111111;
}

/* --- Header shared by the Terms, Privacy Notice and consent pages --- */
.legal-header .logo-link {
    display: block;
}

/* --- Terms / Privacy Notice pages --- */
.legal-page {
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
    padding: 32px 24px 80px;
}

.legal-back {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #0f802f;
    text-decoration: none;
}

.legal-back:hover {
    text-decoration: underline;
}

.legal-card {
    padding: 36px 40px;
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

.legal-other {
    margin-top: 18px;
    font-size: 14px;
    color: #475569;
}

.legal-other a {
    font-weight: 600;
    color: #0f802f;
    text-decoration: none;
}

.legal-other a:hover {
    text-decoration: underline;
}

/* --- Consent screen ("Before you continue") --- */
.consent-page {
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 48px 16px 64px;
}

.consent-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 600px;
    padding: 40px;
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    font-family: 'Inter', sans-serif;
}

.consent-card .consent-title {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0;
    color: #111111;
}

.consent-lead {
    font-size: 14px;
    line-height: 1.55;
    color: #444444;
}

.consent-short {
    padding: 14px 16px;
    border: 1px solid #cfe8d6;
    border-radius: 12px;
    background: #f1faf4;
}

.consent-short h2 {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #0a5c21;
}

.consent-short ul {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-left: 18px;
    font-size: 13.5px;
    line-height: 1.5;
    color: #333333;
}

.consent-docs {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.consent-doc-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 48px;
    padding: 0 16px;
    border: none;
    border-radius: 8px;
    background: #EDEAE4;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #333333;
    text-align: left;
    cursor: pointer;
    transition: color 0.2s ease, box-shadow 0.2s ease;
}

.consent-doc-btn::after {
    content: "\203A";
    font-size: 20px;
    line-height: 1;
}

.consent-doc-btn:hover,
.consent-doc-btn:focus-visible {
    color: #139C38;
    box-shadow: inset 0 0 0 1px #1CE8C8;
    outline: none;
}

.consent-card .consent-group {
    margin: 0;
}

.consent-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.consent-agree-btn {
    width: 100%;
    min-height: 48px;
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    background: linear-gradient(90deg, #00D0FF 0%, #1CE8C8 50%, #38FF92 100%);
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    color: #FFFFFF;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(28, 232, 200, 0.3);
    transition: transform 0.1s ease;
}

.consent-agree-btn:active {
    transform: scale(0.98);
}

.consent-agree-btn:disabled,
.consent-decline-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.consent-agree-btn:focus-visible,
.consent-decline-btn:focus-visible {
    outline: 2px solid #139C38;
    outline-offset: 2px;
}

.consent-decline-btn {
    min-height: 44px;
    padding: 8px 16px;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #333333;
    text-decoration: underline;
    cursor: pointer;
}

.consent-note {
    font-size: 12.5px;
    color: #555555;
    text-align: center;
}

/* ==========================================================================
   PHONES AND TABLETS
   ========================================================================== */
@media (max-width: 900px) {
    .legal-header {
        flex-direction: row;
        gap: 0;
        min-height: 0;
        padding: 8px 16px;
    }

    .legal-header .logo-container {
        padding-left: 0;
    }

    .legal-header .logo-img {
        height: 44px;
    }

    .consent-row input[type="checkbox"] {
        width: 22px;
        height: 22px;
        margin-top: 0;
    }
}

@media (max-width: 600px) {
    .legal-popup-overlay {
        padding: 10px;
    }

    .legal-popup-card {
        max-height: calc(100vh - 20px);
        padding: 18px 16px;
    }

    .legal-popup-tab {
        padding: 8px 12px;
        font-size: 13px;
    }

    .legal-popup-body {
        padding: 12px 14px;
    }

    .legal-popup-done {
        width: 100%;
    }

    .legal-page {
        padding: 16px 12px 56px;
    }

    .legal-card {
        padding: 22px 18px;
    }

    .legal-doc h1 {
        font-size: 22px;
    }

    .consent-page {
        padding: 16px 12px 40px;
    }

    .consent-card {
        padding: 24px 20px;
    }

    .consent-card .consent-title {
        font-size: 24px;
    }
}