/* ============================================================
   Cookie consent — banner, settings modal, toast.
   Loaded site-wide. Minimalist, brand-aligned, fully scoped:
   every inner element is cc-prefixed so no site-wide or
   Bootstrap rule (.modal-header, .slider, …) can bleed in.
   ============================================================ */

:root {
    --cc-navy: #1e3a5f;
    --cc-navy-dark: #0f2744;
    --cc-text: #2d3748;
    --cc-text-muted: #5a6678;
    --cc-border: #e2e6ec;
    --cc-surface: #ffffff;
    --cc-surface-alt: #f6f7f9;
    --cc-success: #059669;
    --cc-radius: 12px;
    --cc-radius-sm: 8px;
}

/* ---------- Banner (mobile-first: bottom sheet) ---------- */
.cookie-banner {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1080;
    background: var(--cc-surface);
    border-top: 1px solid var(--cc-border);
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -6px 24px rgba(15, 39, 68, 0.12);
}

.cookie-banner.visible {
    display: block;
}

.cookie-content {
    max-width: 680px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cookie-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cookie-icon {
    font-size: 20px;
    line-height: 1;
    color: var(--cc-navy);
}

.cookie-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--cc-text);
}

.cookie-body p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--cc-text-muted);
}

.cookie-body a {
    color: var(--cc-navy);
    font-weight: 600;
    text-decoration: underline;
}

.cookie-body a:hover {
    color: var(--cc-navy-dark);
}

/* ---------- Buttons (shared by banner + modal save) ---------- */
.cookie-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cookie-button {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    margin: 0;
    padding: 11px 18px;
    border-radius: var(--cc-radius-sm);
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cookie-button:disabled {
    opacity: 0.6;
    cursor: default;
}

.cookie-button.primary {
    background: var(--cc-navy);
    color: #ffffff;
}

.cookie-button.primary:hover:not(:disabled) {
    background: var(--cc-navy-dark);
}

.cookie-button.secondary {
    background: var(--cc-surface);
    color: var(--cc-navy);
    border-color: var(--cc-border);
}

.cookie-button.secondary:hover:not(:disabled) {
    background: var(--cc-surface-alt);
}

.cookie-button.tertiary {
    background: transparent;
    color: var(--cc-text-muted);
}

.cookie-button.tertiary:hover:not(:disabled) {
    color: var(--cc-navy);
    text-decoration: underline;
}

/* ---------- Settings modal ---------- */
.cookie-settings-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1090;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 39, 68, 0.55);
}

.cookie-settings-modal.visible {
    display: flex;
}

.cc-modal {
    background: var(--cc-surface);
    border-radius: var(--cc-radius);
    width: 100%;
    max-width: 520px;
    max-height: 88vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: 0 24px 60px rgba(15, 39, 68, 0.3);
}

.cc-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--cc-border);
}

.cc-modal__header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--cc-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.cc-modal__header h3 i {
    color: var(--cc-navy);
    font-size: 0.95em;
}

.cc-modal__close {
    appearance: none;
    -webkit-appearance: none;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--cc-text-muted);
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.cc-modal__close:hover {
    background: var(--cc-surface-alt);
    color: var(--cc-text);
}

.cc-modal__desc {
    margin: 14px 0 16px;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--cc-text-muted);
}

.cc-modal__body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ---------- Cookie option rows ---------- */
.cc-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-radius-sm);
    background: var(--cc-surface);
}

.cc-option--necessary {
    background: var(--cc-surface-alt);
}

.cc-option__text {
    flex: 1;
    min-width: 0;
}

.cc-option__text h4 {
    margin: 0 0 3px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--cc-text);
    display: flex;
    align-items: center;
    gap: 7px;
}

.cc-option__text h4 i {
    color: var(--cc-navy);
    font-size: 0.95em;
}

.cc-option__text p {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--cc-text-muted);
}

.cc-option__status {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--cc-success);
}

/* ---------- Toggle switch ---------- */
.cc-toggle {
    position: relative;
    flex-shrink: 0;
    width: 46px;
    height: 26px;
    margin: 0;
}

.cc-toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.cc-toggle__track {
    position: absolute;
    inset: 0;
    background: #cbd2dc;
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.cc-toggle__track::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 20px;
    height: 20px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(15, 39, 68, 0.25);
    transition: transform 0.15s ease;
}

.cc-toggle input:checked + .cc-toggle__track {
    background: var(--cc-navy);
}

.cc-toggle input:checked + .cc-toggle__track::before {
    transform: translateX(20px);
}

.cc-toggle input:disabled + .cc-toggle__track {
    background: var(--cc-success);
    cursor: default;
}

/* ---------- Modal footer ---------- */
.cc-modal__footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--cc-border);
}

.cc-modal__quick {
    display: flex;
    gap: 8px;
}

.cc-quick-btn {
    flex: 1;
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    padding: 9px 12px;
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-radius-sm);
    background: var(--cc-surface);
    color: var(--cc-text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.cc-quick-btn:hover {
    background: var(--cc-surface-alt);
    color: var(--cc-text);
}

/* ---------- Toast ---------- */
.consent-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1100;
    max-width: 320px;
    padding: 12px 16px;
    background: var(--cc-navy);
    color: #ffffff;
    font-size: 0.88rem;
    line-height: 1.4;
    border-radius: var(--cc-radius-sm);
    box-shadow: 0 6px 20px rgba(15, 39, 68, 0.2);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    /* Critical: while hidden the toast must never intercept clicks. */
    pointer-events: none;
}

.consent-toast.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    cursor: pointer;
}

.consent-toast.error {
    background: #b91c1c;
}

/* ---------- Focus (scoped — must not leak to the whole site) ---------- */
.cookie-banner :focus-visible,
.cookie-settings-modal :focus-visible,
.consent-toast:focus-visible {
    outline: 2px solid var(--cc-navy);
    outline-offset: 2px;
}

/* ---------- Desktop: compact corner card ---------- */
@media (min-width: 768px) {
    .cookie-banner {
        left: 24px;
        right: auto;
        bottom: 24px;
        max-width: 420px;
        border: 1px solid var(--cc-border);
        border-radius: var(--cc-radius);
        box-shadow: 0 10px 32px rgba(15, 39, 68, 0.16);
    }

    .cookie-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .cookie-button {
        width: auto;
        flex: 1 1 0;
    }

    .cookie-button.tertiary {
        flex-basis: 100%;
    }

    .cc-modal__footer {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .cc-modal__quick {
        flex: 0 1 auto;
    }

    .cc-modal__footer .cookie-button {
        width: auto;
        flex: 0 0 auto;
    }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .cookie-button,
    .cc-toggle__track,
    .cc-toggle__track::before,
    .cc-modal__close,
    .consent-toast {
        transition: none;
    }
}

/* ---------- Footer settings link ---------- */
.cookie-settings-link {
    cursor: pointer;
}

/* ---------- Accessibility helper ---------- */
.cc-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
