:root {
    --legal-navy: #0f2746;
    --legal-blue: #155bd5;
    --legal-gold: #e9b949;
    --legal-text: #17304b;
    --legal-muted: #63758a;
    --legal-line: #d7e2ee;
    --legal-surface: #ffffff;
    --legal-surface-soft: #f6f9fd;
}

html:has(.legal-shell),
body:has(.legal-shell) {
    min-height: 100%;
    margin: 0;
    padding: 0;
    background: #071a33;
}

body:has(.legal-shell) {
    font-family: 'IBM Plex Sans Thai', 'Open Sans', sans-serif;
    color: var(--legal-text);
}

.legal-links,
.auth-legal-note {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 14px;
    color: var(--legal-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

.legal-links a,
.auth-legal-note a,
.cookie-banner a {
    color: var(--legal-blue);
    font-weight: 600;
    text-decoration: none;
}

.legal-links a:hover,
.auth-legal-note a:hover,
.cookie-banner a:hover {
    text-decoration: underline;
}

.auth-legal-note {
    font-size: 0.85rem;
    margin-top: 18px;
}

.auth-legal-note p {
    margin: 0;
    text-align: center;
}

.consent-panel {
    margin: 18px 0 8px;
    padding: 16px 16px 14px;
    background: var(--legal-surface-soft);
    border: 1px solid var(--legal-line);
    border-radius: 14px;
}

.consent-panel-title {
    margin: 0 0 10px;
    font-size: 0.96rem;
    font-weight: 800;
    color: var(--legal-navy);
}

.consent-checklist {
    display: grid;
    gap: 10px;
}

.consent-check {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 10px;
    align-items: start;
    color: var(--legal-text);
    font-size: 0.88rem;
    line-height: 1.6;
}

.consent-check input {
    margin-top: 4px;
}

.consent-help {
    margin: 10px 0 0;
    color: var(--legal-muted);
    font-size: 0.8rem;
}

.consent-update-modal .modal-dialog {
    max-width: 560px;
}

.consent-update-modal .modal-content {
    border: 0;
    border-radius: 22px;
    box-shadow: 0 24px 72px rgba(7, 22, 41, 0.28);
    overflow: hidden;
}

.consent-update-modal .modal-header {
    border-bottom: 1px solid rgba(23, 48, 75, 0.08);
    padding: 22px 24px 14px;
}

.consent-update-modal .modal-body {
    padding: 10px 24px 24px;
}

.consent-update-modal .modal-title {
    margin: 0;
    color: var(--legal-navy);
    font-weight: 800;
}

.consent-update-copy {
    margin: 0 0 14px;
    color: var(--legal-text);
    line-height: 1.7;
}

.consent-update-modal .consent-panel {
    margin: 0;
}

.consent-update-error {
    margin-top: 14px;
    padding: 11px 14px;
    border-radius: 12px;
    background: #fff2f0;
    border: 1px solid rgba(215, 77, 77, 0.22);
    color: #b13a3a;
    font-size: 0.86rem;
}

.consent-update-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}

.cookie-banner {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 12000;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: min(420px, calc(100vw - 32px));
    padding: 18px 18px 16px;
    border-radius: 18px;
    background: #ffffff;
    border: 1px solid rgba(15, 39, 70, 0.12);
    box-shadow: 0 20px 48px rgba(6, 20, 41, 0.16);
    box-sizing: border-box;
    text-align: left;
}

.cookie-banner[hidden] {
    display: none !important;
}

.cookie-banner-title {
    margin: 0 0 8px;
    font-size: 1rem;
    font-weight: 800;
    color: var(--legal-navy);
}


.cookie-banner-copy {
    margin: 0;
    color: var(--legal-text);
    font-size: 0.88rem;
    line-height: 1.65;
}

.cookie-banner-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
    margin-top: 14px;
}

.cookie-banner .btn {
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.84rem;
    min-width: 140px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex: 0 0 auto;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.cookie-banner .btn:hover {
    transform: translateY(-1px);
}

.cookie-banner .btn-primary {
    color: #ffffff;
    background: var(--legal-blue);
    border: 1px solid var(--legal-blue);
    box-shadow: 0 10px 24px rgba(21, 101, 216, 0.18);
}

.cookie-banner .btn-primary:hover {
    color: #ffffff;
    background: #0f4db0;
    border-color: #0f4db0;
}

.cookie-banner .btn-outline-secondary {
    color: var(--legal-navy);
    background: #ffffff;
    border: 1px solid rgba(15, 39, 70, 0.16);
    box-shadow: none;
}

.cookie-banner .btn-outline-secondary:hover {
    color: var(--legal-navy);
    background: #f6f9fd;
    border-color: rgba(15, 39, 70, 0.24);
}

.legal-shell {
    min-height: 100vh;
    padding: 48px 20px 72px;
    background:
        radial-gradient(circle at top right, rgba(242, 184, 75, 0.12), transparent 28%),
        linear-gradient(145deg, #071a33 0%, #10345b 42%, #215583 100%);
}

.legal-card {
    width: 100%;
    max-width: 1020px;
    margin: 0 auto;
    padding: 32px;
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.98);
    border: none;
    box-shadow: 0 24px 64px rgba(2, 12, 27, 0.24);
}

.legal-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.legal-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--legal-navy);
    font-weight: 800;
    font-size: 1.15rem;
    text-decoration: none;
}

.legal-brand span {
    color: var(--legal-gold);
}

.legal-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--legal-blue);
    font-weight: 700;
    text-decoration: none;
}

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

.legal-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(30, 95, 191, 0.09);
    color: var(--legal-blue);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.legal-title {
    margin: 16px 0 10px;
    color: var(--legal-navy);
    font-size: clamp(1.9rem, 4vw, 2.7rem);
    font-weight: 800;
    line-height: 1.15;
}

.legal-meta,
.legal-summary {
    color: var(--legal-muted);
    line-height: 1.75;
}

.language-panels {
    display: grid;
    gap: 28px;
}

.lang-panel[hidden] {
    display: none !important;
}

.legal-section {
    padding: 22px 0;
    border-top: 1px solid var(--legal-line);
}

.legal-section:first-of-type {
    border-top: none;
    padding-top: 0;
}

.legal-section h2 {
    margin: 0 0 10px;
    color: var(--legal-navy);
    font-size: 1.18rem;
    font-weight: 800;
}

.legal-section p,
.legal-section li {
    color: var(--legal-text);
    line-height: 1.75;
}

.legal-section ul {
    margin: 10px 0 0;
    padding-left: 20px;
}

@media (max-width: 768px) {
    .legal-card {
        padding: 22px 18px;
        border-radius: 20px;
    }

    .cookie-banner {
        right: 16px;
        bottom: 16px;
        width: calc(100vw - 32px);
    }

    .cookie-banner-actions {
        justify-content: stretch;
    }

    .cookie-banner .btn {
        flex: 1 1 calc(50% - 5px);
        min-width: 0;
    }
}

/* High-specificity overrides to prevent other page CSS (e.g., Bootstrap) from
   changing cookie banner layout. Keeps alignment consistent with home page. */
html body .cookie-banner,
body .cookie-banner,
.cookie-banner {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    text-align: left !important;
    box-sizing: border-box !important;
}

/* Ensure the action buttons row always aligns to the right on desktop */
html body .cookie-banner .cookie-banner-actions,
body .cookie-banner .cookie-banner-actions,
.cookie-banner .cookie-banner-actions {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    width: 100% !important;
    gap: 10px !important;
}

/* Prevent page-level utilities like .text-center or .btn-block from centering
   or stretching the buttons inside the banner */
.cookie-banner .cookie-banner-copy {
    text-align: left !important;
}
.cookie-banner .btn,
.cookie-banner .btn.btn-block {
    display: inline-flex !important;
    width: auto !important;
    min-width: 140px !important;
}

/* Small screens: keep buttons stacked nicely */
@media (max-width: 420px) {
    .cookie-banner {
        padding: 12px !important;
    }
    .cookie-banner .cookie-banner-actions {
        flex-direction: column-reverse !important;
        gap: 8px !important;
    }
    .cookie-banner .btn {
        width: 100% !important;
        min-width: 0 !important;
    }
}
