/**
 * Adamiro cookie consent — banner + preferences modal.
 * Swiss/matte per adamiro-brand: hairline borders, 4px radius, no
 * drop-shadows, no glassmorphism. Dark-mode-first with a light override
 * for the logged-in app shell ([data-theme="light"]).
 */

.adm-consent, .adm-consent * {
    box-sizing: border-box;
}

.adm-consent[hidden] {
    display: none !important;
}

/* ── Banner ─────────────────────────────────────────────────────────── */

.adm-consent-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    /* Max z-index: must win over the still-active CookieYes banner
       (z-index 9999999) during the transition window before CookieYes is
       deactivated on each environment (docs/COOKIE_CONSENT_PLAN.md §6). */
    z-index: 2147483647;
    padding: 16px;
    pointer-events: none;
}

.adm-consent__bar {
    pointer-events: auto;
    max-width: 1080px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px 24px;
    padding: 18px 24px;
    background: var(--navy-surface, #1E293B);
    border: 1px solid rgba(241, 245, 249, 0.12);
    border-radius: 4px;
    color: var(--ink, #F1F5F9);
    font-family: 'Poppins', sans-serif;
}

.adm-consent__text {
    flex: 1 1 320px;
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: rgba(241, 245, 249, 0.85);
}

.adm-consent__link {
    color: var(--teal, #2FB8A0);
    text-decoration: underline;
    white-space: nowrap;
}

.adm-consent__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    flex: 0 0 auto;
}

/* ── Buttons ────────────────────────────────────────────────────────── */

.adm-consent__btn {
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 10px 18px;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    min-height: 40px;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.adm-consent__btn--primary {
    background: var(--teal, #2FB8A0);
    border-color: var(--teal, #2FB8A0);
    color: var(--navy-deep, #050B17);
}

.adm-consent__btn--primary:hover {
    background: var(--teal-deep, #1E7A6B);
    border-color: var(--teal-deep, #1E7A6B);
    color: #fff;
}

.adm-consent__btn--outline {
    background: transparent;
    border-color: rgba(241, 245, 249, 0.3);
    color: var(--ink, #F1F5F9);
}

.adm-consent__btn--outline:hover {
    border-color: var(--teal, #2FB8A0);
    color: var(--teal, #2FB8A0);
}

.adm-consent__btn--ghost {
    background: transparent;
    border-color: transparent;
    color: rgba(241, 245, 249, 0.6);
    text-decoration: underline;
    padding-left: 4px;
    padding-right: 4px;
}

.adm-consent__btn--ghost:hover {
    color: var(--ink, #F1F5F9);
}

/* ── Modal ──────────────────────────────────────────────────────────── */

.adm-consent-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.adm-consent-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 11, 23, 0.72);
}

.adm-consent-modal__panel {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: min(80vh, 720px);
    display: flex;
    flex-direction: column;
    background: var(--navy-surface, #1E293B);
    border: 1px solid rgba(241, 245, 249, 0.12);
    border-radius: 4px;
    color: var(--ink, #F1F5F9);
    font-family: 'Poppins', sans-serif;
}

.adm-consent-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(241, 245, 249, 0.1);
}

.adm-consent-modal__title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.adm-consent-modal__close {
    background: none;
    border: none;
    color: rgba(241, 245, 249, 0.6);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 4px;
    min-width: 32px;
    min-height: 32px;
}

.adm-consent-modal__close:hover {
    color: var(--ink, #F1F5F9);
}

.adm-consent-modal__body {
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.adm-consent-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid rgba(241, 245, 249, 0.1);
}

/* ── Category rows ──────────────────────────────────────────────────── */

.adm-consent-cat {
    border: 1px solid rgba(241, 245, 249, 0.1);
    border-radius: 4px;
    padding: 14px 16px;
}

.adm-consent-cat__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.adm-consent-cat__title {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 700;
}

.adm-consent-cat__desc {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.5;
    color: rgba(241, 245, 249, 0.6);
}

.adm-consent-cat__details {
    margin-top: 12px;
}

.adm-consent-cat__details summary {
    font-size: 12px;
    color: var(--teal, #2FB8A0);
    cursor: pointer;
}

/* ── Toggle switch ──────────────────────────────────────────────────── */

.adm-consent-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex: 0 0 auto;
}

.adm-consent-toggle__input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.adm-consent-toggle__track {
    position: absolute;
    inset: 0;
    background: rgba(241, 245, 249, 0.15);
    border-radius: 999px;
    transition: background-color .15s ease;
}

.adm-consent-toggle__track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform .15s ease;
}

.adm-consent-toggle__input:checked ~ .adm-consent-toggle__track {
    background: var(--teal, #2FB8A0);
}

.adm-consent-toggle__input:checked ~ .adm-consent-toggle__track::after {
    transform: translateX(18px);
}

.adm-consent-toggle__input:focus-visible ~ .adm-consent-toggle__track {
    outline: 2px solid var(--teal, #2FB8A0);
    outline-offset: 2px;
}

.adm-consent-toggle--locked {
    display: inline-block;
    width: 40px;
    height: 22px;
    background: rgba(47, 184, 160, 0.35);
    border-radius: 999px;
    flex: 0 0 auto;
}

/* ── Table ──────────────────────────────────────────────────────────── */

.adm-consent-table {
    width: 100%;
    margin-top: 10px;
    border-collapse: collapse;
    font-size: 12px;
}

.adm-consent-table th,
.adm-consent-table td {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid rgba(241, 245, 249, 0.08);
    vertical-align: top;
}

.adm-consent-table th {
    color: rgba(241, 245, 249, 0.5);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 10px;
}

.adm-consent-table code {
    font-size: 11px;
    color: var(--teal, #2FB8A0);
}

/* ── Light theme override (logged-in app shell) ────────────────────── */

[data-theme="light"] .adm-consent__bar,
[data-theme="light"] .adm-consent-modal__panel {
    background: #fff;
    border-color: rgba(11, 20, 38, 0.10);
    color: #0B1426;
}

[data-theme="light"] .adm-consent__text {
    color: rgba(11, 20, 38, 0.75);
}

[data-theme="light"] .adm-consent__btn--outline {
    border-color: rgba(11, 20, 38, 0.2);
    color: #0B1426;
}

[data-theme="light"] .adm-consent__btn--ghost {
    color: rgba(11, 20, 38, 0.55);
}

[data-theme="light"] .adm-consent__btn--ghost:hover {
    color: #0B1426;
}

[data-theme="light"] .adm-consent-modal__header,
[data-theme="light"] .adm-consent-modal__footer {
    border-color: rgba(11, 20, 38, 0.1);
}

[data-theme="light"] .adm-consent-modal__close {
    color: rgba(11, 20, 38, 0.5);
}

[data-theme="light"] .adm-consent-cat {
    border-color: rgba(11, 20, 38, 0.1);
}

[data-theme="light"] .adm-consent-cat__desc {
    color: rgba(11, 20, 38, 0.6);
}

[data-theme="light"] .adm-consent-toggle__track {
    background: rgba(11, 20, 38, 0.15);
}

[data-theme="light"] .adm-consent-table th,
[data-theme="light"] .adm-consent-table td {
    border-color: rgba(11, 20, 38, 0.08);
}

[data-theme="light"] .adm-consent-table th {
    color: rgba(11, 20, 38, 0.5);
}

/* ── Mobile ─────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
    .adm-consent__bar {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
    }

    .adm-consent__actions {
        justify-content: stretch;
    }

    .adm-consent__actions .adm-consent__btn {
        flex: 1 1 auto;
    }

    .adm-consent-modal__panel {
        max-height: 88vh;
    }
}
