/* CSS Variables */
:root {
    scrollbar-gutter: stable;

    /* Default colors (fallbacks) */
    --primary-yellow: #FFC107;
    --primary-purple: #A78BFA;
    --backdrop-color: #000000;

    --bg-light: #ffffff;
    --bg-dark: #1e293b;
    --text-dark: #1e293b;
    --text-light: #ffffff;

    /* Custom easing curves for polished animations */
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);

    /* Transition */
    --transition-speed: 200ms;

    /* Spacing */
    --container-max-width: 1200px;
    /* Sizes */
    --btn-size-sm: 2rem;
    --btn-size-md: 2.5rem;
    --btn-size-lg: 3rem;

    /* Horizontal padding per size */
    --btn-px-sm: 0.75rem;
    --btn-px-md: 1rem;
    --btn-px-lg: 1.25rem;
    /* Default border radius (fallbacks when shop design not available) */
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;

    /* Shadows */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --text-shadow-medium: 0 1px 8px rgba(0, 0, 0, 0.8);

    /* CM.com font */
    --font-cm: 'Nunito', sans-serif;

    /* Resolved color aliases */
    --c-primary: var(--primary-button-color, var(--primary-yellow));
    --c-primary-text: var(--primary-button-text-color, var(--text-dark));
    --c-primary-hover: color-mix(in srgb, var(--primary-button-color, var(--primary-yellow)) 92%, white);
    --c-primary-active: color-mix(in srgb, var(--primary-button-color, var(--primary-yellow)) 94%, black);
    --c-secondary: var(--secondary-button-color, var(--primary-purple));
    --c-secondary-text: var(--secondary-button-text-color, var(--text-dark));
    --c-secondary-hover: color-mix(in srgb, var(--secondary-button-color, var(--primary-purple)) 92%, white);
    --c-secondary-active: color-mix(in srgb, var(--secondary-button-color, var(--primary-purple)) 94%, black);
    --c-body-bg: var(--body-background-color-rgba, var(--bg-light));
    --c-body-bg-solid: var(--body-background-color, var(--bg-light));
    --c-body-text: var(--body-text-color, var(--text-dark));
    --c-body-bg-image: var(--body-background-image, none);
    --b-blur: var(--blending-blur, 0px);
    --b-edge: 1px solid rgba(255, 255, 255, 0.05);
    --b-blending: blur(4px);
    --c-product-bg: var(--product-background-color-rgba, var(--product-background-color, var(--bg-dark)));
    --c-product-bg-solid: var(--product-background-color, var(--bg-dark));
    --c-product-text: var(--product-text-color, var(--text-light));
    --c-product-dim: color-mix(in srgb, var(--product-text-color, var(--text-dark)) 80%, transparent);

    /* Resolved border-radius aliases */
    --r-btn: var(--border-radius-button, var(--radius-xl));
    --r-btn-round: var(--border-radius-button-round, 50%);
    --r-card: var(--border-radius-card, var(--radius-lg));
    --r-modal: var(--border-radius-modal, var(--radius-xl));

    /* Type Scale */
    --fs-2xs: 0.55rem;
    --fs-xs: 0.6875rem;
    --fs-sm: 0.75rem;
    --fs-base: 1rem;
    --fs-md: 1.125rem;
    --fs-lg: 1.5rem;
    --fs-xl: 2rem;
    --fs-2xl: 2.25rem;
    --fs-3xl: 3rem;
    --fs-4xl: 3.5rem;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--c-primary) transparent;
}

/* Semantic Type System */
h1, h2, h3 {
    margin: 0;
    line-height: 1.1;
    letter-spacing: -0.02em;
    font-weight: 700;
}

h4 {
    margin: 0;
    line-height: 1.25;
    letter-spacing: -0.01em;
    font-weight: 600;
}

h1 {
    font-size: var(--fs-2xl);
}

h2 {
    font-size: var(--fs-xl);
}

h3 {
    font-size: var(--fs-lg);
}

h4 {
    font-size: var(--fs-md);
}

summary,
label,
p {
    margin: 0;
    line-height: 1.65;
}

p:empty {
    padding: var(--fs-base);
}

/* Details / summary disclosure */
details > summary {
    list-style: none;
    display: block;
    cursor: default;
    pointer-events: none;
}

details > summary::-webkit-details-marker {
    display: none;
}

.description-collapsed details > summary {
    pointer-events: auto;
    cursor: pointer;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

.description-collapsed details[open] > summary {
    overflow: visible;
    display: block;
    -webkit-line-clamp: unset;
}

a {
    color: inherit;
}

hr {
    width: 100%;
    border: none;
    border-top: 2px solid var(--c-body-text);
    opacity: 0.2;
    margin: 0.5rem 0;
}

time {
    font-weight: 500;
    letter-spacing: 0.03em;
}

address {
    font-weight: 500;
    font-style: normal;
}

input,
button,
select,
textarea {
    font-size: var(--fs-base);
    font-weight: 500;
}

small {
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.03em;
}

@media (min-width: 769px) {
    h1 {
        font-size: var(--fs-4xl);
    }

    h2 {
        font-size: var(--fs-2xl);
    }

    small {
        font-size: var(--fs-sm);
        letter-spacing: 0.05em;
    }
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family, "Nunito", -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial), sans-serif;
    background-color: var(--c-body-bg-solid);
    color: var(--c-body-text);
    line-height: 1.6;
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: 36px;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image: var(--c-body-bg-image);
    background-size: cover;
    background-position: center;
    filter: blur(var(--b-blur));
}

body:has(dialog[open]) {
    overflow: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--c-primary);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--c-primary-hover);
}

/* Force font inheritance for elements that don't inherit by default */
input,
button,
select,
textarea {
    font-family: inherit;
}

/* Color classes */
.cl-body--bg {
    background-color: var(--c-body-bg) !important;
}

.cl-body--bg-solid {
    background-color: var(--c-body-bg-solid) !important;
}

.cl-body--text {
    color: var(--c-body-text) !important;
}

/* Shared base for buttons, selects, and inputs */
.control {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    height: var(--btn-size-md);
    padding: 0 var(--btn-px-md);
    border: var(--b-edge);
    border-radius: var(--r-btn);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-speed) var(--ease-out), background var(--transition-speed) var(--ease-out), color var(--transition-speed) var(--ease-out);
}

.control .icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.control:active {
    box-shadow: var(--shadow-md);
}

.control:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
    .control:hover {
        box-shadow: var(--shadow-lg);
    }
}

.control--sm {
    height: var(--btn-size-sm);
    padding: 0 var(--btn-px-sm);
    gap: 0.25rem;
}

.control--sm .icon {
    width: 16px;
    height: 16px;
}

.control--lg {
    height: var(--btn-size-lg);
    padding: 0 var(--btn-px-lg);
    gap: 0.5rem;
}

.control--lg .icon {
    width: 24px;
    height: 24px;
}

/* Button color variants */
.btn,
select.control {
    cursor: pointer;
}

.btn {
    background: var(--c-secondary);
    color: var(--c-secondary-text);
    text-decoration: none;
}

@media (hover: hover) and (pointer: fine) {
    .btn:hover {
        background: var(--c-secondary-hover);
    }

    .btn--primary:hover {
        background: var(--c-primary-hover);
    }
}

.btn:active {
    background: var(--c-secondary-active);
}

.btn--primary:active {
    background: var(--c-primary-active);
}

.btn--primary {
    background: var(--c-primary);
    color: var(--c-primary-text);
}

.btn--round {
    aspect-ratio: 1;
    border-radius: var(--r-btn-round);
    padding: 0;
}

.btn--text {
    background: transparent;
    color: inherit;
    font-size: inherit;
    text-decoration: underline;
    box-shadow: none;
    border: none;
    padding: unset;
}

@media (hover: hover) and (pointer: fine) {
    .btn--text:hover {
        background: transparent;
        box-shadow: none;
        opacity: 0.8;
    }
}

.btn--text:active {
    background: transparent;
    box-shadow: none;
}

/* Input/select color base */
.input {
    background: var(--c-product-bg-solid);
    color: var(--c-product-text);
}

.input::placeholder {
    color: var(--c-product-dim);
}

input.input {
    outline: none;
}

/* Label + required marker */
.label {
    display: block;
    color: var(--c-body-text);
    margin-left: calc(var(--r-btn) / 2);
}

.label:has(+ :required)::after,
.label:has(+ * :required)::after {
    content: ' *';
    color: var(--c-primary);
    font-family: var(--font-cm);
}

.error-msg {
    display: block;
    margin-left: calc(var(--r-btn) / 2);
}

.checkbox {
    display: flex;
    align-items: center;
    min-height: var(--btn-size-md);
    gap: 0.75rem;
    padding: var(--btn-px-md);
    border: var(--b-edge);
    border-radius: var(--r-card);
    box-shadow: var(--shadow-sm);
    background: var(--c-product-bg-solid);
    color: var(--c-product-text);
}

.checkbox input {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--c-primary);
    cursor: pointer;
}

.checkbox label {
    cursor: pointer;
    color: var(--c-product-text);
}

.checkbox input:required + label::after {
    content: ' *';
    color: var(--c-primary);
    font-family: var(--font-cm);
}

/* Utilities */
.w-full {
    width: 100%;
}

/* Form layout */
.form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form--row {
    display: flex;
    flex-direction: column;
    gap: 1rem;

    * {
        flex: 1;
    }
}

@media (min-width: 769px) {
    .form--row {
        flex-direction: row;
        gap: 0.75rem;
    }
}

/* Compact select wrapper — injects a custom chevron; place on the wrapping div */
.select-compact {
    position: relative;
}

.select-compact select {
    appearance: none;
    padding-right: 2.5rem;
}

.select-compact::after {
    content: '';
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    pointer-events: none;
    background-color: var(--c-product-text);
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5 7.5l5 5 5-5' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: 20px;
}

/* Shared Dialog Base */
.dialog {
    border: none;
    padding: 0;
    width: 95vw;
    max-width: 600px;
    border-radius: var(--r-modal);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background: var(--c-body-bg-solid);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    opacity: 1;
    transition: opacity var(--transition-speed) var(--ease-out), transform var(--transition-speed) var(--ease-out), display var(--transition-speed) allow-discrete, overlay var(--transition-speed) allow-discrete;
}

@starting-style {
    .dialog[open] {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
}

.dialog::backdrop {
    background: var(--backdrop-color);
    opacity: 0.5;
    transition: opacity var(--transition-speed) var(--ease-out), display var(--transition-speed) allow-discrete, overlay var(--transition-speed) allow-discrete;
}

.active-blending {
    backdrop-filter: var(--b-blending);
}

@starting-style {
    .dialog[open]::backdrop {
        opacity: 0;
    }
}

.dialog-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
}

.dialog-simple-content {
    background: var(--c-body-bg-solid);
    color: var(--c-body-text);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-height: 90vh;
    max-height: 90dvh;
    container-type: inline-size;
}

.dialog-simple-body {
    overflow-y: auto;
    padding: 4px;
    margin: -4px;
}

.dialog-simple-title {
    color: var(--c-body-text);
}

@media (min-width: 769px) {
    .dialog-simple-content {
        gap: 2rem;
    }
}

/* Icon System - Using CSS Masks */
.icon {
    display: inline-block;
    vertical-align: middle;
    background-color: currentColor;
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
}

/* Icon sizes */
.icon-sm {
    width: 16px;
    height: 16px;
}

.icon-md {
    width: 20px;
    height: 20px;
}

.icon-lg {
    width: 24px;
    height: 24px;
}

.icon-xl {
    width: 80px;
    height: 80px;
}

/* Icon types */
.icon-dashboard {
    mask-image: url('https://www.cm.com/app/aurora-static/svg/icons/dashboard.svg');
}

.icon-align-justify {
    mask-image: url('https://www.cm.com/app/aurora-static/svg/icons/align-justify.svg');
}

.icon-calendar {
    mask-image: url('https://www.cm.com/app/aurora-static/svg/icons/calendar.svg');
}

.icon-close {
    mask-image: url('https://www.cm.com/app/aurora-static/svg/icons/close.svg');
}

.icon-ticket-type {
    mask-image: url('https://www.cm.com/app/aurora-static/svg/icons/ticket-type.svg');
}

.icon-previous {
    mask-image: url('https://www.cm.com/app/aurora-static/svg/icons/previous.svg');
}

.icon-next {
    mask-image: url('https://www.cm.com/app/aurora-static/svg/icons/next.svg');
}

.icon-right {
    mask-image: url('https://www.cm.com/app/aurora-static/svg/icons/right.svg');
}

.icon-zoom-out {
    mask-image: url('https://www.cm.com/app/aurora-static/svg/icons/zoom-out.svg');
}

.icon-search {
    mask-image: url('https://www.cm.com/app/aurora-static/svg/icons/search.svg');
}

.icon-location {
    mask-image: url('https://www.cm.com/app/aurora-static/svg/icons/location-open.svg');
}

.icon-help {
    mask-image: url('https://www.cm.com/app/aurora-static/svg/icons/help-simple.svg');
}

.icon-share {
    mask-image: url('https://www.cm.com/app/aurora-static/svg/icons/share.svg');
}

.icon-ticket {
    mask-image: url('https://www.cm.com/app/aurora-static/svg/icons/ticket.svg');
}

.icon-notification {
    mask-image: url('https://www.cm.com/app/aurora-static/svg/icons/notification.svg');
}

.icon-spinner {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Ccircle cx='12' cy='12' r='9' stroke='currentColor' stroke-width='2' stroke-dasharray='42 14' stroke-linecap='round'/%3E%3C/svg%3E");
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Top Bar */
.top-bar {
    margin-bottom: 2rem;
}

.top-bar-content {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.top-bar-left,
.top-bar-right {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

/* CM Footer */
.cm-footer {
    font-family: var(--font-cm);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--c-body-bg-solid);
    color: var(--c-body-text);
    container-type: inline-size;
    z-index: 10;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.08);
}

.cm-footer img {
    margin-right: 0.5rem;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    object-fit: contain;
    border: 1px solid white;
    border-radius: 50%;
}

.cm-footer .mobile {
    display: block;
}

.cm-footer .desktop {
    display: none;
}

@container (min-width: 769px) {
    .cm-footer .mobile {
        display: none;
    }

    .cm-footer .desktop {
        display: block;
    }
}

#legal-notice-dialog {
    font-family: var(--font-cm);
}

/* Legal notice dialog body */
.legal-notice-body a {
    color: inherit;
    text-decoration: underline;
}

/* HTMX indicator */
.htmx-indicator.indicator-delayed {
    transition: 500ms opacity ease-in-out, 500ms visibility ease-in-out;
}

.htmx-indicator.indicator-hidden {
    display: none;
}

.htmx-request .htmx-indicator.indicator-hidden, .htmx-request.htmx-indicator.indicator-hidden {
    display: inherit;
}

/* Loader */
.loader {
    position: fixed;
    top: 0;
    z-index: 100;
    height: 3px;
    width: 100%;
    overflow: hidden;
}

.loader::after {
    content: "";
    display: block;
    height: 100%;
    width: 40%;
    border-radius: 3px;
    background: var(--c-primary);
    animation: loader-sweep 1.4s ease-in-out infinite;
}

@keyframes loader-sweep {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(350%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .loader::after {
        animation: none;
        width: 100%;
        opacity: 0.6;
    }
}
