/**
 * Cookie consent banner + preferences modal (2026-08-26). Plain CSS,
 * not Tailwind utilities - same "no Tailwind build in this child
 * theme" reasoning used everywhere else in this project. Buttons reuse
 * Hyva's own compiled .btn/.btn-primary/.btn-secondary classes so the
 * CMP looks identical to every other button on Peren.
 */

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

/* ── Layer 1: banner ── */

.peren-cc-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9998;
    background: #ffffff;
    border-top: 1px solid #E5E5E5;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
    padding: 20px 24px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
}

.peren-cc-banner__body {
    flex: 1 1 380px;
    min-width: 0;
}

.peren-cc-banner__title {
    font-size: 16px;
    font-weight: 700;
    color: #1E1E1E;
    margin: 0 0 6px;
}

.peren-cc-banner__text {
    font-size: 14px;
    line-height: 1.5;
    color: #4B5563;
    margin: 0 0 6px;
}

.peren-cc-banner__link {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary, #14646E);
    text-decoration: underline;
}

.peren-cc-banner__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    flex-shrink: 0;
}

.peren-cc-btn {
    white-space: nowrap;
}

/*
 * 2026-09-29: on a phone this used to take 85vh - three full-width
 * stacked buttons under the full policy text - so the first thing a
 * visitor saw was a consent notice covering the page they came for,
 * with the buyback wizard entirely hidden behind it. Reshaped into the
 * compact bottom sheet a native app would use: capped at 60vh, the two
 * secondary choices share one row, and the primary action sits alone
 * where a thumb reaches it.
 */
@media (max-width: 640px) {
    /*
     * 2026-09-30, raportat: "trebuie sa dai scroll spre dreapta ca sa poti
     * da accept sau refuz". Regula de desktop de mai sus pune
     * flex-wrap: wrap, iar aici, in coloana cu max-height, wrap-ul
     * inseamna ca atunci cand textul trece de 60vh flexbox deschide o A
     * DOUA COLOANA, la dreapta, si muta butoanele in ea. Masurat pe 360px:
     * butoanele incepeau la x=356, adica exact dupa coloana de text
     * (16 + 328 + 12). Pe 390x844, unde a fost testat intai, textul incapea
     * si nu se vedea nimic.
     *
     * Acum: fara wrap, fara derulare laterala, iar ce e prea lung derulaza
     * in interiorul textului, nu al intregului banner - butoanele raman
     * mereu jos, vizibile, oricat de scund e ecranul. Asa arata foaia de
     * jos intr-o aplicatie.
     */
    .peren-cc-banner {
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
        max-height: 70vh;
        overflow: hidden;
        border-radius: 16px 16px 0 0;
        gap: 12px;
    }

    .peren-cc-banner__body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .peren-cc-banner__actions {
        flex: 0 0 auto;
    }

    .peren-cc-banner__text {
        font-size: 13px;
    }

    /*
     * Reject and Customize side by side, Accept full width below them.
     * Equal-width secondaries keep the two "not now" choices visually
     * equivalent - neither is nudged.
     */
    /*
     * minmax(0, 1fr), nu 1fr: un 1fr simplu nu coboara sub latimea
     * continutului, asa ca un buton cu text lung impingea grila in afara
     * ecranului. Masurat cu fontul marit la 150% din setarile telefonului
     * (des folosit): "Personalizeaza" nu mai incapea pe jumatate de ecran si
     * bannerul capata derulare laterala.
     */
    .peren-cc-banner__actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 8px;
    }

    .peren-cc-banner__actions .peren-cc-btn:last-child {
        grid-column: 1 / -1;
    }

    .peren-cc-btn {
        width: 100%;
        /* 48px: comfortably above the 44px minimum touch target. */
        min-height: 48px;
        /* Pe desktop textul ramane pe un rand; pe telefon, cu font marit,
           se rupe pe doua in loc sa iasa din ecran. */
        white-space: normal;
        line-height: 1.2;
        /* Un cuvant se rupe doar daca nu incape deloc pe rand, si atunci in
           silabe, cu cratima, unde browserul are despartire pentru romana -
           nu "Personaliz / eaza". */
        overflow-wrap: break-word;
        hyphens: auto;
        -webkit-hyphens: auto;
    }
}

.peren-cc-transition {
    transition: opacity 250ms ease, transform 250ms ease;
}

.peren-cc-enter-start {
    opacity: 0;
    transform: translateY(16px);
}

.peren-cc-enter-end {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .peren-cc-transition {
        transition: none;
    }
}

/* ── Layer 2: preferences modal ── */

.peren-cc-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.peren-cc-overlay__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(30, 30, 30, 0.5);
}

.peren-cc-modal {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.peren-cc-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 12px;
    border-bottom: 1px solid #F0F0EE;
}

.peren-cc-modal__title {
    font-size: 17px;
    font-weight: 700;
    color: #1E1E1E;
    margin: 0;
}

/* 44px: masura degetului. Iconita ramane la fel, doar zona creste. */
.peren-cc-modal__close {
    width: 44px;
    height: 44px;
    margin: -8px -8px -8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: #6B7280;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
    flex-shrink: 0;
}

.peren-cc-modal__close:hover {
    color: #1E1E1E;
    background: #F3F4F6;
}

.peren-cc-modal__close:focus-visible,
.peren-cc-toggle:focus-visible,
.peren-cc-btn:focus-visible {
    outline: 2px solid var(--color-primary, #14646E);
    outline-offset: 2px;
}

.peren-cc-modal__body {
    padding: 12px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.peren-cc-category {
    padding-bottom: 16px;
    border-bottom: 1px solid #F0F0EE;
}

.peren-cc-category:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.peren-cc-category__row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.peren-cc-category__icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: rgba(20, 100, 110, 0.08);
    color: var(--color-primary, #14646E);
    display: flex;
    align-items: center;
    justify-content: center;
}

.peren-cc-category__text {
    flex: 1;
    min-width: 0;
}

.peren-cc-category__title {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #1E1E1E;
    margin: 0 0 4px;
    cursor: pointer;
}

.peren-cc-category__desc {
    font-size: 13px;
    line-height: 1.5;
    color: #6B7280;
    margin: 0;
}

.peren-cc-category__always {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #9CA3AF;
    margin: 8px 0 0 46px;
}

/* Toggle switch */

.peren-cc-toggle {
    flex-shrink: 0;
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    border-radius: 999px;
}

.peren-cc-toggle--locked {
    cursor: default;
}

.peren-cc-toggle__track {
    display: block;
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: #D9D9D9;
    position: relative;
    transition: background-color 150ms ease;
}

.peren-cc-toggle__track--on {
    background: var(--color-primary, #14646E);
}

.peren-cc-toggle__thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 150ms ease;
}

.peren-cc-toggle__track--on .peren-cc-toggle__thumb {
    transform: translateX(18px);
}

@media (prefers-reduced-motion: reduce) {
    .peren-cc-toggle__track,
    .peren-cc-toggle__thumb {
        transition: none;
    }
}

.peren-cc-modal__footer {
    display: flex;
    gap: 10px;
    padding: 16px 20px 20px;
    border-top: 1px solid #F0F0EE;
}

.peren-cc-modal__footer .peren-cc-btn {
    flex: 1;
}

@media (max-width: 480px) {
    .peren-cc-modal {
        max-width: none;
    }

    .peren-cc-modal__footer {
        flex-direction: column;
    }

    .peren-cc-modal__footer .peren-cc-btn {
        min-height: 46px;
    }
}
