/* ============================================================
   UK GDPR / PECR Cookie Consent — Styling
   Theme aligned with the donation site (green primary #0f6e4f)
============================================================ */

:root {
    --cc-primary:        #0f6e4f;
    --cc-primary-hover:  #0b5940;
    --cc-primary-soft:   rgba(15, 110, 79, 0.08);
    --cc-accent:         #ffe082;
    --cc-text:           #1f2937;
    --cc-text-muted:     #6b7280;
    --cc-border:         #e5e7eb;
    --cc-bg:             #ffffff;
    --cc-bg-soft:        #f9fafb;
    --cc-shadow:         0 20px 60px rgba(15, 23, 42, 0.18);
    --cc-shadow-soft:    0 4px 18px rgba(15, 23, 42, 0.08);
    --cc-radius:         14px;
    --cc-radius-sm:      8px;
    --cc-z:              99999;
}

/* --- Overlay (only behind modal) --- */
.cc-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    z-index: calc(var(--cc-z) - 1);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.cc-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================================
   Cookie Banner (bottom-right card)
============================================================ */
.cc-banner {
    position: fixed;
    left: 24px;
    right: 24px;
    bottom: 24px;
    z-index: var(--cc-z);
    background: var(--cc-bg);
    border-radius: var(--cc-radius);
    box-shadow: var(--cc-shadow);
    border: 1px solid var(--cc-border);
    max-width: 480px;
    margin-left: auto;
    transform: translateY(140%);
    opacity: 0;
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
.cc-banner.is-visible {
    transform: translateY(0);
    opacity: 1;
}

.cc-banner__inner {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 22px 22px 20px;
}

.cc-banner__icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--cc-primary-soft);
    color: var(--cc-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.cc-banner__content {
    flex: 1;
}

.cc-banner__title {
    font-size: 18px;
    font-weight: 700;
    color: var(--cc-text);
    margin: 0 0 6px 0;
    line-height: 1.3;
}

.cc-banner__text {
    font-size: 14px;
    line-height: 1.55;
    color: var(--cc-text-muted);
    margin: 0;
}

.cc-banner__text strong {
    color: var(--cc-text);
    font-weight: 600;
}

.cc-link {
    color: var(--cc-primary);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}
.cc-link:hover {
    border-bottom-color: var(--cc-primary);
}

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

/* ============================================================
   Buttons
============================================================ */
.cc-btn {
    appearance: none;
    border: 1px solid transparent;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: var(--cc-radius-sm);
    transition: all 0.2s ease;
    line-height: 1.2;
    white-space: nowrap;
}

.cc-btn--primary {
    background: var(--cc-primary);
    color: #ffffff;
    border-color: var(--cc-primary);
}
.cc-btn--primary:hover {
    background: var(--cc-primary-hover);
    border-color: var(--cc-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(15, 110, 79, 0.25);
}

.cc-btn--secondary {
    background: #ffffff;
    color: var(--cc-text);
    border-color: var(--cc-border);
}
.cc-btn--secondary:hover {
    background: var(--cc-bg-soft);
    border-color: #cbd5e1;
}

.cc-btn--ghost {
    background: transparent;
    color: var(--cc-text);
    border-color: var(--cc-border);
}
.cc-btn--ghost:hover {
    background: var(--cc-bg-soft);
}

.cc-btn--link {
    background: transparent;
    color: var(--cc-primary);
    border: none;
    padding: 10px 6px;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.cc-btn--link:hover {
    color: var(--cc-primary-hover);
}

.cc-btn:focus-visible {
    outline: 3px solid rgba(15, 110, 79, 0.35);
    outline-offset: 2px;
}

/* ============================================================
   Preferences Modal
============================================================ */
.cc-modal {
    position: fixed;
    inset: 0;
    z-index: var(--cc-z);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    pointer-events: none;
}
.cc-modal[hidden] {
    display: none;
}
.cc-modal.is-visible {
    pointer-events: auto;
}

.cc-modal__dialog {
    background: var(--cc-bg);
    border-radius: var(--cc-radius);
    box-shadow: var(--cc-shadow);
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.94) translateY(10px);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
}
.cc-modal.is-visible .cc-modal__dialog {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.cc-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--cc-border);
    background: linear-gradient(135deg, var(--cc-primary) 0%, #1a8d65 100%);
    color: #ffffff;
}

.cc-modal__title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.cc-modal__title-icon {
    color: var(--cc-accent);
    font-size: 18px;
}

.cc-modal__close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.cc-modal__close:hover {
    background: rgba(255, 255, 255, 0.28);
}

.cc-modal__body {
    padding: 20px 22px;
    overflow-y: auto;
    flex: 1;
}

.cc-modal__intro {
    font-size: 14px;
    color: var(--cc-text-muted);
    line-height: 1.55;
    margin: 0 0 16px 0;
}

.cc-modal__note {
    margin: 14px 0 0;
    font-size: 12.5px;
    color: var(--cc-text-muted);
    background: var(--cc-primary-soft);
    padding: 10px 12px;
    border-radius: var(--cc-radius-sm);
    border-left: 3px solid var(--cc-primary);
}
.cc-modal__note i {
    color: var(--cc-primary);
    margin-right: 6px;
}

.cc-modal__footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    padding: 14px 22px;
    border-top: 1px solid var(--cc-border);
    background: var(--cc-bg-soft);
}

/* ============================================================
   Per-category preference rows
============================================================ */
.cc-pref {
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-radius-sm);
    padding: 14px 16px;
    margin-bottom: 12px;
    background: var(--cc-bg);
    transition: box-shadow 0.2s;
}
.cc-pref:hover {
    box-shadow: var(--cc-shadow-soft);
}

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

.cc-pref__title {
    font-size: 15px;
    font-weight: 700;
    color: var(--cc-text);
    margin: 0 0 4px 0;
}

.cc-pref__desc {
    font-size: 13px;
    line-height: 1.5;
    color: var(--cc-text-muted);
    margin: 0;
}

.cc-pref__toggle {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 70px;
}

.cc-pref__status {
    font-size: 11px;
    font-weight: 600;
    color: var(--cc-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.cc-pref__status--always {
    color: var(--cc-primary);
}

/* iOS-style toggle switch */
.cc-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.cc-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.cc-switch__slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 999px;
    transition: background 0.2s;
    cursor: pointer;
}
.cc-switch__slider::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}
.cc-switch input:checked + .cc-switch__slider {
    background: var(--cc-primary);
}
.cc-switch input:checked + .cc-switch__slider::before {
    transform: translateX(20px);
}
.cc-switch input:focus-visible + .cc-switch__slider {
    box-shadow: 0 0 0 3px rgba(15, 110, 79, 0.3);
}
.cc-switch--disabled .cc-switch__slider {
    background: var(--cc-primary);
    opacity: 0.75;
    cursor: not-allowed;
}

/* ============================================================
   Responsive — small screens stack content & full-width modal
============================================================ */
@media (max-width: 600px) {
    .cc-banner {
        left: 12px;
        right: 12px;
        bottom: 12px;
        max-width: none;
    }
    .cc-banner__inner {
        padding: 18px;
    }
    .cc-banner__actions {
        flex-direction: column;
    }
    .cc-banner__actions .cc-btn {
        width: 100%;
        text-align: center;
    }
    .cc-modal__dialog {
        max-height: calc(100vh - 16px);
    }
    .cc-modal__header {
        padding: 14px 16px;
    }
    .cc-modal__body {
        padding: 16px;
    }
    .cc-modal__footer {
        padding: 12px 16px;
        flex-direction: column-reverse;
    }
    .cc-modal__footer .cc-btn {
        width: 100%;
        text-align: center;
    }
    .cc-pref__head {
        flex-direction: column;
        gap: 12px;
    }
    .cc-pref__toggle {
        flex-direction: row;
        align-self: flex-start;
    }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .cc-banner,
    .cc-modal__dialog,
    .cc-overlay,
    .cc-switch__slider,
    .cc-switch__slider::before,
    .cc-btn {
        transition: none !important;
        transform: none !important;
    }
}
