/**
 * Copyright (c) 2026 MageLab
 */

.mgl-cookie-consent {
    --mgl-cookie-consent-accent: #1a1c1c;
    --mgl-cookie-consent-accent-text: #fff;
    --mgl-cookie-consent-background: #fff;
    --mgl-cookie-consent-color: #1a1c1c;
    --mgl-cookie-consent-muted: #5f6368;
    --mgl-cookie-consent-line: #dcdcdc;
    position: fixed;
    bottom: 16px;
    z-index: 1000000;
    box-sizing: border-box;
    width: calc(100% - 32px);
    max-width: 460px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 8px;
    background: var(--mgl-cookie-consent-background);
    box-shadow: 0 6px 24px rgba(0, 0, 0, .16);
    color: var(--mgl-cookie-consent-color);
    font-size: 13px;
    line-height: 1.45;
    text-align: left;
}

.mgl-cookie-consent[hidden],
.mgl-cookie-consent [hidden] {
    display: none !important;
}

.mgl-cookie-consent--bottom-left {
    left: 16px;
}

.mgl-cookie-consent--bottom-right {
    right: 16px;
}

.mgl-cookie-consent--bottom {
    right: 16px;
    left: 16px;
    width: auto;
    max-width: none;
}

.mgl-cookie-consent__view {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mgl-cookie-consent--bottom [data-mgl-view="main"] {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

.mgl-cookie-consent__text {
    margin: 0;
}

.mgl-cookie-consent .mgl-cookie-consent__link {
    color: inherit;
    text-decoration: underline;
}

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

/* ===================== Buttons ===================== */

.mgl-cookie-consent .mgl-cookie-consent__button {
    display: inline-flex;
    flex: 1 1 0;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 38px;
    height: auto;
    margin: 0;
    padding: 8px 10px !important;
    border-radius: 4px;
    font: inherit;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
    text-transform: none;
    white-space: normal;
    cursor: pointer;
}

.mgl-cookie-consent--bottom [data-mgl-view="main"] .mgl-cookie-consent__button {
    flex: none;
    min-width: 120px;
}

/*
 * Theme button styles must not leak in, including their hover and focus states. Themes often force
 * button padding, border and color with !important (Sm Autostore does), so these do the same.
 */
.mgl-cookie-consent .mgl-cookie-consent__button,
.mgl-cookie-consent .mgl-cookie-consent__button:hover,
.mgl-cookie-consent .mgl-cookie-consent__button:focus {
    border: 1px solid var(--mgl-cookie-consent-accent) !important;
    background: transparent;
    box-shadow: none;
    color: var(--mgl-cookie-consent-accent) !important;
}

.mgl-cookie-consent .mgl-cookie-consent__button--accept,
.mgl-cookie-consent .mgl-cookie-consent__button--accept:hover,
.mgl-cookie-consent .mgl-cookie-consent__button--accept:focus {
    background: var(--mgl-cookie-consent-accent);
    color: var(--mgl-cookie-consent-accent-text) !important;
}

.mgl-cookie-consent .mgl-cookie-consent__button--manage,
.mgl-cookie-consent .mgl-cookie-consent__button--manage:hover,
.mgl-cookie-consent .mgl-cookie-consent__button--manage:focus {
    border-color: var(--mgl-cookie-consent-line) !important;
    color: var(--mgl-cookie-consent-color) !important;
}

.mgl-cookie-consent .mgl-cookie-consent__button:hover {
    opacity: .85;
}

.mgl-cookie-consent .mgl-cookie-consent__button:focus-visible {
    outline: 2px solid var(--mgl-cookie-consent-accent) !important;
    outline-offset: 2px;
}

/* ===================== Settings panel ===================== */

.mgl-cookie-consent .mgl-cookie-consent__title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    outline: none;
}

.mgl-cookie-consent .mgl-cookie-consent__categories {
    margin: 0;
    padding: 0;
    list-style: none;
}

.mgl-cookie-consent .mgl-cookie-consent__category {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0;
    padding: 10px 0;
    border-top: 1px solid var(--mgl-cookie-consent-line);
}

.mgl-cookie-consent .mgl-cookie-consent__category:last-child {
    border-bottom: 1px solid var(--mgl-cookie-consent-line);
}

.mgl-cookie-consent .mgl-cookie-consent__category-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.mgl-cookie-consent .mgl-cookie-consent__category-name {
    font-weight: 600;
}

.mgl-cookie-consent .mgl-cookie-consent__category-description {
    color: var(--mgl-cookie-consent-muted);
    font-size: 12px;
}

.mgl-cookie-consent .mgl-cookie-consent__always-on {
    flex-shrink: 0;
    color: var(--mgl-cookie-consent-muted);
    font-size: 12px;
    font-weight: 600;
}

/* Switch: theme checkbox styles are reset the same way as the buttons */
.mgl-cookie-consent input.mgl-cookie-consent__switch {
    position: relative !important;
    top: 0 !important;
    flex-shrink: 0;
    width: 40px !important;
    height: 22px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 11px;
    background: #c4c4c4;
    box-shadow: none;
    opacity: 1 !important;
    cursor: pointer;
    transition: background-color .15s;
    -webkit-appearance: none;
    appearance: none;
}

.mgl-cookie-consent input.mgl-cookie-consent__switch::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
    transition: transform .15s;
}

.mgl-cookie-consent input.mgl-cookie-consent__switch::after {
    display: none !important;
}

.mgl-cookie-consent input.mgl-cookie-consent__switch:checked {
    background: var(--mgl-cookie-consent-accent);
}

.mgl-cookie-consent input.mgl-cookie-consent__switch:checked::before {
    transform: translateX(18px);
}

.mgl-cookie-consent input.mgl-cookie-consent__switch:focus-visible {
    outline: 2px solid var(--mgl-cookie-consent-accent) !important;
    outline-offset: 2px;
}

/* ===================== Corner icon after Decline ===================== */

.mgl-cookie-consent-icon[hidden] {
    display: none !important;
}

.mgl-cookie-consent-icon,
.mgl-cookie-consent-icon:hover,
.mgl-cookie-consent-icon:focus {
    --mgl-cookie-consent-accent: #1a1c1c;
    position: fixed;
    bottom: 16px;
    z-index: 999990;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 44px;
    min-width: 0;
    height: 44px;
    margin: 0;
    padding: 0 !important;
    border: 1px solid rgba(0, 0, 0, .1) !important;
    border-radius: 50%;
    /* Theme button backgrounds (Sm Autostore: button:not(...)) are more specific than a class */
    background: #fff !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
    color: var(--mgl-cookie-consent-accent) !important;
    line-height: 1;
    cursor: pointer;
}

.mgl-cookie-consent-icon--left {
    left: 16px;
}

.mgl-cookie-consent-icon--right {
    right: 16px;
}

.mgl-cookie-consent-icon:hover {
    transform: scale(1.06);
}

.mgl-cookie-consent-icon:focus-visible {
    outline: 2px solid var(--mgl-cookie-consent-accent) !important;
    outline-offset: 2px;
}

.mgl-cookie-consent-icon svg {
    display: block;
    width: 22px;
    height: 22px;
}

@media (max-width: 639px) {
    .mgl-cookie-consent-icon {
        bottom: 12px;
    }

    .mgl-cookie-consent-icon--left {
        left: 12px;
    }

    .mgl-cookie-consent-icon--right {
        right: 12px;
    }
}

/*
 * The page can scroll out from under the open bar (Add to Cart at the end of a page), and focus or anchor
 * scrolling stops above it
 */
html.mgl-cookie-consent-open {
    scroll-padding-bottom: var(--mgl-cookie-consent-height, 0);
}

html.mgl-cookie-consent-open body {
    padding-bottom: var(--mgl-cookie-consent-height, 0);
}

/* ===================== Phones: a full-width sheet at the bottom ===================== */

@media (max-width: 639px) {
    .mgl-cookie-consent,
    .mgl-cookie-consent--bottom {
        right: 0;
        bottom: 0;
        left: 0;
        width: auto;
        max-width: none;
        max-height: 85vh;
        padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
        border-width: 1px 0 0;
        border-radius: 12px 12px 0 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, .14);
    }

    .mgl-cookie-consent--bottom [data-mgl-view="main"] {
        flex-direction: column;
        align-items: stretch;
    }

    .mgl-cookie-consent--bottom [data-mgl-view="main"] .mgl-cookie-consent__button {
        flex: 1 1 0;
        min-width: 0;
    }
}
