/* cookie-consent.css - cookie consent banner and preference centre
   Referenced by includes/footer.php on every page. */

:root {
    --cc-navy: #1E3C72;
    --cc-navy-dark: #15294d;
    --cc-gold: #FFC107;
    --cc-text: #333;
    --cc-muted: #4b5563;
    --cc-border: #e5e7eb;
}

/* Hidden until JS decides the banner is needed */
.cc-banner[hidden],
.cc-modal[hidden] {
    display: none !important;
}

/* ---------- Banner ---------- */
.cc-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9990;
    background: #ffffff;
    border-top: 3px solid var(--cc-navy);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    font-family: 'Inter', Arial, sans-serif;
    animation: cc-slide-up 0.35s ease-out;
}

@keyframes cc-slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .cc-banner { animation: none; }
}

.cc-banner__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.cc-banner__text {
    flex: 1 1 420px;
    min-width: 260px;
}

.cc-banner__title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--cc-navy);
    margin: 0 0 6px;
}

.cc-banner__desc {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--cc-muted);
    margin: 0;
}

.cc-banner__desc a {
    color: var(--cc-navy);
    text-decoration: underline;
}

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

.cc-banner__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* ---------- Buttons ---------- */
.cc-btn {
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 11px 18px;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.cc-btn:focus-visible {
    outline: 3px solid var(--cc-gold);
    outline-offset: 2px;
}

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

.cc-btn--primary:hover {
    background: var(--cc-navy-dark);
}

.cc-btn--secondary {
    background: #ffffff;
    color: var(--cc-navy);
    border-color: var(--cc-navy);
}

.cc-btn--secondary:hover {
    background: #f1f4f9;
}

.cc-btn--link {
    background: none;
    border: none;
    color: var(--cc-navy);
    text-decoration: underline;
    padding: 11px 6px;
}

.cc-btn--link:hover {
    color: var(--cc-navy-dark);
}

/* ---------- Preference modal ---------- */
.cc-modal {
    position: fixed;
    inset: 0;
    z-index: 9995;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.55);
    font-family: 'Inter', Arial, sans-serif;
}

.cc-modal__dialog {
    background: #ffffff;
    border-radius: 8px;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.cc-modal__header {
    padding: 22px 24px 14px;
    border-bottom: 1px solid var(--cc-border);
}

.cc-modal__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--cc-navy);
    margin: 0;
}

.cc-modal__intro {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--cc-muted);
    margin: 10px 0 0;
}

.cc-modal__intro a {
    color: var(--cc-navy);
    text-decoration: underline;
}

.cc-modal__body {
    padding: 8px 24px 16px;
    overflow-y: auto;
}

.cc-group {
    border-bottom: 1px solid var(--cc-border);
    padding: 16px 0;
}

.cc-group:last-child {
    border-bottom: none;
}

.cc-group__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.cc-group__name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--cc-text);
    margin: 0;
}

.cc-group__desc {
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--cc-muted);
    margin: 8px 0 0;
}

.cc-group__always {
    font-size: 0.8rem;
    font-weight: 600;
    color: #15803d;
    white-space: nowrap;
    padding-top: 2px;
}

/* Toggle switch */
.cc-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex: 0 0 auto;
}

.cc-switch input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.cc-switch__track {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 26px;
    transition: background-color 0.2s;
    pointer-events: none;
}

.cc-switch__track::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 20px;
    height: 20px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.cc-switch input:checked + .cc-switch__track {
    background: var(--cc-navy);
}

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

.cc-switch input:focus-visible + .cc-switch__track {
    outline: 3px solid var(--cc-gold);
    outline-offset: 2px;
}

.cc-modal__footer {
    padding: 16px 24px 22px;
    border-top: 1px solid var(--cc-border);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ---------- Footer "Manage Cookies" link ---------- */
.footer-policies .cc-manage-link,
.cc-manage-link {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    text-decoration: none;
}

.footer-policies .cc-manage-link:hover,
.cc-manage-link:hover {
    color: #000;
    text-decoration: underline;
}

/* "Manage Cookies" button inside the Cookies Policy page */
.policy-manage-cookies {
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    background: var(--cc-navy);
    color: #ffffff;
    border: none;
    border-radius: 4px;
    padding: 11px 20px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.policy-manage-cookies:hover {
    background: var(--cc-navy-dark);
}

.policy-manage-cookies:focus-visible {
    outline: 3px solid var(--cc-gold);
    outline-offset: 2px;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .cc-banner {
        max-height: 85vh;
        overflow-y: auto;
    }

    .cc-banner__inner {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        padding: 16px 15px;
    }

    /* In a column flex container the 420px basis would stretch the banner to
       most of the viewport, so let the text block size itself. */
    .cc-banner__text {
        flex: 0 0 auto;
        min-width: 0;
    }

    .cc-banner__desc {
        font-size: 0.85rem;
    }

    .cc-banner__actions {
        justify-content: stretch;
    }

    .cc-banner__actions .cc-btn {
        flex: 1 1 140px;
        text-align: center;
    }

    .cc-modal__footer {
        justify-content: stretch;
    }

    .cc-modal__footer .cc-btn {
        flex: 1 1 140px;
        text-align: center;
    }
}
