/**
 * WaterInnovations — GDPR Banner Override
 *
 * Replaces the hounddd/gdprplus full-screen modal with a compact
 * dark corner popup inspired by claude.ai's cookie consent design.
 *
 * Position (bottom-left / bottom-right) is set via Settings > GDPR Banner
 * in the backend. The class `gdpr-bannerwide--bottom-left` or
 * `gdpr-bannerwide--bottom-right` is added to the container by the theme
 * override, driven by the GdprSettings model in WaterInnovations.System.
 *
 * Mobile: full-width strip pinned to the bottom edge.
 */

/* ─── Kill the full-screen overlay behaviour ─────────────────────────────── */
:root:has(.gdpr-bannerwide__card) {
    overflow: auto !important;
}

/* ─── Outer container: fixed corner anchor, no backdrop ──────────────────── */
.gdpr-bannerwide {
    position: fixed !important;
    inset: auto !important;
    top: auto !important;
    bottom: 1.5rem !important;
    width: 400px !important;
    max-width: calc(100vw - 3rem) !important;
    display: block !important;
    background: transparent !important;
    z-index: 1080 !important;
    align-items: unset !important;
    justify-content: unset !important;
}

.gdpr-bannerwide--bottom-left  { left: 1.5rem !important; right: auto !important; }
.gdpr-bannerwide--bottom-right { right: 1.5rem !important; left: auto !important; }

/* ─── Dark card ──────────────────────────────────────────────────────────── */
.gdpr-bannerwide__card {
    background: #1a1a1a;
    color: #fff;
    border-radius: 0.875rem;
    padding: 1.25rem 1.25rem 1rem;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    max-height: 85vh;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.08);
}

/* ─── Title ──────────────────────────────────────────────────────────────── */
.gdpr-bannerwide__title {
    font-size: 1rem !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    color: #fff !important;
    padding-left: 0 !important;
}

/* ─── Message body ───────────────────────────────────────────────────────── */
.gdpr-bannerwide__message {
    font-size: 0.82rem !important;
    line-height: 1.55 !important;
    color: rgba(255,255,255,0.72) !important;
    margin: 0 !important;
}

.gdpr-bannerwide__policy-link {
    color: rgba(255,255,255,0.9) !important;
    text-decoration: underline !important;
    text-underline-offset: 2px;
}

/* ─── Action buttons ─────────────────────────────────────────────────────── */
.gdpr-bannerwide__actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gdpr-bannerwide__actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.gdpr-bannerwide__btn {
    display: block;
    width: 100%;
    padding: 0.6rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.82rem;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    text-decoration: none !important;
    border: 1px solid rgba(255,255,255,0.18);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    line-height: 1.4;
    font-family: inherit;
}

/* Customise — full width, lighter border */
.gdpr-bannerwide__btn--customize {
    background: transparent;
    color: rgba(255,255,255,0.85) !important;
    border-color: rgba(255,255,255,0.2);
}
.gdpr-bannerwide__btn--customize:hover {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.35);
}

/* Reject All */
.gdpr-bannerwide__btn--decline {
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.8) !important;
    border-color: rgba(255,255,255,0.15);
}
.gdpr-bannerwide__btn--decline:hover {
    background: rgba(255,255,255,0.13);
}

/* Accept All — slightly brighter */
.gdpr-bannerwide__btn--accept {
    background: rgba(255,255,255,0.14);
    color: #fff !important;
    border-color: rgba(255,255,255,0.25);
}
.gdpr-bannerwide__btn--accept:hover {
    background: rgba(255,255,255,0.22);
}

/* ─── Mobile: full-width bottom strip ───────────────────────────────────── */
@media (max-width: 576px) {
    .gdpr-bannerwide,
    .gdpr-bannerwide--bottom-left,
    .gdpr-bannerwide--bottom-right {
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .gdpr-bannerwide__card {
        border-radius: 0.875rem 0.875rem 0 0 !important;
        max-height: 70vh !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Cookie Manager Page — wi-cm
   Accordion-style layout, claude.ai-inspired design.
   Used on /cookies (cookieManager component override).
   ═══════════════════════════════════════════════════════════════════════════ */

[x-cloak] { display: none !important; }

/* ─── Group card ─────────────────────────────────────────────────────────── */
.wi-cm__group {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    background: #fff;
    overflow: hidden;
}

.wi-cm__group-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.25rem 1.25rem 1.25rem 1.5rem;
    gap: 1rem;
}

.wi-cm__group-info { flex: 1; min-width: 0; }

.wi-cm__group-name-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.wi-cm__group-name {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
    color: #1a1a1a;
}

.wi-cm__always-active {
    font-size: 0.72rem;
    font-weight: 500;
    color: #198754;
    background: rgba(25, 135, 84, 0.1);
    padding: 0.125rem 0.55rem;
    border-radius: 9999px;
    white-space: nowrap;
}

.wi-cm__group-desc {
    font-size: 0.875rem;
    color: #6c757d;
    margin: 0;
    line-height: 1.55;
}

/* ─── Group controls (toggle + chevron) ─────────────────────────────────── */
.wi-cm__group-controls {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-shrink: 0;
    padding-top: 0.125rem;
}

/* Toggle button (iOS-style switch) */
.wi-cm__toggle-btn {
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.15);
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    padding: 0;
    flex-shrink: 0;
}

.wi-cm__toggle-btn--on {
    background: #0d6efd;
}

.wi-cm__toggle-knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s;
    display: block;
    pointer-events: none;
}

.wi-cm__toggle-btn--on .wi-cm__toggle-knob {
    transform: translateX(20px);
}

/* Expand / collapse button */
.wi-cm__expand-btn {
    background: none;
    border: none;
    padding: 0.25rem 0.375rem;
    cursor: pointer;
    color: #6c757d;
    border-radius: 0.375rem;
    transition: background 0.15s;
    line-height: 1;
    display: flex;
    align-items: center;
}

.wi-cm__expand-btn:hover { background: rgba(0, 0, 0, 0.06); }

.wi-cm__chevron {
    display: inline-block;
    font-size: 1.4rem;
    line-height: 1;
    transition: transform 0.2s;
    transform: rotate(90deg);
    color: #6c757d;
}

.wi-cm__chevron--open { transform: rotate(-90deg); }

/* ─── Expandable cookies section ─────────────────────────────────────────── */
.wi-cm__cookies {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    padding: 0.5rem 1.5rem 1rem;
    background: #f8f9fa;
}

.wi-cm__cookie {
    padding: 0.875rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.wi-cm__cookie:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.wi-cm__cookie-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: #212529;
    margin-bottom: 0.25rem;
}

.wi-cm__cookie-desc {
    font-size: 0.825rem;
    color: #6c757d;
    line-height: 1.5;
    margin-bottom: 0.4rem;
}

.wi-cm__cookie-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem 1rem;
    font-size: 0.775rem;
    color: #6c757d;
}

.wi-cm__meta-label {
    font-weight: 500;
    color: #495057;
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.wi-cm__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.25rem 0 0.25rem;
}

.wi-cm__expiry-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #6c757d;
}

.wi-cm__expiry-label { white-space: nowrap; }

.wi-cm__expiry-select {
    padding: 0.375rem 0.625rem;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    background: #fff;
    cursor: pointer;
    color: #212529;
}

.wi-cm__save-btn {
    padding: 0.625rem 1.75rem;
    background: #0d6efd;
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.wi-cm__save-btn:hover { background: #0b5ed7; }

/* ─── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 576px) {
    .wi-cm__group-header { padding: 1rem; }
    .wi-cm__cookies { padding: 0.5rem 1rem 0.875rem; }

    .wi-cm__footer {
        flex-direction: column;
        align-items: stretch;
    }

    .wi-cm__save-btn { text-align: center; }
}
