/* ============================================================
   COOKIE CONSENT — banner (first layer) + preference centre
   Prefix: .cookie-
   Loaded from base.html on every page.

   The single most important rule in this file: every button that
   decides consent shares ONE class, .cookie-btn--equal, with no
   per-button colour, size or weight overrides. Making "Приемам"
   more inviting than "Отказвам" is a dark pattern and a GDPR
   finding, so the styling makes that impossible by construction.
   ============================================================ */

.cookie-banner[hidden],
.cookie-modal[hidden] {
    display: none !important;
}

/* ── First layer: banner ───────────────────────────────────── */

.cookie-banner {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 9998;
    background: #FFFFFF;
    color: var(--c-text-body);
    border: 1px solid rgba(28, 27, 23, .18);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .28);
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.5;
}

.cookie-banner__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 24px;
    max-width: var(--container-max);
    margin: 0 auto;
}

.cookie-banner__text {
    flex: 1 1 380px;
    min-width: 0;
}

.cookie-banner__title {
    margin: 0 0 6px;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--c-text-dark);
}

.cookie-banner__text p {
    margin: 0;
}

.cookie-banner__text a,
.cookie-modal__foot a {
    color: inherit;
    text-decoration: underline;
}

.cookie-banner__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    flex: 0 0 auto;
}

/* ── Buttons ───────────────────────────────────────────────── */

.cookie-btn {
    font-family: var(--font-ui);
    font-size: 14px;
    cursor: pointer;
    border-radius: 6px;
}

/*
   Equal-weight consent buttons.

   Identical background, border, text colour, padding, font size and
   font weight. Do not add .cookie-btn--equal:nth-child() rules, an
   --accept modifier, or a brand gradient here: the visual parity IS
   the compliance requirement.
*/
.cookie-btn--equal {
    min-width: 150px;
    padding: 12px 20px;
    background: var(--c-footer-dark);
    color: var(--c-text-white);
    border: 2px solid var(--c-footer-dark);
    font-weight: 600;
    text-align: center;
}

.cookie-btn--equal:hover {
    background: #2f2e29;
    border-color: #2f2e29;
}

.cookie-btn--equal:focus-visible,
.cookie-btn--link:focus-visible,
.cookie-switch input:focus-visible + .cookie-switch__ui {
    outline: 3px solid var(--c-primary-start);
    outline-offset: 2px;
}

.cookie-btn--link {
    padding: 8px 4px;
    background: none;
    border: 0;
    color: inherit;
    text-decoration: underline;
}

/* ── Second layer: preference centre ───────────────────────── */

.cookie-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-family: var(--font-ui);
}

.cookie-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .55);
}

.cookie-modal__panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 640px;
    max-height: 86vh;
    overflow-y: auto;
    background: #FFFFFF;
    color: var(--c-text-body);
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .4);
}

.cookie-modal__title {
    margin: 0 0 8px;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    color: var(--c-text-dark);
}

.cookie-modal__intro {
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.55;
}

body.cookie-modal-open {
    overflow: hidden;
}

/* ── Category rows ─────────────────────────────────────────── */

.cookie-cat {
    padding: 16px 0;
    border-top: 1px solid rgba(28, 27, 23, .14);
}

.cookie-cat__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.cookie-cat__name {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    color: var(--c-text-dark);
    cursor: pointer;
}

.cookie-cat__fixed {
    font-size: 13px;
    color: var(--c-footer-mid);
    white-space: nowrap;
}

.cookie-cat__desc {
    margin: 6px 0 0;
    font-size: 13.5px;
    line-height: 1.55;
    /* Full-contrast body colour: greying out the explanation to make
       the toggle the only thing you read is a dark pattern. */
    color: var(--c-text-body);
}

/* ── Toggle ────────────────────────────────────────────────── */

.cookie-switch {
    position: relative;
    flex: 0 0 auto;
    width: 52px;
    height: 28px;
}

.cookie-switch input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.cookie-switch__ui {
    position: absolute;
    inset: 0;
    background: #BDBDBD;
    border-radius: 999px;
    transition: background .15s ease;
}

.cookie-switch__ui::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: #FFFFFF;
    border-radius: 50%;
    transition: transform .15s ease;
}

.cookie-switch input:checked + .cookie-switch__ui {
    background: #2E7D32;
}

.cookie-switch input:checked + .cookie-switch__ui::after {
    transform: translateX(24px);
}

/* ── Modal actions ─────────────────────────────────────────── */

.cookie-modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.cookie-modal__actions .cookie-btn--equal {
    flex: 1 1 160px;
}

.cookie-modal__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    font-size: 13px;
}

/* ── Responsive (desktop-first, matching the site's breakpoints) ── */

@media (max-width: 768px) {
    .cookie-banner {
        left: 10px;
        right: 10px;
        bottom: 10px;
        max-height: 80vh;
        overflow-y: auto;
    }

    .cookie-banner__inner {
        padding: 18px;
        gap: 14px;
    }

    .cookie-banner__actions {
        width: 100%;
    }

    /* Stacked, but still identical to each other. */
    .cookie-banner__actions .cookie-btn--equal {
        flex: 1 1 100%;
    }

    .cookie-modal__panel {
        padding: 22px 18px;
    }
}
