/* Cookie consent banner and preferences dialog. Markup: resources/views/shared/cookie-consent/banner.blade.php */

:root {
    --mgm-cc-brand: #1e75bb;
    --mgm-cc-brand-dark: #165a91;
    --mgm-cc-text: #2b2f32;
    --mgm-cc-muted: #5b6168;
    --mgm-cc-border: #dbe2ea;
    --mgm-cc-surface: #ffffff;
    --mgm-cc-soft: #f3f7fb;
    --mgm-cc-focus: 0 0 0 3px rgba(30, 117, 187, 0.35);
    --mgm-cc-font: "Plus Jakarta Sans", "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.mgm-cc-banner,
.mgm-cc-dialog,
.mgm-cc-toast {
    font-family: var(--mgm-cc-font);
    color: var(--mgm-cc-text);
    line-height: 1.5;
    box-sizing: border-box;
}

.mgm-cc-banner *,
.mgm-cc-dialog *,
.mgm-cc-toast * {
    box-sizing: inherit;
}

/* Shield against page-level element styles (some pages restyle every p and h2). */
.mgm-cc-banner p,
.mgm-cc-dialog p {
    font-family: var(--mgm-cc-font);
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: normal;
}

/* Banner */

.mgm-cc-banner {
    position: fixed;
    z-index: 2147482999; /* just below the settings overlay, above any page layer */
    left: 16px;
    right: 16px;
    bottom: 16px;
    max-width: 1080px;
    margin: 0 auto;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    background: var(--mgm-cc-surface);
    border: 1px solid var(--mgm-cc-border);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(16, 24, 40, 0.18);
    animation: mgm-cc-rise 0.25s ease-out;
}

.mgm-cc-banner[hidden],
.mgm-cc-toast[hidden],
.mgm-cc-banner [hidden],
.mgm-cc-dialog [hidden] {
    display: none !important;
}

.mgm-cc-banner__body {
    flex: 1 1 auto;
    min-width: 0;
}

.mgm-cc-banner__title {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: normal;
    color: var(--mgm-cc-text);
}

.mgm-cc-banner__text,
.mgm-cc-banner__gpc {
    margin: 0;
    font-size: 14px;
    color: var(--mgm-cc-muted);
}

.mgm-cc-banner__gpc {
    margin-top: 6px;
    font-weight: 500;
    color: var(--mgm-cc-text);
}

.mgm-cc-banner a,
.mgm-cc-dialog a {
    color: var(--mgm-cc-brand);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.mgm-cc-banner__actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 10px;
}

/* Buttons: "Accept all" and "Reject all" share one style so neither is nudged. */

.mgm-cc-btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: 8px;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.mgm-cc-btn:focus-visible,
.mgm-cc-dialog__close:focus-visible,
.mgm-cc-switch input:focus-visible + .mgm-cc-switch__track {
    outline: none;
    box-shadow: var(--mgm-cc-focus);
}

.mgm-cc-btn--primary {
    background: var(--mgm-cc-brand);
    color: #fff;
}

.mgm-cc-btn--primary:hover {
    background: var(--mgm-cc-brand-dark);
}

.mgm-cc-btn--secondary {
    background: var(--mgm-cc-surface);
    border-color: var(--mgm-cc-brand);
    color: var(--mgm-cc-brand);
}

.mgm-cc-btn--secondary:hover {
    background: var(--mgm-cc-soft);
}

.mgm-cc-btn--link {
    background: transparent;
    color: var(--mgm-cc-brand);
    text-decoration: underline;
    text-underline-offset: 3px;
    padding-left: 12px;
    padding-right: 12px;
}

.mgm-cc-btn--link:hover {
    color: var(--mgm-cc-brand-dark);
}

/* Preferences dialog */

/* Overlay + backdrop. The highest z-index there is, as a direct child of <body>, so page
   headers, sticky bars and other modals (Bootstrap uses 1050-1080) can never cover it. */
.mgm-cc-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 16px;
    background: rgba(16, 24, 40, 0.55);
    animation: mgm-cc-fade 0.2s ease-out;
}

.mgm-cc-modal[hidden] {
    display: none !important;
}

.mgm-cc-dialog {
    position: relative;
    display: flex;
    width: min(640px, 100%);
    max-height: min(720px, calc(100vh - 32px));
    max-height: min(720px, calc(100dvh - 32px));
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 16px;
    background: var(--mgm-cc-surface);
    box-shadow: 0 24px 64px rgba(16, 24, 40, 0.28);
    overflow: hidden;
    text-align: left;
    animation: mgm-cc-pop 0.2s ease-out;
}

.mgm-cc-dialog:focus {
    outline: none;
}

html.mgm-cc-locked,
html.mgm-cc-locked body {
    overflow: hidden !important;
}

.mgm-cc-dialog__inner {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: inherit;
    margin: 0;
}

.mgm-cc-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--mgm-cc-border);
}

.mgm-cc-dialog__title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: normal;
    color: var(--mgm-cc-text);
}

.mgm-cc-dialog__close {
    appearance: none;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--mgm-cc-muted);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.mgm-cc-dialog__close:hover {
    background: var(--mgm-cc-soft);
    color: var(--mgm-cc-text);
}

.mgm-cc-dialog__content {
    padding: 20px 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.mgm-cc-dialog__content > p {
    margin: 0 0 16px;
    font-size: 14px;
    color: var(--mgm-cc-muted);
}

.mgm-cc-category {
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--mgm-cc-border);
    border-radius: 12px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.mgm-cc-category.is-highlighted {
    border-color: var(--mgm-cc-brand);
    box-shadow: var(--mgm-cc-focus);
}

.mgm-cc-category__head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mgm-cc-category__label {
    flex: 1 1 auto;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.mgm-cc-category__always {
    font-size: 12px;
    font-weight: 600;
    color: var(--mgm-cc-brand);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mgm-cc-category__desc,
.mgm-cc-category__note {
    margin: 8px 0 0;
    font-size: 14px;
    color: var(--mgm-cc-muted);
}

.mgm-cc-category__note {
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--mgm-cc-soft);
    color: var(--mgm-cc-text);
}

/* Lets support find this visitor's records in the admin Cookie consents page. */
.mgm-cc-dialog p.mgm-cc-dialog__id {
    margin: 4px 0 0;
    font-size: 12.5px;
    color: var(--mgm-cc-muted);
}

.mgm-cc-dialog__id code {
    font-size: 12px;
    color: var(--mgm-cc-text);
    word-break: break-all;
}

/* Switch: a real checkbox (role="switch") under a styled track */

.mgm-cc-switch {
    position: relative;
    flex: 0 0 auto;
    width: 46px;
    height: 26px;
}

.mgm-cc-switch input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.mgm-cc-switch input:disabled {
    cursor: not-allowed;
}

.mgm-cc-switch__track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #b8c0c9;
    transition: background-color 0.2s;
}

.mgm-cc-switch__track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s;
}

.mgm-cc-switch input:checked + .mgm-cc-switch__track {
    background: var(--mgm-cc-brand);
}

.mgm-cc-switch input:checked + .mgm-cc-switch__track::after {
    transform: translateX(20px);
}

.mgm-cc-switch input:disabled + .mgm-cc-switch__track {
    opacity: 0.55;
}

.mgm-cc-dialog__footer {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--mgm-cc-border);
    background: var(--mgm-cc-soft);
}

.mgm-cc-dialog__spacer {
    flex: 1 1 auto;
}

/* Confirmation toast */

.mgm-cc-toast {
    position: fixed;
    z-index: 2147483001;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    max-width: calc(100vw - 32px);
    padding: 12px 20px;
    border-radius: 10px;
    background: var(--mgm-cc-text);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(16, 24, 40, 0.25);
    animation: mgm-cc-rise 0.2s ease-out;
}

/* Footer links rendered as buttons */

.mgm-cc-footer-link {
    appearance: none;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.mgm-cc-footer-link:hover {
    text-decoration: underline;
}

@keyframes mgm-cc-rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.mgm-cc-toast {
    animation-name: mgm-cc-toast-rise;
}

@keyframes mgm-cc-toast-rise {
    from { opacity: 0; transform: translate(-50%, 12px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes mgm-cc-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes mgm-cc-pop {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

@media (max-width: 860px) {
    .mgm-cc-banner {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding: 18px;
    }

    .mgm-cc-banner__actions {
        flex-wrap: wrap;
    }

    .mgm-cc-banner__actions .mgm-cc-btn--primary {
        flex: 1 1 140px;
    }

    .mgm-cc-banner__actions .mgm-cc-btn--link {
        order: 3;
        flex: 1 1 100%;
    }
}

@media (max-width: 520px) {
    .mgm-cc-banner {
        left: 8px;
        right: 8px;
        bottom: 8px;
    }

    .mgm-cc-modal {
        align-items: flex-end;
        padding: 0;
    }

    .mgm-cc-dialog {
        width: 100%;
        max-height: 92vh;
        max-height: 92dvh;
        border-radius: 16px 16px 0 0;
    }

    .mgm-cc-dialog__footer .mgm-cc-btn {
        flex: 1 1 100%;
    }

    .mgm-cc-dialog__spacer {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mgm-cc-banner,
    .mgm-cc-modal,
    .mgm-cc-dialog,
    .mgm-cc-toast {
        animation: none;
    }

    .mgm-cc-switch__track,
    .mgm-cc-switch__track::after,
    .mgm-cc-category {
        transition: none;
    }
}
