/* Scoped to this plugin; existing Bookory, checkout and invoice styles are untouched. */
.en-modal,
.en-cart-reservations,
.en-product-hint {
    --en-primary: var(--e-global-color-primary, #ba242a);
    --en-primary-hover: var(--e-global-color-primary_hover, #a94442);
    --en-text: #242424;
    --en-muted: #666;
    --en-border: #e6e6e6;
    --en-soft: #faf4f4;
    font-family: inherit;
    color: var(--en-text);
}

.en-modal *,
.en-cart-reservations * {
    box-sizing: border-box;
}

.en-modal [hidden],
.en-cart-reservations[hidden],
.en-cart-reservations [hidden],
.en-product-hint[hidden],
.en-quantity-hidden {
    display: none !important;
}

.en-product-hint {
    flex: 0 0 100%;
    width: 100%;
    margin: 10px 0 16px;
    padding: 12px 15px;
    border-left: 3px solid var(--en-primary);
    border-radius: 0 8px 8px 0;
    background: var(--en-soft);
    font-size: 13px;
    line-height: 1.65;
    font-weight: 400;
}

html.en-modal-open {
    overflow: hidden;
}

.en-modal {
    width: min(920px, calc(100vw - 40px));
    max-width: none;
    max-height: min(920px, calc(100dvh - 48px));
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 24px 90px rgb(0 0 0 / 24%);
    overflow: hidden;
    overscroll-behavior: contain;
    font-size: 14px;
    line-height: 1.5;
    text-align: left;
}

.en-modal::backdrop {
    background: rgb(20 16 17 / 58%);
    backdrop-filter: blur(3px);
}

.en-modal--fallback[open] {
    position: fixed;
    inset: 24px 0;
    z-index: 2147483646;
    height: fit-content;
    box-shadow: 0 0 0 100vmax rgb(20 16 17 / 58%), 0 24px 90px rgb(0 0 0 / 24%);
}

.en-modal-panel {
    display: flex;
    flex-direction: column;
    max-height: min(920px, calc(100dvh - 48px));
    min-height: 0;
}

.en-modal-header {
    display: flex;
    flex: 0 0 auto;
    align-items: flex-start;
    gap: 24px;
    padding: 28px 30px 21px;
}

.en-modal-heading {
    flex: 1;
    min-width: 0;
}

.en-modal .en-eyebrow {
    margin: 0 0 8px;
    color: var(--en-primary);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: 1.35px;
    text-transform: uppercase;
}

.en-modal .en-modal-title {
    margin: 0;
    color: var(--en-text);
    font-family: inherit;
    font-size: clamp(21px, 3.4vw, 28px);
    line-height: 1.3;
    font-weight: 600;
    letter-spacing: -0.8px;
}

.en-modal .en-product-title {
    margin: 9px 0 0;
    color: var(--en-muted);
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.en-modal button {
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

.en-modal button::before,
.en-modal button::after {
    content: none;
}

.en-modal .en-close {
    display: inline-flex;
    flex: 0 0 40px;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--en-border);
    border-radius: 50%;
    background: #fff;
    color: #454545;
    cursor: pointer;
}

.en-modal .en-close:hover {
    border-color: var(--en-primary);
    background: var(--en-soft);
    color: var(--en-primary);
}

.en-icon {
    display: inline-flex;
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
}

.en-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.en-reservation-rule {
    display: flex;
    flex: 0 0 auto;
    align-items: flex-start;
    gap: 12px;
    margin: 0 30px 18px;
    padding: 15px 17px;
    border: 1px solid #edd6d7;
    border-radius: 12px;
    background: var(--en-soft);
    color: var(--en-text);
}

.en-reservation-rule .en-icon {
    color: var(--en-primary);
}

.en-reservation-rule strong {
    display: block;
    font-size: 13px;
    line-height: 1.5;
    font-weight: 600;
}

.en-reservation-rule p {
    margin: 4px 0 0;
    color: #5c5051;
    font-size: 12px;
    line-height: 1.65;
}

.en-toolbar {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 0 30px 16px;
}

.en-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
}

.en-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #666;
    font-size: 11px;
    line-height: 1.4;
    white-space: nowrap;
}

.en-legend-dot {
    display: inline-block;
    flex: 0 0 11px;
    width: 11px;
    height: 11px;
    border: 1px solid #c9c9c9;
    border-radius: 3px;
    background: #fff;
}

.en-legend-dot--selected {
    border-color: var(--en-primary);
    background: var(--en-primary);
}

.en-legend-dot--unavailable {
    border-color: #e7e7e7;
    background: #e7e7e7;
}

.en-legend-dot--mine {
    border-color: #b37c25;
    background: #fbf3e5;
}

.en-modal .en-refresh {
    min-height: 28px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #666;
    font-size: 11px;
    line-height: 1.4;
    font-weight: 400;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    white-space: nowrap;
}

.en-modal .en-refresh:hover {
    background: transparent;
    color: var(--en-primary);
}

.en-modal-message {
    flex: 0 0 auto;
    margin: 0 30px 12px;
    padding: 10px 13px;
    border-radius: 8px;
    background: #f4f4f4;
    color: #444;
    font-size: 12px;
    line-height: 1.6;
}

.en-modal-message--error {
    border-left: 3px solid var(--en-primary);
    background: var(--en-soft);
    color: #8b2025;
}

.en-grid-wrap {
    flex: 1 1 auto;
    min-height: 86px;
    padding: 2px 30px 24px;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.en-number-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 7px;
}

.en-number-grid[aria-busy="true"] {
    opacity: 0.65;
    cursor: progress;
}

.en-modal .en-number {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    height: 43px;
    margin: 0;
    padding: 2px;
    border: 1px solid #d8d8d8;
    border-radius: 8px;
    background: #fff;
    color: #303030;
    box-shadow: none;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: border-color 0.12s ease, background-color 0.12s ease, color 0.12s ease;
}

.en-modal .en-number:hover:not(:disabled) {
    border-color: var(--en-primary);
    background: var(--en-soft);
    color: var(--en-primary);
}

.en-modal .en-number--selected,
.en-modal .en-number--selected:hover:not(:disabled) {
    border-color: var(--en-primary);
    background: var(--en-primary);
    color: #fff;
    font-weight: 600;
}

.en-modal .en-number--selected::after {
    content: '';
    position: absolute;
    right: 5px;
    top: 4px;
    width: 4px;
    height: 7px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
}

.en-modal .en-number--unavailable,
.en-modal .en-number--unavailable:hover {
    border-color: #e8e8e8;
    background: #eeeeef;
    color: #949494;
    opacity: 1;
    cursor: not-allowed;
    text-decoration: line-through;
    text-decoration-thickness: 1px;
}

.en-modal .en-number--mine,
.en-modal .en-number--mine:hover {
    border-color: #d2b581;
    background: #fbf3e5;
    color: #8b601d;
    opacity: 1;
    cursor: not-allowed;
    font-weight: 600;
}

.en-modal .en-number:disabled:not(.en-number--unavailable):not(.en-number--mine) {
    cursor: wait;
}

.en-modal-footer {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 30px 24px;
    border-top: 1px solid var(--en-border);
    background: #fff;
    box-shadow: 0 -8px 16px rgb(255 255 255 / 80%);
}

.en-selection {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}

.en-selection-count {
    font-size: 13px;
    line-height: 1.5;
    font-weight: 600;
}

.en-selected-list {
    color: var(--en-muted);
    font-size: 12px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.en-modal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
}

.en-modal .en-confirm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    margin: 0;
    padding: 13px 22px;
    border: 1px solid var(--en-primary);
    border-radius: 50px;
    background: var(--en-primary);
    color: #fff;
    box-shadow: none;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    cursor: pointer;
}

.en-modal .en-confirm:hover:not(:disabled) {
    border-color: var(--en-primary-hover);
    background: var(--en-primary-hover);
    color: #fff;
}

.en-modal .en-confirm:disabled {
    border-color: #e2e2e2;
    background: #e9e9e9;
    color: #777;
    opacity: 1;
    cursor: not-allowed;
}

.en-modal .en-cart-link,
.en-cart-reservations .en-reselect-link {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--en-primary);
    font-size: 12px;
    line-height: 1.6;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.en-modal .en-cart-link {
    max-width: 100px;
    text-align: right;
}

.en-modal button:focus-visible,
.en-modal a:focus-visible,
.en-cart-reservations a:focus-visible {
    outline: 3px solid #2c67a2;
    outline-offset: 3px;
}

.en-modal .en-close:disabled,
.en-modal .en-refresh:disabled {
    opacity: 0.5;
    cursor: wait;
}

.en-cart-reservations {
    clear: both;
    width: 100%;
    margin: 0 0 26px;
    padding: 21px 24px 12px;
    border: 1px solid #e6d7d8;
    border-radius: 14px;
    background: #fff;
    line-height: 1.55;
}

.en-cart-reservations-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 9px;
}

.en-cart-reservations-header .en-icon {
    color: var(--en-primary);
}

.en-cart-reservations .en-cart-reservations-title {
    margin: 0;
    color: #303030;
    font-family: inherit;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.45;
    letter-spacing: -0.3px;
}

.en-cart-reservations .en-cart-reservations-rule {
    margin: 0 0 10px;
    color: #666;
    font-size: 12px;
    line-height: 1.65;
}

.en-cart-reservations .en-cart-reservations-message {
    margin: 12px 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--en-soft);
    color: #8b2025;
    font-size: 12px;
    line-height: 1.6;
}

.en-cart-reservations .en-reservation-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.en-cart-reservations .en-reservation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0;
    padding: 13px 0;
    border-top: 1px solid #eee;
    list-style: none;
}

.en-reservation-details {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
}

.en-reservation-name {
    display: block;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.en-copy-label {
    color: var(--en-muted);
    font-size: 11px;
    line-height: 1.5;
}

.en-timer {
    flex: 0 0 auto;
    min-width: 68px;
    padding: 7px 10px;
    border-radius: 7px;
    background: var(--en-soft);
    color: var(--en-primary);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
    font-variant-numeric: tabular-nums;
    text-align: center;
    white-space: nowrap;
}

.en-reservation-item--expired .en-timer {
    background: #f9e9e9;
    color: #8b2025;
    font-size: 11px;
    white-space: normal;
}

.en-hold {
    display: block;
    margin-top: 3px;
    color: #756262;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.en-hold--expired {
    color: #a52329;
    font-weight: 600;
}

@media (max-width: 720px) {
    .en-modal {
        width: calc(100vw - 24px);
        max-height: calc(100dvh - 24px);
        border-radius: 16px;
    }

    .en-modal-panel {
        max-height: calc(100dvh - 24px);
    }

    .en-modal-header {
        gap: 16px;
        padding: 21px 20px 17px;
    }

    .en-reservation-rule {
        margin: 0 20px 14px;
        padding: 12px;
    }

    .en-toolbar {
        padding: 0 20px 13px;
    }

    .en-modal-message {
        margin-right: 20px;
        margin-left: 20px;
    }

    .en-grid-wrap {
        padding: 2px 20px 20px;
    }

    .en-number-grid {
        grid-template-columns: repeat(10, minmax(0, 1fr));
        gap: 6px;
    }

    .en-modal-footer {
        padding: 16px 20px 20px;
    }

    .en-modal-actions {
        gap: 10px;
    }

    .en-modal .en-confirm {
        padding: 12px 18px;
        font-size: 11px;
    }
}

@media (max-width: 520px) {
    .en-modal-header {
        padding: 18px 16px 15px;
    }

    .en-modal .en-eyebrow {
        font-size: 10px;
        margin-bottom: 6px;
    }

    .en-modal .en-modal-title {
        font-size: 21px;
    }

    .en-modal .en-product-title {
        font-size: 12px;
        margin-top: 7px;
    }

    .en-modal .en-close {
        flex-basis: 36px;
        width: 36px;
        height: 36px;
    }

    .en-reservation-rule {
        gap: 8px;
        margin: 0 16px 12px;
        padding: 11px;
    }

    .en-reservation-rule .en-icon {
        flex-basis: 20px;
        width: 20px;
        height: 20px;
    }

    .en-reservation-rule strong {
        font-size: 11px;
    }

    .en-reservation-rule p {
        font-size: 10px;
        line-height: 1.65;
    }

    .en-toolbar {
        gap: 7px;
        padding: 0 16px 10px;
    }

    .en-legend {
        gap: 8px 12px;
    }

    .en-legend-item {
        font-size: 10px;
        gap: 4px;
    }

    .en-modal .en-refresh {
        min-height: 24px;
        font-size: 10px;
    }

    .en-modal-message {
        margin: 0 16px 10px;
        font-size: 11px;
    }

    .en-grid-wrap {
        padding: 2px 16px 16px;
        min-height: 60px;
    }

    .en-number-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 6px;
    }

    .en-modal .en-number {
        height: 42px;
        font-size: 12px;
        border-radius: 6px;
    }

    .en-modal-footer {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
        padding: 13px 16px 16px;
    }

    .en-selection {
        gap: 3px;
    }

    .en-selection-count,
    .en-selected-list {
        font-size: 11px;
    }

    .en-modal-actions {
        justify-content: stretch;
    }

    .en-modal .en-confirm {
        flex: 1;
        min-height: 45px;
        font-size: 12px;
    }

    .en-modal .en-cart-link {
        flex: 0 0 auto;
        max-width: 82px;
        text-align: left;
        font-size: 11px;
    }

    .en-cart-reservations {
        padding: 17px 16px 8px;
        margin-bottom: 20px;
    }

    .en-cart-reservations .en-cart-reservations-title {
        font-size: 15px;
    }

    .en-cart-reservations .en-reservation-item {
        align-items: flex-start;
        gap: 10px;
    }

    .en-timer {
        max-width: 120px;
        min-width: 61px;
        font-size: 12px;
        white-space: normal;
    }
}

@media (max-height: 560px) and (min-width: 521px) {
    .en-modal-header { padding-top: 15px; padding-bottom: 12px; }
    .en-modal .en-eyebrow { display: none; }
    .en-modal .en-modal-title { font-size: 20px; }
    .en-modal .en-product-title { margin-top: 4px; font-size: 12px; }
    .en-reservation-rule { margin-bottom: 10px; padding: 9px 12px; }
    .en-toolbar { padding-bottom: 8px; }
    .en-modal-footer { padding-top: 12px; padding-bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .en-modal .en-number { transition: none; }
}

@media print {
    .en-modal,
    .en-cart-reservations,
    .en-hold,
    .en-product-hint { display: none !important; }
}
