/*
 * Cookie consent banner + preferences window (see /assets/js/cookie-consent.js).
 * Loaded on V1 (Bootstrap) and V2 (Tailwind) pages, so every rule is scoped to .cc-* and sets
 * the properties the host stylesheets would otherwise override. Colors follow the V2 theme
 * (--color-brand-100 / --color-midnight in V2_assets/css/input.css).
 */
.cc-root {
    --cc-brand: #94214b;
    --cc-brand-dark: #7a1b3e;
    --cc-brand-soft: rgba(148, 33, 75, 0.08);
    --cc-ink: #0b243f;
    --cc-muted: #5b6573;
    --cc-line: #e5e7eb;
    --cc-surface: #ffffff;
    --cc-surface-alt: #f9fafb;
    --cc-radius: 8px;
    --cc-shadow: 0 12px 40px rgba(11, 36, 63, 0.18), 0 2px 8px rgba(11, 36, 63, 0.08);
    box-sizing: border-box;
    font-family: inherit;
    color: var(--cc-ink);
    line-height: 1.5;
    text-align: left;
    letter-spacing: normal;
}

.cc-root *,
.cc-root *::before,
.cc-root *::after {
    box-sizing: border-box;
}

.cc-root[hidden],
.cc-root [hidden] {
    display: none !important;
}

html.cc-lock,
html.cc-lock body {
    overflow: hidden;
}

/* ---------- Shared pieces ---------- */

.cc-root .cc-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 8px;
    padding-right: 32px;
}

.cc-root .cc-icon {
    flex: 0 0 auto;
    display: inline-flex;
    width: 32px;
    height: 32px;
}

.cc-root svg {
    display: block;
    width: 100%;
    height: 100%;
}

.cc-root .cc-icon-body {
    fill: #e9b77c;
}

.cc-root .cc-icon-chip {
    fill: #6b3a22;
}

.cc-root .cc-icon-crumb {
    fill: #e9b77c;
}

/* Subtle oversized cookie in the corner as background illustration. */
.cc-root .cc-backdrop-icon {
    position: absolute;
    right: -44px;
    top: -52px;
    width: 150px;
    height: 150px;
    opacity: 0.05;
    pointer-events: none;
}

.cc-root .cc-backdrop-icon .cc-icon-body,
.cc-root .cc-backdrop-icon .cc-icon-crumb,
.cc-root .cc-backdrop-icon .cc-icon-chip {
    fill: var(--cc-brand);
}

.cc-root .cc-title {
    margin: 0;
    padding: 0;
    font-family: inherit;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--cc-ink);
    text-transform: none;
}

.cc-root .cc-text {
    margin: 0 0 10px;
    padding: 0;
    font-size: 14px;
    color: var(--cc-muted);
}

.cc-root .cc-links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin: 0 0 16px;
    padding: 0;
    font-size: 13px;
    color: var(--cc-muted);
}

.cc-root .cc-links a {
    color: var(--cc-brand);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 500;
}

.cc-root .cc-links a:hover {
    color: var(--cc-brand-dark);
}

.cc-root .cc-close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: 0;
    padding: 6px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--cc-muted);
    cursor: pointer;
    z-index: 1;
}

.cc-root .cc-close svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.cc-root .cc-close:hover {
    background: var(--cc-surface-alt);
    color: var(--cc-ink);
}

.cc-root .cc-actions {
    position: relative;
    display: flex;
    gap: 8px;
}

.cc-root .cc-btn {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    margin: 0;
    padding: 10px 18px;
    border: 1px solid var(--cc-brand);
    border-radius: 999px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-transform: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.cc-root .cc-btn--primary {
    background: var(--cc-brand);
    color: #ffffff;
}

.cc-root .cc-btn--primary:hover {
    background: var(--cc-brand-dark);
    border-color: var(--cc-brand-dark);
}

.cc-root .cc-btn--secondary {
    background: var(--cc-surface);
    color: var(--cc-brand);
}

.cc-root .cc-btn--secondary:hover {
    background: var(--cc-brand-soft);
}

.cc-root button:focus-visible,
.cc-root a:focus-visible,
.cc-root .cc-switch input:focus-visible + .cc-switch__track {
    outline: 2px solid var(--cc-brand);
    outline-offset: 2px;
}

/* ---------- Initial banner ---------- */

.cc-banner {
    position: fixed;
    left: 24px;
    bottom: 24px;
    z-index: 2147483000;
    width: 420px;
    max-width: calc(100vw - 32px);
    padding: 20px;
    overflow: hidden;
    background: var(--cc-surface);
    border: 1px solid var(--cc-line);
    border-radius: var(--cc-radius);
    box-shadow: var(--cc-shadow);
    animation: cc-slide-up 0.25s ease-out;
}

/* ---------- Preferences window ---------- */

.cc-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(11, 36, 63, 0.45);
    animation: cc-fade 0.2s ease-out;
}

.cc-root .cc-modal {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 560px;
    max-width: 100%;
    max-height: calc(100vh - 32px);
    padding: 22px 22px 20px;
    overflow: hidden;
    background: var(--cc-surface);
    border-radius: var(--cc-radius);
    box-shadow: var(--cc-shadow);
    outline: none;
}

.cc-root .cc-modal__body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    margin: 0 -4px;
    padding: 0 4px;
}

.cc-root .cc-categories {
    margin: 4px 0 14px;
    padding: 0;
    list-style: none;
    border: 1px solid var(--cc-line);
    border-radius: var(--cc-radius);
    background: var(--cc-surface);
}

.cc-root .cc-category {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 0;
    padding: 14px 16px;
}

.cc-root .cc-category + .cc-category {
    border-top: 1px solid var(--cc-line);
}

.cc-root .cc-category__info {
    flex: 1 1 auto;
    min-width: 0;
}

.cc-root .cc-category__title {
    margin: 0 0 2px;
    padding: 0;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--cc-ink);
}

.cc-root .cc-category__text {
    margin: 0;
    padding: 0;
    font-size: 13px;
    color: var(--cc-muted);
}

.cc-root .cc-providers {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--cc-ink);
    opacity: 0.75;
}

.cc-root .cc-category__control {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.cc-root .cc-badge {
    font-size: 11px;
    font-weight: 600;
    color: var(--cc-brand);
    white-space: nowrap;
    cursor: help;
}

/* Switch: native checkbox (role="switch") kept for keyboard + screen readers, visually hidden. */
.cc-root .cc-switch {
    position: relative;
    display: inline-flex;
    margin: 0;
    padding: 0;
    cursor: pointer;
}

.cc-root .cc-switch input {
    position: absolute;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: inherit;
}

.cc-root .cc-switch__track {
    position: relative;
    display: block;
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: #cbd0d8;
    transition: background-color 0.2s;
}

.cc-root .cc-switch__thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s;
}

.cc-root .cc-switch input:checked + .cc-switch__track {
    background: var(--cc-brand);
}

.cc-root .cc-switch input:checked + .cc-switch__track .cc-switch__thumb {
    transform: translateX(20px);
}

.cc-root .cc-switch--locked {
    cursor: not-allowed;
}

.cc-root .cc-switch--locked input:checked + .cc-switch__track {
    opacity: 0.45;
}

.cc-root .cc-actions--modal {
    flex: 0 0 auto;
    flex-wrap: wrap;
    padding-top: 14px;
    border-top: 1px solid var(--cc-line);
}

.cc-root .cc-actions--modal .cc-btn {
    flex: 1 1 auto;
    padding-left: 14px;
    padding-right: 14px;
}

/* ---------- Floating "Setări cookie" button (pages without footer link) ---------- */

.cc-fab {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 2147482999;
    display: inline-flex;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 9px;
    border: 1px solid var(--cc-line);
    border-radius: 999px;
    background: var(--cc-surface);
    box-shadow: 0 4px 14px rgba(11, 36, 63, 0.15);
    cursor: pointer;
    transition: transform 0.2s;
}

.cc-fab:hover {
    transform: scale(1.06);
}

/* ---------- Toast ---------- */

.cc-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 2147483002;
    max-width: calc(100vw - 32px);
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--cc-ink);
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--cc-shadow);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 12px);
    transition: opacity 0.2s, transform 0.2s;
}

.cc-toast:empty {
    display: none;
}

.cc-toast.cc-toast--visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ---------- Mobile ---------- */

@media (max-width: 640px) {
    .cc-banner {
        left: 12px;
        right: 12px;
        bottom: 12px;
        width: auto;
        max-width: none;
        padding: 18px 16px 16px;
    }

    .cc-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .cc-root .cc-modal {
        width: 100%;
        max-height: 92vh;
        max-height: 92dvh;
        padding: 20px 16px 16px;
        border-radius: 16px 16px 0 0;
        animation: cc-slide-up 0.25s ease-out;
    }

    .cc-root .cc-actions--modal {
        flex-direction: column-reverse;
    }

    .cc-root .cc-btn {
        flex: 0 0 auto;
        white-space: normal;
    }

    .cc-root .cc-banner .cc-btn {
        flex: 1 1 0;
    }

    .cc-root .cc-category {
        padding: 12px;
    }
}

@keyframes cc-slide-up {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cc-fade {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cc-banner,
    .cc-overlay,
    .cc-root .cc-modal,
    .cc-toast,
    .cc-fab,
    .cc-root .cc-switch__track,
    .cc-root .cc-switch__thumb {
        animation: none;
        transition: none;
    }
}
