:root {
    --cookie-ink: #172033;
    --cookie-copy: #536075;
    --cookie-line: #d7dee8;
    --cookie-surface: #ffffff;
}

[hidden] { display: none !important; }

.cookie-consent {
    position: fixed;
    z-index: 2147483000;
    right: 24px;
    bottom: 24px;
    left: 24px;
}

.cookie-consent__card {
    display: grid;
    grid-template-columns: 48px minmax(280px, 1fr) auto 36px;
    align-items: center;
    gap: 14px;
    max-width: 980px;
    margin: 0 auto;
    padding: 14px 18px;
    color: var(--cookie-ink);
    background: var(--cookie-surface);
    border: 1px solid var(--cookie-line);
    border-radius: 16px;
    box-shadow: 0 4px 8px rgba(32, 44, 62, 0.1);
}

.cookie-consent__icon {
    display: grid;
    width: 48px;
    height: 48px;
    color: var(--accent-color);
    background: #f8e7f0;
    border-radius: 50%;
    place-items: center;
}

.cookie-consent__icon svg { width: 32px; height: 32px; }
.cookie-consent__close,
.cookie-preferences__close {
    display: grid;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    padding: 0;
    color: #4c576b;
    background: #f2f4f7;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 28px;
    line-height: 1;
    place-items: center;
}
.cookie-consent__content h2,
.cookie-preferences h2,
.cookie-option h3 { margin: 0; color: var(--cookie-ink); }
.cookie-consent__content h2 { font-size: 15px; font-weight: 750; line-height: 1.3; }
.cookie-consent__content p { margin: 3px 0 7px; color: var(--cookie-copy); font-size: 14px; line-height: 1.35; }
.cookie-consent__content a { color: var(--accent-color); font-size: 14px; font-weight: 650; text-underline-offset: 3px; }

.cookie-consent__actions,
.cookie-preferences__actions { display: flex; align-items: center; gap: 14px; }
.cookie-button {
    min-width: 148px;
    min-height: 42px;
    padding: 9px 20px;
    border: 1px solid var(--cookie-line);
    border-radius: 999px;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
.cookie-button:hover { transform: translateY(-1px); }
.cookie-button:focus-visible,
.cookie-consent__close:focus-visible,
.cookie-preferences__close:focus-visible,
.cookie-switch input:focus-visible + span { outline: 3px solid var(--accent-color); outline-offset: 3px; }
.cookie-button--secondary { color: var(--cookie-ink); background: #fff; }
.cookie-button--secondary:hover { border-color: #afb9c8; background: #f8fafc; }
.cookie-button--primary { color: #fff; background: var(--accent-color); border-color: var(--accent-color); box-shadow: 0 7px 14px color-mix(in srgb, var(--accent-color) 20%, transparent); }
.cookie-button--primary:hover { filter: brightness(.9); }
.cookie-settings-link { display: inline-flex; margin: 0 0 14px; padding: 0; color: var(--accent-color); background: transparent; border: 0; font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.cookie-settings-link:focus-visible { outline: 3px solid var(--accent-color); outline-offset: 3px; }
.cookie-consent__close:hover,
.cookie-preferences__close:hover { background: #e7eaf0; }

.cookie-preferences { position: fixed; z-index: 2147483001; inset: 0; display: grid; place-items: center; padding: 24px; }
.cookie-preferences__backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.48); backdrop-filter: blur(3px); }
.cookie-preferences__dialog { position: relative; width: min(100%, 620px); max-height: min(760px, calc(100dvh - 48px)); overflow: auto; padding: 30px 30px 36px; color: var(--cookie-copy); background: #fff; border-radius: 20px; box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28); }
.cookie-preferences__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.cookie-preferences__eyebrow { margin: 0 0 6px; color: var(--accent-color); font-size: 11px; font-weight: 800; letter-spacing: .11em; }
.cookie-preferences h2 { font-size: 24px; line-height: 1.2; }
.cookie-preferences__intro { margin: 14px 0 22px; font-size: 15px; line-height: 1.5; }
.cookie-preferences__options { border-top: 1px solid #e7ebf1; }
.cookie-option { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px 0; border-bottom: 1px solid #e7ebf1; }
.cookie-option h3 { font-size: 16px; line-height: 1.35; }
.cookie-option h3 span { display: inline-block; margin-left: 7px; padding: 3px 6px; color: #64748b; background: #eef2f7; border-radius: 5px; font-size: 10px; font-weight: 700; vertical-align: 2px; }
.cookie-option p { max-width: 450px; margin: 5px 0 0; font-size: 14px; line-height: 1.45; }
.cookie-switch { position: relative; flex: 0 0 auto; width: 48px; height: 28px; cursor: pointer; }
.cookie-switch input { position: absolute; opacity: 0; inset: 0; }
.cookie-switch span { display: block; width: 100%; height: 100%; background: #cbd3df; border-radius: 999px; transition: background-color 180ms ease; }
.cookie-switch span::after { position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; content: ''; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(15, 23, 42, .25); transition: transform 180ms ease; }
.cookie-switch input:checked + span { background: var(--accent-color); }
.cookie-switch input:checked + span::after { transform: translateX(20px); }
.cookie-switch input:disabled + span { background: var(--accent-color); cursor: not-allowed; opacity: .75; }
.cookie-preferences__actions { justify-content: flex-end; margin-top: 26px; gap: 12px; }

@media (min-width: 769px) {
    #main-stage > .cookie-consent {
        position: absolute;
        right: 24px;
        bottom: 24px;
        left: 24px;
    }
}

/* La lățimea utilă a coloanei principale, acțiunile au propriul rând.
   Astfel nu comprimă textul și nu măresc artificial bannerul pe orizontală. */
@media (min-width: 641px) and (max-width: 1250px) {
    .cookie-consent__card {
        grid-template-columns: 44px minmax(0, 1fr) 30px;
    }

    .cookie-consent__icon { width: 44px; height: 44px; }
    .cookie-consent__icon svg { width: 30px; height: 30px; }
    .cookie-consent__close { width: 30px; height: 30px; font-size: 23px; }

    .cookie-consent__actions {
        display: grid;
        grid-column: 1 / -1;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
        gap: 8px;
    }

    .cookie-consent__actions .cookie-button {
        min-width: 0;
        padding: 9px 8px;
    }
}

@media (max-width: 980px) {
    .cookie-consent__card { grid-template-columns: 44px 1fr 30px; }
    .cookie-consent__icon { width: 44px; height: 44px; }
    .cookie-consent__icon svg { width: 30px; height: 30px; }
    .cookie-consent__close { width: 30px; height: 30px; font-size: 23px; }
    .cookie-consent__actions { grid-column: 1 / -1; justify-content: flex-end; }
}

@media (max-width: 640px) {
    .cookie-consent {
        right: 12px;
        bottom: max(12px, env(safe-area-inset-bottom));
        left: 12px;
    }

    .cookie-consent__card {
        position: relative;
        display: flex;
        flex-direction: column;
        max-height: calc(100dvh - 24px - env(safe-area-inset-bottom));
        padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
        overflow: auto;
        border-radius: 26px;
        box-shadow: 0 14px 32px rgba(32, 44, 62, .14), 0 2px 5px rgba(32, 44, 62, .05);
    }

    .cookie-consent__close {
        position: absolute;
        top: 12px;
        right: 12px;
        left: auto;
        z-index: 2;
        width: 30px;
        height: 30px;
        font-size: 23px;
    }

    .cookie-consent__icon {
        display: none;
    }

    .cookie-consent__content {
        position: relative;
        z-index: 1;
        padding-top: 32px;
    }

    .cookie-consent__content h2 {
        max-width: 11ch;
        font-size: clamp(28px, 8.5vw, 34px);
        font-weight: 780;
        line-height: 1.08;
        letter-spacing: -.045em;
    }

    .cookie-consent__content p {
        margin: 16px 0;
        color: #5c6980;
        font-size: clamp(17px, 5.2vw, 20px);
        line-height: 1.35;
        letter-spacing: -.025em;
    }

    .cookie-consent__content a {
        color: color-mix(in srgb, var(--accent-color) 78%, #6d4260);
        font-size: clamp(14px, 4.2vw, 16px);
        font-weight: 650;
        line-height: 1.25;
        text-underline-offset: 4px;
        text-decoration-thickness: 1px;
    }

    .cookie-consent__actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
        margin-top: 16px;
        padding-bottom: 6px;
    }

    .cookie-consent__actions .cookie-button {
        min-width: 0;
        width: 100%;
        min-height: 44px;
        padding: 8px 6px;
        border-width: 1px;
        border-radius: 999px;
        font-size: clamp(14px, 4.2vw, 16px);
        font-weight: 750;
    }

    .cookie-consent__actions .cookie-button--primary {
        grid-column: 1 / -1;
        grid-row: 1;
        color: #fff;
        border-color: var(--accent-color);
        box-shadow: 0 7px 14px color-mix(in srgb, var(--accent-color) 20%, transparent);
    }
    .cookie-preferences { align-items: end; padding: 8px; }
    .cookie-preferences__dialog {
        box-sizing: border-box;
        width: 100%;
        max-height: calc(100dvh - 16px);
        padding: 16px 16px calc(22px + env(safe-area-inset-bottom));
        border-radius: 20px 20px 0 0;
        overscroll-behavior: contain;
    }
    .cookie-preferences__header { gap: 14px; }
    .cookie-preferences h2 { font-size: 18px; }
    .cookie-preferences__close { width: 30px; height: 30px; font-size: 23px; }
    .cookie-preferences__intro { margin: 8px 0 10px; font-size: 12px; line-height: 1.35; }
    .cookie-option { gap: 12px; padding: 10px 0; }
    .cookie-option h3 { font-size: 13px; }
    .cookie-option h3 span { margin-left: 4px; padding: 2px 4px; font-size: 8px; }
    .cookie-option p { margin-top: 3px; font-size: 11px; line-height: 1.35; }
    .cookie-switch { width: 42px; height: 24px; }
    .cookie-switch span::after { top: 4px; left: 4px; width: 16px; height: 16px; }
    .cookie-switch input:checked + span::after { transform: translateX(18px); }
    .cookie-preferences__actions { display: grid; grid-template-columns: 1fr 1fr; margin-top: 12px; gap: 8px; }
    .cookie-preferences__actions .cookie-button { min-width: 0; width: 100%; min-height: 40px; padding: 7px 5px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .cookie-button,
    .cookie-switch span,
    .cookie-switch span::after { transition: none; }
}
