/* ════════════════════════════════════════════════════
   AHQONE — GDPR Cookie Consent Banner
   Design: Ivory Luxe palette, gold accents
   Fully accessible (focus trap, ARIA roles, keyboard nav)
════════════════════════════════════════════════════ */

/* ── Banner wrapper ── */
#ahq-cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: #ffffff;
    border-top: 2px solid #d4af37;
    box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.10);
    padding: clamp(1rem, 2.5vw, 1.5rem) clamp(1rem, 4vw, 2.5rem);
    font-family: 'DM Sans', -apple-system, sans-serif;
    font-size: 0.875rem;
    line-height: 1.55;
    color: #2c2c2c;
    max-height: 90vh;
    overflow-y: auto;
    /* Slide up animation — opacity only to avoid CLS from transform */
    animation: none;
}

#ahq-cookie-banner.ahq-cb--hidden,
#ahq-cookie-banner.ahq-cb--pending {
    display: none;
}

#ahq-cookie-banner.ahq-cb--closing {
    animation: ahq-cb-fadeout 0.2s ease both;
}

@keyframes ahq-cb-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes ahq-cb-fadeout {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* ── Max-width wrapper ── */
.ahq-cb-main,
.ahq-cb-prefs {
    max-width: 1200px;
    margin: 0 auto;
}

/* ── Main row ── */
.ahq-cb-main {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

/* ── Text block ── */
.ahq-cb-text { flex: 1; min-width: 220px; }

.ahq-cb-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    color: #1a1208;
    margin: 0 0 0.3rem;
}

.ahq-cb-title svg {
    color: #d4af37;
    flex-shrink: 0;
}

.ahq-cb-desc {
    margin: 0;
    color: #4a4a4a;
    font-size: 0.82rem;
}

.ahq-cb-link {
    color: #6B5018;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.ahq-cb-link:hover { color: #4d3a12; }

/* ── Button group ── */
.ahq-cb-actions {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* ── Buttons — GDPR requires equal prominence for Accept/Reject ── */
.ahq-cb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 1.1rem;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.12s;
    text-decoration: none;
    border: 1.5px solid transparent;
    line-height: 1;
}
.ahq-cb-btn:focus-visible {
    outline: 2px solid #d4af37;
    outline-offset: 2px;
}
.ahq-cb-btn:active { transform: scale(0.97); }

/* Primary — Accept All */
.ahq-cb-btn--primary {
    background: #d4af37;
    border-color: #d4af37;
    color: #1a1208;
}
.ahq-cb-btn--primary:hover {
    background: #c9a227;
    border-color: #c9a227;
}

/* Outline — Reject / Manage (same visual weight as primary per ICO guidance) */
.ahq-cb-btn--outline {
    background: transparent;
    border-color: #bfb89a;
    color: #3a3018;
}
.ahq-cb-btn--outline:hover {
    border-color: #d4af37;
    background: rgba(212, 175, 55, 0.07);
    color: #1a1208;
}

/* ── Preferences panel ── */
.ahq-cb-prefs {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e8e2d8;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ahq-cb-prefs[hidden] { display: none; }

/* ── Preference row ── */
.ahq-cb-pref-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 0.875rem 0;
    border-bottom: 1px solid #f0ece4;
}
.ahq-cb-pref-row:last-of-type { border-bottom: none; }

.ahq-cb-pref-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
}

.ahq-cb-pref-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: #1a1208;
}

.ahq-cb-pref-desc {
    font-size: 0.77rem;
    color: #6b6056;
    line-height: 1.5;
    max-width: 560px;
}

/* ── Toggle switch ── */
.ahq-cb-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 42px;
    height: 24px;
    border-radius: 24px;
    border: 1.5px solid #c8c0b0;
    background: #e8e2d8;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s, border-color 0.2s;
    padding: 0;
    /* override button defaults */
    -webkit-appearance: none;
    appearance: none;
}

.ahq-cb-toggle:focus-visible {
    outline: 2px solid #d4af37;
    outline-offset: 2px;
}

.ahq-cb-toggle-thumb {
    position: absolute;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
    transition: left 0.18s cubic-bezier(0.4,0,0.2,1);
    pointer-events: none;
}

/* Checked (on) state */
.ahq-cb-toggle[aria-checked="true"],
.ahq-cb-toggle--on {
    background: #d4af37;
    border-color: #d4af37;
}
.ahq-cb-toggle[aria-checked="true"] .ahq-cb-toggle-thumb {
    left: calc(100% - 19px);
}

/* Locked (always-on) state */
.ahq-cb-toggle--locked {
    cursor: not-allowed;
    opacity: 0.6;
}
.ahq-cb-toggle--on .ahq-cb-toggle-thumb {
    left: calc(100% - 19px);
}

/* ── Preferences footer ── */
.ahq-cb-prefs-footer {
    padding-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

/* ── Cookie settings re-open button (in footer) ── */
.ahq-cb-settings-btn {
    background: none;
    border: none;
    padding: 0;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--ahq-text-muted, #888);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s;
}
.ahq-cb-settings-btn:hover { color: #d4af37; }

/* ── Responsive ── */
@media (max-width: 680px) {
    .ahq-cb-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .ahq-cb-actions {
        width: 100%;
    }
    .ahq-cb-btn {
        flex: 1;
        text-align: center;
        justify-content: center;
    }
    .ahq-cb-pref-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    .ahq-cb-toggle {
        align-self: flex-end;
    }
}
