/* public/css/consent.css
   Mobile-first, accessible cookie-consent banner + preferences modal.
   Designed to be small, unobtrusive, and compliant with UK/EU 2026 rules:
   reject button is as prominent as accept, categories are granular, and
   all controls are full-size on touch devices.
   ========================================================================= */

:root {
    --cc-bg:         #ffffff;
    --cc-fg:         #111827;
    --cc-muted:      #4b5563;
    --cc-border:     #e5e7eb;
    --cc-accent:     #2563eb;
    --cc-accept-bg:  #111827;
    --cc-accept-fg:  #ffffff;
    --cc-reject-bg:  #f3f4f6;
    --cc-reject-fg:  #111827;
    --cc-shadow:     0 -6px 30px rgba(0,0,0,0.12);
    --cc-radius:     8px;
    --cc-z:          9999;
}

.cms-consent-banner {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: var(--cc-z);
    background: var(--cc-bg);
    color: var(--cc-fg);
    border-top: 1px solid var(--cc-border);
    box-shadow: var(--cc-shadow);
    padding: 16px;
    font-family: inherit;
    animation: cc-slide-up .22s ease-out;
}
@keyframes cc-slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

.cms-consent-banner .cc-panel {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
}

.cc-title { margin: 0; font-size: 16px; line-height: 1.3; font-weight: 600; }
.cc-body  { margin: 0; font-size: 14px; line-height: 1.5; color: var(--cc-muted); }
.cc-policy-links a { color: var(--cc-accent); }
.cc-policy-links a:hover { text-decoration: underline; }

.cc-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.cc-btn {
    appearance: none;
    border: 1px solid var(--cc-border);
    background: var(--cc-bg);
    color: var(--cc-fg);
    padding: 0 18px;
    border-radius: 6px;
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    height: 44px;                  /* uniform height = visual parity */
    min-width: 140px;              /* same footprint, no jitter */
    white-space: nowrap;           /* stop long labels wrapping */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: filter .12s, border-color .12s;
}
.cc-btn:hover  { border-color: var(--cc-accent); }
.cc-btn:focus-visible { outline: 2px solid var(--cc-accent); outline-offset: 2px; }

.cc-accept { background: var(--cc-accept-bg); color: var(--cc-accept-fg); border-color: var(--cc-accept-bg); }
.cc-accept:hover { filter: brightness(1.12); }

/* Reject must be equally prominent as accept (UK ICO 2026 guidance).
   Same size, same weight, same height — only the fill colour differs. */
.cc-reject { background: var(--cc-reject-bg); color: var(--cc-reject-fg); }
.cc-save   { background: var(--cc-accept-bg); color: var(--cc-accept-fg); border-color: var(--cc-accept-bg); }

/* Desktop: text on the left, buttons on the right, all inline */
@media (min-width: 720px) {
    .cms-consent-banner .cc-panel {
        flex-direction: row;
        align-items: center;
        gap: 20px;
    }
    .cc-text-block { flex: 1; min-width: 0; }
    .cc-actions {
        flex-wrap: nowrap;
        justify-content: flex-end;
        flex-shrink: 0;
    }
}

/* Tight phones: let actions wrap to two rows if needed but keep equal sizing */
@media (max-width: 420px) {
    .cc-btn { min-width: 0; flex: 1 1 auto; padding: 0 12px; }
}

/* ------------------------------------------------------------ preferences modal */
.cms-consent-dialog {
    position: fixed; inset: 0;
    z-index: var(--cc-z);
    display: flex; align-items: flex-end; justify-content: center;
    padding: 0;
}
.cc-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.45); }
.cc-modal {
    position: relative;
    background: var(--cc-bg);
    color: var(--cc-fg);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px;
    border-radius: var(--cc-radius) var(--cc-radius) 0 0;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.25);
    animation: cc-slide-up .22s ease-out;
}

@media (min-width: 720px) {
    .cms-consent-dialog { align-items: center; padding: 20px; }
    .cc-modal { border-radius: var(--cc-radius); }
}

.cc-categories { display: flex; flex-direction: column; gap: 10px; margin: 14px 0 18px; }
.cc-cat {
    border: 1px solid var(--cc-border);
    border-radius: 6px;
    padding: 12px;
    display: block;
    background: #fcfcfd;
}
.cc-cat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.cc-cat-head strong { font-size: 14px; }
.cc-cat-desc { margin: 4px 0 0; font-size: 13px; color: var(--cc-muted); line-height: 1.4; }

/* Big, obvious toggle */
.cc-toggle {
    appearance: none;
    -webkit-appearance: none;
    width: 42px; height: 24px;
    background: #d1d5db;
    border-radius: 999px;
    position: relative;
    cursor: pointer;
    transition: background .15s;
    flex-shrink: 0;
}
.cc-toggle::before {
    content: "";
    position: absolute;
    top: 3px; left: 3px;
    width: 18px; height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform .15s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.cc-toggle:checked           { background: var(--cc-accent); }
.cc-toggle:checked::before   { transform: translateX(18px); }
.cc-toggle:disabled          { opacity: 0.55; cursor: not-allowed; }

/* Dark-mode friendly fallback */
@media (prefers-color-scheme: dark) {
    :root {
        --cc-bg: #1f2937;
        --cc-fg: #f3f4f6;
        --cc-muted: #9ca3af;
        --cc-border: #374151;
        --cc-reject-bg: #374151;
        --cc-reject-fg: #f3f4f6;
        --cc-accept-bg: #3b82f6;
        --cc-accept-fg: #ffffff;
    }
    .cc-cat { background: #111827; }
}

/* "Cookie preferences" link in the footer — subtle */
.cc-prefs-link {
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
}
