/*
 * IX Cookie Consent - the cookie banner (Banner::footer()).
 *
 * One card at the foot of the window, drawn with the ix theme's colour
 * tokens and its .ix-btn buttons so it looks like the rest of the site. The
 * fallbacks keep the card readable should a token be renamed. Everywhere but
 * the theme's legal pages, a backdrop blocks the page while the card is up.
 */

.ixcookie {
    position: fixed;
    left: 50%;
    bottom: 24px;
    /* Above the theme's sticky header (1030), below Bootstrap's modals and
       the theme's drawer (1040 and up), which cover it while open. */
    z-index: 1035;
    box-sizing: border-box;
    width: min(780px, calc(100% - 48px));
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    overflow-y: auto;
    padding: 20px 24px;
    transform: translateX(-50%);
    background-color: var(--bg-lifted, #161a23);
    border: 1px solid var(--border-lifted, #333a4b);
    border-radius: var(--rounding-lg, 16px);
    box-shadow: var(--ix-shadow-lg, 0 16px 48px rgba(0, 0, 0, 0.55));
    color: var(--text, #e5e8f0);
    text-align: left;
}

/* Bootstrap's [hidden] rule is not on every page WHMCS draws. */
.ixcookie[hidden],
.ixcookie [hidden],
.ixcookie-backdrop[hidden] {
    display: none !important;
}

/* The page behind the card while it is up, everywhere but the theme's legal
   pages (Banner::blocks()): the theme's scrim, the one behind its phone menu,
   and a light blur (user decision, 2026-11-23, after a mockup). Over the
   theme's sticky header (1030), under the Debug panel (1034) and the card. */
.ixcookie-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1033;
    background-color: var(--ix-scrim, rgba(0, 0, 0, 0.6));
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    animation: ixcookie-fade 200ms ease;
}

@keyframes ixcookie-fade {
    from {
        opacity: 0;
    }
}

/* No scrolling behind it. The scrollbar's gutter stays, so the page does
   not shift sideways when the card closes. */
html[data-ixcookie-modal] {
    overflow: hidden;
    scrollbar-gutter: stable;
}

.ixcookie:focus {
    outline: none;
}

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

.ixcookie-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.ixcookie-icon {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background-color: var(--ix-accent-soft, rgba(99, 102, 241, 0.14));
    color: var(--ix-accent-hover, #818cf8);
}

.ixcookie-intro {
    flex: 1;
    min-width: 0;
}

.ixcookie-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-lifted, #f4f6fa);
}

.ixcookie-text {
    margin: 4px 0 0;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-muted, #8b93a7);
}

.ixcookie-text a {
    color: var(--ix-accent, #6366f1);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ixcookie-text a:hover,
.ixcookie-text a:focus {
    color: var(--ix-accent-hover, #818cf8);
}

/* The choice in force, when the card is opened again from the theme's
   "Cookie settings". */
.ixcookie-status {
    margin: 8px 0 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--ix-tint-info-fg, #7dd3fc);
}

.ixcookie-close {
    flex: none;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--border-lifted, #333a4b);
    border-radius: var(--rounding-sm, 6px);
    background: none;
    color: var(--text-muted, #8b93a7);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.ixcookie-close:hover,
.ixcookie-close:focus {
    color: var(--text-lifted, #f4f6fa);
    border-color: var(--border-accented, #454e63);
}

/* The three categories on one line, in one recessed panel, each with its
   switch; what each is for stays folded under "Details", in the same columns
   (user decision, 2026-11-23, mockups X2 and C): three tiles with their texts
   always open made the card tall and the texts cramped. The last column is
   fixed, since "Detalii" and "Ascunde" differ in width and the categories
   must not move when one becomes the other. */
.ixcookie-panel {
    margin-top: 16px;
    background-color: var(--bg-muted, #0b0d13);
    border: 1px solid var(--border, #272c3a);
    border-radius: var(--rounding-md, 10px);
}

.ixcookie-cats,
.ixcookie-details {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) 100px;
}

.ixcookie-cat {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 50px;
    padding: 10px 16px;
}

.ixcookie-cat .ixcookie-always,
.ixcookie-cat .ixcookie-switch {
    margin-left: auto;
}

.ixcookie-cat + .ixcookie-cat,
.ixcookie-more-cell,
.ixcookie-detail + .ixcookie-detail,
.ixcookie-details::after {
    border-left: 1px solid var(--border, #272c3a);
}

.ixcookie-cat-name {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-lifted, #f4f6fa);
}

label.ixcookie-cat-name {
    cursor: pointer;
}

.ixcookie-more-cell {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ixcookie-more {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 6px;
    border: 0;
    border-radius: var(--rounding-sm, 6px);
    background: none;
    color: var(--text-muted, #8b93a7);
    font: inherit;
    font-size: 0.8125rem;
    line-height: 1.4;
    cursor: pointer;
}

.ixcookie-more:hover,
.ixcookie-more:focus-visible,
.ixcookie-more[aria-expanded="true"] {
    color: var(--ix-accent-hover, #818cf8);
}

.ixcookie-more:focus-visible {
    outline: none;
    box-shadow: var(--ix-ring, 0 0 0 3px rgba(99, 102, 241, 0.14));
}

.ixcookie-chevron {
    flex: none;
    transition: transform 160ms ease;
}

.ixcookie-more[aria-expanded="true"] .ixcookie-chevron {
    transform: rotate(180deg);
}

/* Each text under its category; the fourth column stays empty, its rule
   carried down. */
.ixcookie-details {
    margin: 0;
    border-top: 1px solid var(--border, #272c3a);
}

.ixcookie-details::after {
    content: "";
}

.ixcookie-detail {
    padding: 12px 16px 14px;
}

/* The column names the text, so the name is only read out here. */
.ixcookie-detail dt {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.ixcookie-detail dd {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.55;
    color: var(--text, #e5e8f0);
}

/* Where the line does not fit (under ~800px, phones included), a list: the
   categories under one another, "Details" last, and each text under its
   name. */
@media (max-width: 800px) {
    .ixcookie-cats,
    .ixcookie-details {
        grid-template-columns: minmax(0, 1fr);
    }

    .ixcookie-cat {
        min-height: 0;
        padding: 10px 14px;
    }

    .ixcookie-cat + .ixcookie-cat,
    .ixcookie-more-cell,
    .ixcookie-detail + .ixcookie-detail {
        border-left: 0;
        border-top: 1px solid var(--border, #272c3a);
    }

    .ixcookie-more-cell {
        justify-content: flex-start;
        padding: 6px 8px;
    }

    .ixcookie-details::after {
        content: none;
    }

    .ixcookie-detail {
        padding: 10px 14px 12px;
    }

    .ixcookie-detail dt {
        position: static;
        width: auto;
        height: auto;
        overflow: visible;
        clip-path: none;
        white-space: normal;
        margin-bottom: 2px;
        font-size: 0.8125rem;
        font-weight: 700;
        color: var(--text-lifted, #f4f6fa);
    }
}

.ixcookie-always {
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    color: var(--ix-tint-success-fg, #4ade80);
}

/* The switch: the checkbox stays, for the keyboard and for reading out, and
   only its box is replaced by a track. */
.ixcookie-switch {
    position: relative;
    display: inline-flex;
    flex: none;
    margin: 0;
    cursor: pointer;
}

.ixcookie-switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
}

.ixcookie-switch span {
    position: relative;
    width: 44px;
    height: 26px;
    border: 1px solid var(--border-lifted, #333a4b);
    border-radius: 999px;
    background-color: var(--bg, #0f1117);
    transition: background-color 160ms ease, border-color 160ms ease;
}

.ixcookie-switch span::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: var(--grayscale-accented, #7b8499);
    box-shadow: var(--ix-shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.4));
    transition: transform 160ms ease, background-color 160ms ease;
}

.ixcookie-switch:hover span {
    border-color: var(--ix-accent-border, rgba(99, 102, 241, 0.38));
}

.ixcookie-switch input:checked + span {
    background-color: var(--ix-accent, #6366f1);
    border-color: var(--ix-accent, #6366f1);
}

.ixcookie-switch input:checked + span::after {
    background-color: var(--ix-accent-contrast, #ffffff);
    transform: translateX(18px);
}

.ixcookie-switch input:focus-visible + span {
    box-shadow: var(--ix-ring, 0 0 0 3px rgba(99, 102, 241, 0.14));
}

.ixcookie-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

.ixcookie-actions .ixcookie-save {
    margin-right: auto;
}

/* "Accept all" and "Refuse all" alike, and wide enough to read as a pair. */
.ixcookie-actions .ixcookie-choice {
    min-width: 132px;
}

@media (max-width: 640px) {
    .ixcookie {
        left: 12px;
        right: 12px;
        bottom: 12px;
        width: auto;
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
        padding: 18px;
        transform: none;
    }

    .ixcookie-head .ixcookie-icon {
        display: none;
    }

    .ixcookie-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .ixcookie-actions .ixcookie-save {
        grid-column: 1 / -1;
        grid-row: 2;
        margin: 0;
    }

    .ixcookie-actions .ixcookie-choice {
        min-width: 0;
    }
}

/* The Debug setting's panel (consent.js, startDebug()), for every visitor
   while the setting is ticked. On the right edge, clear of the banner, which sits at
   the bottom in the middle; where a short window makes them meet, under it,
   since the banner is what is being tested. Over the backdrop: the cookies
   set before a choice are what it is for. */
.ixcookie-debug {
    position: fixed;
    right: 12px;
    top: 30%;
    z-index: 1034;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    max-width: calc(100% - 24px);
    font-size: 0.75rem;
    line-height: 1.45;
    text-align: left;
}

.ixcookie-debug [hidden] {
    display: none !important;
}

.ixcookie-debug-toggle {
    padding: 6px 12px;
    border: 1px dashed var(--ix-accent-border, rgba(99, 102, 241, 0.38));
    border-radius: 999px;
    background-color: var(--bg-accented, #1e2330);
    color: var(--text-lifted, #f4f6fa);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--ix-shadow-md, 0 4px 16px rgba(0, 0, 0, 0.45));
}

.ixcookie-debug-body {
    box-sizing: border-box;
    width: min(520px, calc(100vw - 24px));
    max-height: 60vh;
    overflow: auto;
    padding: 12px 14px;
    background-color: var(--bg-lifted, #161a23);
    border: 1px solid var(--border-lifted, #333a4b);
    border-radius: var(--rounding-md, 10px);
    box-shadow: var(--ix-shadow-lg, 0 16px 48px rgba(0, 0, 0, 0.55));
    color: var(--text, #e5e8f0);
}

.ixcookie-debug-body p {
    margin: 0 0 6px;
}

.ixcookie-debug-title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-lifted, #f4f6fa);
}

.ixcookie-debug-note,
.ixcookie-debug-muted {
    color: var(--text-muted, #8b93a7);
}

.ixcookie-debug-choice {
    color: var(--ix-tint-info-fg, #7dd3fc);
}

.ixcookie-debug-table {
    width: 100%;
    margin-top: 8px;
    border-collapse: collapse;
}

.ixcookie-debug-table th,
.ixcookie-debug-table td {
    padding: 5px 8px 5px 0;
    border-top: 1px solid var(--border, #272c3a);
    vertical-align: top;
    text-align: left;
}

.ixcookie-debug-table th {
    border-top: 0;
    font-weight: 700;
    color: var(--text-muted, #8b93a7);
}

.ixcookie-debug-name,
.ixcookie-debug-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    word-break: break-all;
}

/* A tag's cookie without the consent it needs. */
.ixcookie-debug-warn td {
    color: var(--ix-tint-error-fg, #f87171);
}

@media (prefers-reduced-motion: reduce) {
    .ixcookie-switch span,
    .ixcookie-switch span::after,
    .ixcookie-chevron {
        transition: none;
    }

    .ixcookie-backdrop {
        animation: none;
    }
}
