/* Cookie consent — login page; dark-theme friendly, RTL-safe */

body.cc-dialog-open {
    overflow: hidden;
}

.cc-root {
    --cc-bg: rgba(18, 26, 44, 0.97);
    --cc-bg-elevated: #151d30;
    --cc-border: rgba(145, 165, 199, 0.22);
    --cc-text: #e6edf7;
    --cc-muted: #9aa8c2;
    --cc-accent: #4b8eff;
    --cc-accent-hover: #6aa3ff;
    --cc-radius: 14px;
    --cc-shadow: 0 -8px 40px rgba(0, 0, 0, 0.45);
    /* Below Bootstrap modal (1055) so password reset stays on top */
    --cc-z-banner: 1020;
    --cc-z-backdrop: 1030;
    --cc-z-dialog: 1040;
    --cc-z-fab: 1010;
    font-family: "Montserrat", "Inter", system-ui, sans-serif;
}

.cc-banner--hidden,
.cc-backdrop--hidden,
.cc-dialog--hidden,
.cc-fab--hidden {
    display: none !important;
}

.cc-banner {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: var(--cc-z-banner);
    padding: 0.75rem 1rem max(0.75rem, env(safe-area-inset-bottom));
    pointer-events: none;
    animation: cc-slide-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.cc-banner.cc-banner--visible {
    pointer-events: auto;
}

@keyframes cc-slide-up {
    from {
        opacity: 0;
        transform: translateY(110%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cc-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* LTR: text visually on the right, actions on the left (matches English mockup). */
/* RTL: natural row — first child (text) at inline-start (= right), actions on the left. */
.cc-banner__inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: row-reverse;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem 1.25rem;
    padding: 1.1rem 1.25rem;
    background: var(--cc-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-radius);
    box-shadow: var(--cc-shadow);
}

html[dir="rtl"] .cc-banner__inner {
    flex-direction: row;
}

.cc-banner__title {
    margin: 0 0 0.35rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--cc-text);
    letter-spacing: -0.02em;
    text-align: start;
}

.cc-banner__desc {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--cc-muted);
    max-width: 52ch;
    text-align: start;
}

.cc-banner__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    /* Pack action group toward the text column */
    justify-content: flex-end;
}

html[dir="rtl"] .cc-banner__actions {
    justify-content: flex-start;
}

.cc-btn {
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 0.55rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
    white-space: nowrap;
}

.cc-btn:active {
    transform: scale(0.98);
}

.cc-btn:focus-visible {
    outline: 2px solid var(--cc-accent);
    outline-offset: 2px;
}

.cc-btn--primary {
    background: var(--cc-accent);
    color: #fff;
}

.cc-btn--primary:hover {
    background: var(--cc-accent-hover);
}

.cc-btn--secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--cc-text);
    border-color: var(--cc-border);
}

.cc-btn--secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

.cc-btn--ghost {
    background: transparent;
    color: var(--cc-muted);
    border-color: transparent;
}

.cc-btn--ghost:hover {
    color: var(--cc-text);
}

/* Backdrop + dialog */
.cc-backdrop {
    position: fixed;
    inset: 0;
    z-index: var(--cc-z-backdrop);
    background: rgba(5, 8, 16, 0.72);
    animation: cc-fade-in 0.35s ease forwards;
}

.cc-dialog {
    position: fixed;
    inset: 0;
    z-index: var(--cc-z-dialog);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: cc-fade-in 0.35s ease forwards;
}

.cc-dialog__panel {
    width: min(100%, 440px);
    max-height: min(90vh, 640px);
    overflow: auto;
    background: var(--cc-bg-elevated);
    border: 1px solid var(--cc-border);
    border-radius: calc(var(--cc-radius) + 2px);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
    padding: 1.25rem 1.35rem 1.15rem;
}

.cc-dialog__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.cc-dialog__title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--cc-text);
}

.cc-dialog__close {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--cc-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cc-dialog__close:hover {
    color: var(--cc-text);
    background: rgba(255, 255, 255, 0.1);
}

.cc-dialog__close:focus-visible {
    outline: 2px solid var(--cc-accent);
    outline-offset: 2px;
}

.cc-dialog__intro {
    margin: 0 0 1rem;
    font-size: 0.8125rem;
    color: var(--cc-muted);
    line-height: 1.5;
}

.cc-categories {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.cc-cat {
    border: 1px solid var(--cc-border);
    border-radius: 12px;
    padding: 0.75rem 0.85rem;
    background: rgba(0, 0, 0, 0.15);
}

.cc-cat__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.cc-cat__info {
    min-width: 0;
}

.cc-cat__name {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--cc-text);
    cursor: pointer;
}

.cc-cat__hint {
    display: block;
    font-size: 0.75rem;
    color: var(--cc-muted);
    line-height: 1.45;
    margin-top: 0.2rem;
}

/* Toggle switch */
.cc-switch {
    flex-shrink: 0;
    position: relative;
    width: 48px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid var(--cc-border);
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    padding: 0;
    transition: background 0.2s, border-color 0.2s;
}

.cc-switch[aria-checked="true"] {
    background: rgba(75, 142, 255, 0.45);
    border-color: rgba(75, 142, 255, 0.6);
}

.cc-switch__thumb {
    position: absolute;
    top: 3px;
    inset-inline-start: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

[dir="rtl"] .cc-switch__thumb {
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.cc-switch[aria-checked="true"] .cc-switch__thumb {
    transform: translateX(20px);
}

[dir="rtl"] .cc-switch[aria-checked="true"] .cc-switch__thumb {
    transform: translateX(-20px);
}

.cc-switch--locked {
    opacity: 0.55;
    cursor: not-allowed;
}

.cc-switch:focus-visible {
    outline: 2px solid var(--cc-accent);
    outline-offset: 2px;
}

.cc-dialog__footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.15rem;
    padding-top: 1rem;
    border-top: 1px solid var(--cc-border);
}

/* Floating button */
.cc-fab {
    position: fixed;
    inset-inline-end: max(1rem, env(safe-area-inset-right));
    bottom: max(1rem, env(safe-area-inset-bottom));
    z-index: var(--cc-z-fab);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--cc-border);
    background: var(--cc-bg-elevated);
    color: var(--cc-accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    animation: cc-slide-up 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.cc-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
    background: #1a2438;
}

.cc-fab:focus-visible {
    outline: 2px solid var(--cc-accent);
    outline-offset: 3px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 640px) {
    .cc-banner__inner {
        flex-direction: column;
        align-items: stretch;
    }

    .cc-banner__actions {
        justify-content: stretch;
    }

    .cc-banner__actions .cc-btn {
        flex: 1 1 auto;
        justify-content: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cc-banner,
    .cc-backdrop,
    .cc-dialog,
    .cc-fab,
    .cc-switch__thumb {
        animation: none !important;
        transition: none !important;
    }
}
