/* Cookie consent banner (3 styles) + preferences dialog. Colors: --cc-accent / --cc-on-accent from admin settings. */
.cookie-consent {
    --cc-ink: #273444;
    --cc-text: #3d4754;
    --cc-line: #dde2e8;
    --cc-surface: #ffffff;
    font-family: Roboto, sans-serif;
    color: var(--cc-ink);
}

.cookie-consent__banner {
    box-sizing: border-box;
    background: var(--cc-surface);
    color: var(--cc-ink);
}

.cookie-consent__banner[hidden] {
    display: none;
}

.cookie-consent__title {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
}

.cookie-consent__text {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--cc-text);
    max-width: 75ch;
}

.cookie-consent__text a {
    color: var(--cc-accent);
    text-decoration: underline;
    white-space: nowrap;
}

.cookie-consent__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    justify-content: flex-end;
    align-items: center;
}

.cookie-consent__btn {
    min-height: 40px;
    padding: 8px 20px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, filter 0.2s ease;
}

.cookie-consent__btn--primary {
    background: var(--cc-accent);
    border-color: var(--cc-accent);
    color: var(--cc-on-accent);
}

.cookie-consent__btn--primary:hover {
    filter: brightness(0.9);
}

.cookie-consent__btn--outline {
    background: var(--cc-surface);
    border-color: #c3cad3;
    color: var(--cc-ink);
}

.cookie-consent__btn--outline:hover {
    background: #f1f4f8;
}

.cookie-consent__btn--link {
    background: transparent;
    color: var(--cc-ink);
    padding-left: 8px;
    padding-right: 8px;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cookie-consent__btn--link:hover {
    color: var(--cc-accent);
}

.cookie-consent__btn:focus-visible,
.cookie-consent__close:focus-visible,
.cookie-consent__switch input:focus-visible + .cookie-consent__switch-track {
    outline: 2px solid var(--cc-accent);
    outline-offset: 2px;
}

/* Style 1: floating card, bottom right (above the floating call button, z-index 200000) */
.cookie-consent--floating .cookie-consent__banner {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 200001;
    width: 420px;
    max-width: calc(100vw - 24px);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(39, 52, 68, 0.18);
    animation: cookie-consent-rise 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

.cookie-consent--floating .cookie-consent__body {
    margin-bottom: 16px;
}

/* Style 2: full-width bar at the bottom */
.cookie-consent--bar .cookie-consent__banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200001;
    display: flex;
    gap: 16px 32px;
    align-items: center;
    justify-content: center;
    padding: 16px max(24px, calc((100vw - 1200px) / 2));
    border-top: 1px solid var(--cc-line);
    box-shadow: 0 -2px 8px rgba(39, 52, 68, 0.12);
    animation: cookie-consent-rise 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

.cookie-consent--bar .cookie-consent__banner[hidden] {
    display: none;
}

.cookie-consent--bar .cookie-consent__body {
    flex: 1 1 auto;
}

.cookie-consent--bar .cookie-consent__actions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
}

/* the site's global "* { margin: 0 }" reset removes the native <dialog> centering (margin: auto) */
.cookie-consent dialog {
    position: fixed;
    inset: 0;
    margin: auto;
    height: fit-content;
}

.cookie-consent__body:focus {
    outline: none;
}

/* Style 3: centered dialog with a dimmed page (native <dialog>, top layer) */
.cookie-consent--modal .cookie-consent__banner {
    width: 480px;
    max-width: calc(100vw - 32px);
    padding: 24px;
    border: 0;
    border-radius: 12px;
    box-shadow: 0 8px 8px rgba(39, 52, 68, 0.2);
}

.cookie-consent--modal .cookie-consent__body {
    margin-bottom: 20px;
}

.cookie-consent__banner::backdrop,
.cookie-consent__prefs::backdrop {
    background: rgba(17, 24, 39, 0.5);
}

.cookie-consent__banner[open],
.cookie-consent__prefs[open] {
    animation: cookie-consent-pop 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Preferences dialog */
.cookie-consent__prefs {
    box-sizing: border-box;
    width: 560px;
    max-width: calc(100vw - 32px);
    max-height: calc(100dvh - 32px);
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: var(--cc-surface);
    color: var(--cc-ink);
    box-shadow: 0 8px 8px rgba(39, 52, 68, 0.2);
    overflow: auto;
}

.cookie-consent__prefs-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px 12px;
}

.cookie-consent__prefs-head .cookie-consent__title {
    margin: 0;
    font-size: 18px;
}

.cookie-consent__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--cc-text);
    cursor: pointer;
}

.cookie-consent__close:hover {
    background: #f1f4f8;
}

.cookie-consent__categories {
    margin: 0;
    padding: 0 24px;
    list-style: none;
}

.cookie-consent__category {
    padding: 14px 0;
    border-top: 1px solid var(--cc-line);
}

.cookie-consent__category-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.cookie-consent__category-name {
    font-size: 15px;
    font-weight: 700;
}

.cookie-consent__category-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--cc-text);
}

.cookie-consent__always {
    font-size: 13px;
    font-weight: 500;
    color: #1d7a3e;
}

.cookie-consent__switch {
    position: relative;
    display: inline-flex;
    margin: 0;
    cursor: pointer;
}

.cookie-consent__switch input {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.cookie-consent__switch-track {
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: 24px;
    background: #b8c0ca;
    transition: background-color 0.2s ease;
}

.cookie-consent__switch-track::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}

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

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

.cookie-consent__prefs > .cookie-consent__actions {
    padding: 16px 24px 20px;
    border-top: 1px solid var(--cc-line);
}

/* "Cài đặt cookie" link in the footer */
.cookie-settings-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 13px;
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
    opacity: 0.85;
}

.cookie-settings-link:hover {
    opacity: 1;
    color: inherit;
}

@media (max-width: 767.98px) {
    .cookie-consent--bar .cookie-consent__banner {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
    }

    .cookie-consent--bar .cookie-consent__actions {
        flex-wrap: wrap;
    }
}

@media (max-width: 575.98px) {
    .cookie-consent--floating .cookie-consent__banner {
        right: 12px;
        bottom: 12px;
        left: 12px;
        width: auto;
        max-width: none;
        padding: 16px;
    }

    .cookie-consent__banner .cookie-consent__btn--outline,
    .cookie-consent__banner .cookie-consent__btn--primary,
    .cookie-consent__prefs .cookie-consent__btn {
        flex: 1 1 40%;
    }

    .cookie-consent__prefs-head,
    .cookie-consent__categories,
    .cookie-consent__prefs > .cookie-consent__actions {
        padding-left: 16px;
        padding-right: 16px;
    }
}

@keyframes cookie-consent-rise {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
}

@keyframes cookie-consent-pop {
    from {
        opacity: 0;
        transform: scale(0.97);
    }
}

@media (prefers-reduced-motion: reduce) {
    .cookie-consent__banner,
    .cookie-consent__banner[open],
    .cookie-consent__prefs[open] {
        animation: none;
    }
}
