/* ============================================================
   W27 – Cookie Consent Banner
   ============================================================ */

/* ── Overlay ── */
.cb-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 9998;
    opacity: 0;
    transition: opacity .3s ease;
    pointer-events: none;
}
#cookie-banner.cb-visible .cb-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* ── Box ── */
.cb-box {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    width: min(640px, calc(100vw - 2rem));
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    z-index: 9999;
    overflow: hidden;
    transition: transform .35s cubic-bezier(.4,0,.2,1);
    max-height: 90vh;
    overflow-y: auto;
}
#cookie-banner.cb-visible .cb-box {
    transform: translateX(-50%) translateY(0);
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    .cb-box {
        background: #1a1a2e;
        color: #e0e0e0;
        box-shadow: 0 20px 60px rgba(0,0,0,.5);
    }
    .cb-category { border-color: rgba(255,255,255,.08); }
    .cb-cookie-table th { background: rgba(255,255,255,.05); }
    .cb-details summary { color: #aaa; }
}

/* ── Header ── */
.cb-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.25rem 1.5rem .75rem;
    border-bottom: 1px solid #f0f0f0;
}
.cb-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: inherit;
}
.cb-back-btn {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    line-height: 1;
}
.cb-back-btn:hover { color: #E94560; }

/* ── Body ── */
.cb-body {
    padding: 1.25rem 1.5rem;
}
.cb-intro {
    font-size: .9rem;
    color: #555;
    line-height: 1.6;
    margin-bottom: 1rem;
}
@media (prefers-color-scheme: dark) {
    .cb-intro { color: #aaa; }
}

/* ── Quick category badges ── */
.cb-quick-cats {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: .5rem;
}
.cb-cat-badge {
    display: inline-block;
    padding: .25rem .7rem;
    background: #f3f4f6;
    border-radius: 100px;
    font-size: .75rem;
    font-weight: 500;
    color: #666;
}
.cb-cat-active {
    background: rgba(74,222,128,.15);
    color: #059669;
}

/* ── Actions ── */
.cb-actions {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    padding: .75rem 1.5rem 1rem;
    border-top: 1px solid #f0f0f0;
}
.cb-btn {
    flex: 1;
    min-width: 120px;
    padding: .65rem 1rem;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all .2s;
    white-space: nowrap;
}
.cb-btn-settings {
    background: #f3f4f6;
    color: #374151;
}
.cb-btn-settings:hover { background: #e5e7eb; }
.cb-btn-reject {
    background: #f3f4f6;
    color: #374151;
}
.cb-btn-reject:hover { background: #e5e7eb; }
.cb-btn-accept {
    background: #E94560;
    color: #fff;
}
.cb-btn-accept:hover { background: #c73652; }

/* ── Legal ── */
.cb-legal {
    text-align: center;
    font-size: .75rem;
    color: #999;
    padding: 0 1.5rem .75rem;
    margin: 0;
}
.cb-legal a { color: #E94560; text-decoration: none; }
.cb-legal a:hover { text-decoration: underline; }

/* ── Settings ── */
.cb-settings-body {
    padding-top: .5rem;
}
.cb-category {
    border-bottom: 1px solid #f0f0f0;
    padding: 1rem 0;
}
.cb-category:last-child { border-bottom: none; }
.cb-cat-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}
.cb-cat-info { flex: 1; }
.cb-cat-name {
    font-size: .95rem;
    font-weight: 700;
    margin: 0 0 .25rem;
    color: inherit;
}
.cb-cat-desc {
    font-size: .8rem;
    color: #666;
    line-height: 1.5;
    margin: 0;
}
@media (prefers-color-scheme: dark) {
    .cb-cat-desc { color: #aaa; }
}

/* Toggle Switch */
.cb-toggle-switch {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
    cursor: pointer;
    flex-shrink: 0;
}
.cb-checkbox {
    position: absolute;
    opacity: 0;
    width: 0; height: 0;
}
.cb-slider {
    display: block;
    width: 44px;
    height: 24px;
    background: #d1d5db;
    border-radius: 100px;
    position: relative;
    transition: background .2s;
}
.cb-slider::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 18px; height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.cb-checkbox:checked + .cb-slider {
    background: #E94560;
}
.cb-checkbox:checked + .cb-slider::after {
    transform: translateX(20px);
}
.cb-checkbox:focus-visible + .cb-slider {
    outline: 2px solid #E94560;
    outline-offset: 2px;
}

/* Always-active indicator */
.cb-toggle-disabled {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
    flex-shrink: 0;
}
.cb-toggle-label {
    font-size: .7rem;
    color: #059669;
    font-weight: 600;
    white-space: nowrap;
}

/* Details / Cookie table */
.cb-details {
    margin-top: .75rem;
}
.cb-details summary {
    font-size: .8rem;
    color: #888;
    cursor: pointer;
    user-select: none;
    padding: .25rem 0;
}
.cb-details summary:hover { color: #E94560; }
.cb-cookie-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .78rem;
    margin-top: .5rem;
}
.cb-cookie-table th {
    background: #f9fafb;
    padding: .35rem .5rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
}
.cb-cookie-table td {
    padding: .35rem .5rem;
    border-bottom: 1px solid #f0f0f0;
    color: #555;
}
.cb-cookie-table a { color: #E94560; }

/* ── Responsive ── */
@media (max-width: 480px) {
    .cb-box { bottom: 0; border-radius: 16px 16px 0 0; width: 100%; }
    .cb-actions { flex-direction: column; }
    .cb-btn { flex: none; width: 100%; }
}

/* ── Body lock ── */
body.cb-open { overflow: hidden; }
