/* Cookie-consent bar: fixed to the bottom, two equal-weight buttons.
 *
 * Theme-neutral by design — the palette comes from the custom properties
 * below, which a theme overrides in its own stylesheet (DigitalCloud does so
 * in themes/digitalcloud/web/css/style.css). Logical properties are used
 * throughout so the Arabic (RTL) layout mirrors without a separate rule set.
 */

/* The bar ships as a standalone asset and cannot assume the host page sets a
 * global border-box. Scope it here so that any `width: 100%` inside the
 * component keeps its padding INSIDE that width — without this a padded full
 * width row overflows its container and the buttons slide off-screen. */
.cookie-consent,
.cookie-consent *,
.cookie-consent *::before,
.cookie-consent *::after {
    box-sizing: border-box;
}

.cookie-consent {
    --cookie-consent-bg: #fff;
    --cookie-consent-text: #101828;
    --cookie-consent-link: #2f7de1;
    --cookie-consent-btn-bg: #2f7de1;
    --cookie-consent-btn-text: #fff;
    --cookie-consent-btn-border: #2f7de1;

    display: none;
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px 26px;
    padding: 14px 20px;
    background-color: var(--cookie-consent-bg);
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.18);
}

.cookie-consent--visible {
    display: flex;
}

.cookie-consent__text {
    font-size: 15px;
    line-height: 24px;
    color: var(--cookie-consent-text);
}

.cookie-consent__link {
    color: var(--cookie-consent-link);
    text-decoration: underline;
}

.cookie-consent__body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 760px;
}

/* Current state, shown only when the bar is re-opened on an existing choice.
 * Quieter than the body copy: it reports, it does not ask. */
.cookie-consent__status {
    margin: 0;
    font-size: 13px;
    line-height: 20px;
    font-weight: 600;
    color: var(--cookie-consent-text);
    opacity: 0.72;
}

/* Collapses to nothing on a first visit, when the script leaves it empty —
 * `:empty` rather than a second class, so there is one source of truth for
 * "is there a previous state", and it is the text itself. */
.cookie-consent__status:empty {
    display: none;
}

.cookie-consent__actions {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

/* Dismiss without answering. Offered only once a choice exists — see the
 * script — so it can never become a third way past the question itself. */
.cookie-consent__close {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    font-family: inherit;
    font-size: 22px;
    line-height: 1;
    color: var(--cookie-consent-text);
    opacity: 0.55;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.cookie-consent__close:hover {
    opacity: 1;
}

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

/* Both buttons deliberately share ONE rule: identical size, colour and weight.
 * Making Decline quieter than Accept is a dark pattern and invalidates the
 * consent — do not split this selector. */
.cookie-consent__btn {
    min-width: 120px;
    padding: 9px 28px;
    border: 1px solid var(--cookie-consent-btn-border);
    border-radius: 6px;
    background: var(--cookie-consent-btn-bg);
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    line-height: 24px;
    color: var(--cookie-consent-btn-text);
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.cookie-consent__btn:hover {
    opacity: 0.85;
}

@media (max-width: 767px) {
    .cookie-consent {
        gap: 10px;
        padding: 12px 14px;
    }

    .cookie-consent__text {
        font-size: 13px;
        line-height: 20px;
    }

    .cookie-consent__actions {
        width: 100%;
        justify-content: center;
        /* Keep the buttons clear of the support-chat bubble, which is fixed to
         * the bottom-inline-end corner at z-index 2147483647 — it cannot be
         * layered under this bar, so the space it occupies has to be reserved
         * instead. Without this it covers the trailing edge of the SECOND
         * button only, which is Decline: a tap near that edge opens the chat.
         * Consent is invalid if refusing is harder than agreeing, so this is
         * not a cosmetic detail. Bubble is 85px; 92px leaves a margin. */
        padding-inline-end: 92px;
    }

    .cookie-consent__btn {
        flex: 1 1 0;
        min-width: 0;
        max-width: 180px;
        padding: 9px 12px;
    }
}
