/* Mitar.CookieConsent — banner styles. Colours and radius come from the backoffice as CSS variables on
   :root (--mcc-*, set in <head>); the font is inherited from the site. */

#cookieConsent {
    --mcc-border: color-mix(in srgb, var(--mcc-text) 15%, transparent);
    --mcc-muted: color-mix(in srgb, var(--mcc-text) 72%, transparent);
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1050;
    box-sizing: border-box;
    width: calc(100% - 32px);
    max-width: 780px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding: 20px 24px;
    background: var(--mcc-bg);
    color: var(--mcc-text);
    border: 1px solid var(--mcc-border);
    border-left: 3px solid var(--mcc-primary);
    border-radius: var(--mcc-radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, .12);
    font: inherit;
    font-size: 15px;
    line-height: 1.5;
    text-align: left;
}
#cookieConsent[hidden] { display: none !important; }
#cookieConsent:focus { outline: none; }
#cookieConsent *, #cookieConsent *::before, #cookieConsent *::after { box-sizing: border-box; }

/* Position */
#cookieConsent[data-position="top"] { top: 24px; bottom: auto; }
#cookieConsent[data-position="center"] { top: 50%; bottom: auto; transform: translate(-50%, -50%); max-width: 560px; }
#cookieConsent[data-position="center"] .cookie-consent-inner { flex-direction: column; align-items: stretch; }
#cookieConsent[data-position="center"] .cookie-consent-actions { justify-content: flex-end; }

/* Backdrop: the script sets data-cookie-backdrop on <html> while the banner is open (not :has(), which
   Safari does not always re-evaluate). dim = page stays usable; block = only after a choice. */
html[data-cookie-backdrop="dim"] body::before,
html[data-cookie-backdrop="block"] body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 1049;
    background: rgba(0, 0, 0, .45);
    pointer-events: none;
}
html[data-cookie-backdrop="block"] body { overflow: hidden; }
html[data-cookie-backdrop="block"] body::before { pointer-events: auto; }

/* Layer 1 */
.cookie-consent-inner { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.cookie-consent-text { flex: 1; min-width: 200px; }
.cookie-consent-text strong { display: block; font-size: 1.05em; margin-bottom: 4px; color: var(--mcc-text); }
.cookie-consent-text p { margin: 0; font-size: .9em; color: var(--mcc-muted); }
.cookie-consent-text a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.cookie-consent-actions { display: flex; align-items: center; gap: 12px; min-width: 0; flex-wrap: wrap; }

/* Buttons (style per button from the backoffice) */
.mcc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: .55rem 1.1rem;
    font: inherit;
    font-size: .9em;
    font-weight: 600;
    line-height: 1.3;
    border: 2px solid var(--mcc-primary);
    border-radius: var(--mcc-radius);
    cursor: pointer;
    transition: opacity .15s ease;
}
.mcc-btn:hover { opacity: .85; }
.mcc-btn:focus-visible { outline: 2px solid var(--mcc-primary); outline-offset: 2px; }
.mcc-btn--primary { background: var(--mcc-primary); color: var(--mcc-primary-text); }
.mcc-btn--secondary { background: transparent; color: var(--mcc-primary); }
.mcc-btn--link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--mcc-muted);
    font-weight: 400;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Layer 2 */
.cookie-prefs-title { display: block; font-size: 1.05em; margin-bottom: 12px; color: var(--mcc-text); }
.cookie-cat { border-top: 1px solid var(--mcc-border); padding: 12px 0; }
.cookie-cat-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0; cursor: pointer; }
.cookie-cat-title { font-weight: 600; font-size: .95em; }
.cookie-cat-head input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    flex-shrink: 0;
    position: relative;
    width: 40px;
    height: 22px;
    margin: 0;
    border-radius: 11px;
    background: var(--mcc-border);
    cursor: pointer;
    transition: background .15s ease;
}
.cookie-cat-head input[type="checkbox"]::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
    transition: transform .15s ease;
}
.cookie-cat-head input[type="checkbox"]:checked { background: var(--mcc-primary); }
.cookie-cat-head input[type="checkbox"]:checked::after { transform: translateX(18px); }
.cookie-cat-head input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .6; }
.cookie-cat-head input[type="checkbox"]:focus-visible { outline: 2px solid var(--mcc-primary); outline-offset: 2px; }
.cookie-cat-text { margin: 6px 0 4px; font-size: .88em; color: var(--mcc-muted); }
.cookie-cat-services { margin: 0; padding-left: 1.1rem; font-size: .85em; color: var(--mcc-muted); }
.cookie-cat-services strong { color: var(--mcc-text); }
.cookie-cat-meta { display: block; opacity: .85; }
.cookie-prefs .cookie-consent-actions { justify-content: flex-end; gap: 10px; margin-top: 12px; }

/* Mobile: full-width buttons */
@media (max-width: 575.98px) {
    #cookieConsent { padding: 16px; }
    #cookieConsent .cookie-consent-actions { width: 100%; }
    #cookieConsent .mcc-btn:not(.mcc-btn--link) { flex: 1 1 auto; }
}

/* Floating button to change the choice later */
.mcc-revisit {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 1040;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--mcc-primary);
    color: var(--mcc-primary-text);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .2);
    cursor: pointer;
}
.mcc-revisit[hidden] { display: none; }
.mcc-revisit svg { width: 24px; height: 24px; }
.mcc-revisit:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

/* Cookie declaration page */
.mcc-declaration { padding: 48px 0; }
.mcc-table-scroll { overflow-x: auto; margin: 0 0 1.5rem; }
.mcc-table { width: 100%; border-collapse: collapse; font-size: .92em; }
.mcc-table th, .mcc-table td { text-align: left; vertical-align: top; padding: .5rem .75rem; border-bottom: 1px solid rgba(0, 0, 0, .12); }
.mcc-table thead th { white-space: nowrap; }
