/* ==========================================================================
   InSono — Cookie-Einwilligung (storefront/layout/cookie-banner.html)

   A card in the middle of the screen (a sheet from the bottom on a phone),
   above the floating Trustpilot and WhatsApp badges and the header — the
   choice has to be seen to be made. A dialog from the first step on: the
   page behind is dimmed and waits for the answer.
   ========================================================================== */

.cookie-banner {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(30, 33, 29, 0.45);
    overflow-y: auto;
}

.cookie-banner[hidden],
.cookie-banner__panel[hidden] {
    display: none;
}

.cookie-banner__panel {
    width: 100%;
    margin: 0;
    max-width: 560px;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
    color: var(--text);
}

.cookie-banner__panel--settings {
    max-width: 680px;
}

.cookie-banner__title {
    margin-bottom: 12px;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.cookie-banner__text {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.cookie-banner__text + .cookie-banner__text {
    margin-top: 8px;
}

.cookie-banner__text a {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ---- Buttons --------------------------------------------------------------- */

.cookie-banner__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.cookie-banner__actions .btn {
    min-height: 46px;
    font-size: 15px;
}

/* Refusing and agreeing: the same weight, the same width. */
.cookie-banner__choice {
    flex: 1 1 140px;
}

.cookie-banner__settings-link {
    flex: 1 1 100%;
    order: 3;
    min-height: 40px !important;
    padding: 0 12px;
    background: transparent;
    color: var(--text);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cookie-banner__settings-link:hover {
    transform: none;
    color: var(--header-accent);
}

.cookie-banner__actions--settings {
    justify-content: flex-end;
}

.cookie-banner__actions--settings [data-cookie-back] {
    margin-right: auto;
}

/* ---- Purposes -------------------------------------------------------------- */

.cookie-banner__purposes {
    display: grid;
    margin-top: 18px;
    padding: 0;
    list-style: none;
}

.cookie-banner__purpose {
    padding: 16px 0;
    border-top: 1px solid var(--line);
}

.cookie-banner__purpose:last-child {
    border-bottom: 1px solid var(--line);
}

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

.cookie-banner__purpose-title {
    font-size: 15px;
    font-weight: 700;
}

.cookie-banner__purpose-text {
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.cookie-banner__provider {
    margin-top: 6px;
    color: var(--soft);
    font-size: 12px;
    line-height: 1.5;
}

.cookie-banner__always {
    color: var(--success);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

/* A switch that is a real checkbox underneath — keyboard and screen
   readers get a checkbox, the eye gets a toggle. */
.cookie-banner__switch {
    position: relative;
    display: inline-flex;
    flex: none;
    cursor: pointer;
}

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

.cookie-banner__switch-track {
    position: relative;
    width: 46px;
    height: 26px;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    box-shadow: inset 0 0 0 1px var(--line-strong);
    transition: background var(--transition-fast);
}

.cookie-banner__switch-track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--white);
    box-shadow: 0 1px 3px rgba(30, 33, 29, 0.25);
    transition: transform var(--transition-fast);
}

.cookie-banner__switch input:checked + .cookie-banner__switch-track {
    background: var(--accent);
}

.cookie-banner__switch input:checked + .cookie-banner__switch-track::after {
    transform: translateX(20px);
}

.cookie-banner__switch input:focus-visible + .cookie-banner__switch-track {
    outline: 2px solid var(--header-accent);
    outline-offset: 2px;
}

/* ---- Phone: a sheet from the bottom ---------------------------------------- */

@media (max-width: 749px) {
    .cookie-banner {
        place-items: end stretch;
        padding: 0;
    }

    .cookie-banner__panel {
        max-width: none;
        max-height: 88vh;
        max-height: 88dvh;
        padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        border-bottom: 0;
    }

    .cookie-banner__title {
        font-size: 17px;
    }

    .cookie-banner__actions--settings .btn {
        flex: 1 1 100%;
    }

    .cookie-banner__actions--settings [data-cookie-back] {
        order: 4;
        margin-right: 0;
    }
}

/* The page behind the dialog stays where it is. */
html.has-cookie-dialog,
html.has-cookie-dialog body {
    overflow: hidden;
}

/* The title only takes focus so the keyboard starts inside the dialog. */
.cookie-banner__title:focus {
    outline: none;
}
