/* Shared service selection and price-entry controls for invoice and reservation editors. */
.reservation-modification-modal :is(.bookable-service-select-meta, .bookable-service-option-meta, .bookable-service-option-name, .bookable-service-group-heading, .rdr-price-item-totals, .rdr-price-table, .customer-item-add-price-button) {
    font-size: .85rem;
}

.reservation-modification-modal .bookable-service-group-heading {
    text-transform: none;
    letter-spacing: normal;
}

.customer-item-add-section {
    border-color: var(--wm-border);
}

.rdr-price-list {
    display: grid;
    gap: 1rem;
}

.rdr-price-item {
    background: #fff;
    border: 1px solid var(--wm-border);
    border-radius: var(--wm-radius-lg);
    overflow: hidden;
}

.customer-item-editor {
    display: block;
    border-color: var(--wm-border);
    border-radius: var(--wm-radius-md);
    overflow: visible;
}

.customer-item-service-selector {
    min-width: 0;
    padding: 0;
    background: transparent;
    border: 0;
}

.customer-item-service-selector > .dropdown {
    width: 100%;
    max-width: 26rem;
}

.customer-item-service-selector.has-parent-rdr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 0.25rem 0.75rem;
}

.customer-item-service-selector.has-parent-rdr > .dropdown {
    max-width: none;
}

.customer-item-service-selector.has-parent-rdr > .dropdown:first-child {
    grid-column: 2;
    grid-row: 1;
    order: 2;
}

.customer-item-service-selector.has-parent-rdr > .dropdown:first-child + .text-danger {
    grid-column: 2;
    grid-row: 2;
    order: 4;
}

.customer-item-service-selector.has-parent-rdr > .dropdown.mt-2 + .text-danger {
    grid-column: 1;
    grid-row: 2;
    order: 3;
}

.customer-item-editor > .rdr-price-item-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--wm-primary-light);
    border-bottom-color: var(--wm-primary-lighter);
}

.customer-item-editor .rdr-price-item-totals {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
}

.customer-item-editor > [data-valmsg-for*=".PriceEntries"],
.customer-item-editor > [data-customer-price-editor] {
    grid-column: 1 / -1;
}

.customer-item-editor > [data-valmsg-for*=".PriceEntries"]:empty {
    display: none;
}

.customer-item-editor > [data-customer-price-editor] {
    display: block;
    background: #fff;
    border-radius: 0 0 var(--wm-radius-md) var(--wm-radius-md);
    overflow: hidden;
}

.customer-item-price-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0.65rem 0.75rem 0.75rem;
    background: #fff;
}

.customer-items-actions {
    display: flex;
    padding-top: 0.75rem;
}

.customer-item-add-card {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    min-height: 4.25rem;
    padding: 0.75rem 1.25rem;
    color: var(--wm-primary);
    background: #fff;
    border: 1px dashed var(--wm-border-light);
    border-radius: var(--wm-radius-xl);
    font-size: 0.875rem;
    letter-spacing: 0.01em;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.customer-item-add-icon {
    display: grid;
    width: 2.25rem;
    height: 2.25rem;
    place-items: center;
    color: var(--wm-primary);
    background: var(--wm-primary-light);
    border: 1px solid var(--wm-primary-lighter);
    border-radius: var(--wm-radius-md);
    font-size: 0.85rem;
}

.customer-item-add-card:hover,
.customer-item-add-card:focus-visible {
    background: var(--wm-surface);
    border-color: var(--wm-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--wm-primary-rgb), 0.08);
    outline: none;
}

.customer-item-add-price-button {
    display: inline-flex;
    min-height: 2.125rem;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.35rem 0.8rem;
    color: var(--wm-primary);
    background: var(--wm-primary-light);
    border: 1px solid var(--wm-primary-lighter);
    border-radius: var(--wm-radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.customer-item-add-price-button:hover,
.customer-item-add-price-button:focus-visible {
    color: #fff;
    background: var(--wm-primary);
    border-color: var(--wm-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--wm-primary-rgb), 0.1);
}

.rdr-price-item-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    background: var(--wm-primary-light);
    border-bottom: 1px solid var(--wm-primary-lighter);
}

.rdr-price-item-title {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 0.65rem;
}

.rdr-price-item-name {
    min-width: 0;
    font-size: 0.875rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.rdr-price-item-meta {
    margin-top: 0.1rem;
    color: var(--bs-secondary-color);
    font-size: 0.68rem;
}

.rdr-price-item-totals {
    display: grid;
    flex: 0 0 auto;
    justify-items: end;
    gap: 0.1rem;
    font-size: 0.7rem;
    font-variant-numeric: tabular-nums;
}

.rdr-price-item-totals > span {
    color: var(--bs-secondary-color);
}

.rdr-price-item-totals strong {
    color: var(--wm-primary);
}

.rdr-price-table {
    min-width: 48rem;
    font-size: 0.75rem;
}

.rdr-price-table thead th {
    padding: 0.55rem 0.75rem;
    color: var(--bs-secondary-color);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.035em;
    text-transform: uppercase;
    background: var(--wm-surface);
    border-bottom-color: var(--wm-border);
    white-space: nowrap;
}

.rdr-price-table tbody td {
    padding: 0.65rem 0.75rem;
    border-bottom-color: var(--wm-border);
}

.rdr-price-table tbody tr:last-child td {
    border-bottom: 0;
}

.rdr-price-edit {
    display: flex;
    align-items: stretch;
    width: 8.5rem;
    min-width: 0;
    background: var(--bs-body-bg);
    border: var(--bs-border-width) solid var(--wm-border);
    border-radius: var(--wm-radius-md);
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.rdr-price-edit-currency {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    background: var(--wm-surface);
    border-inline-end: var(--bs-border-width) solid var(--wm-border);
}

.rdr-price-edit > .form-control,
.rdr-price-edit > .form-control:focus {
    min-width: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.rdr-price-edit:focus-within {
    border-color: var(--wm-primary);
    box-shadow: 0 0 0 0.15rem rgba(var(--wm-primary-rgb), 0.14);
}

.rdr-add-price-table {
    min-width: 64rem;
}

.rdr-add-price-quantity {
    width: 5.5rem;
    margin-left: auto;
}

.customer-item-editor [data-customer-total-input] {
    appearance: textfield;
    -moz-appearance: textfield;
}

.customer-item-editor [data-customer-total-input]::-webkit-inner-spin-button,
.customer-item-editor [data-customer-total-input]::-webkit-outer-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.bookable-service-select {
    display: block;
    width: 100%;
    min-height: 3.5rem;
    padding: 0.55rem 0.75rem;
    color: var(--bs-body-color);
    background-color: var(--bs-body-bg);
    border: 1px solid var(--wm-border);
    border-radius: var(--wm-radius-md);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.bookable-service-select:hover {
    border-color: var(--wm-primary-lighter);
    background: var(--wm-surface);
}

.bookable-service-select:focus-visible,
.bookable-service-select[aria-expanded="true"] {
    border-color: var(--wm-primary);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(var(--wm-primary-rgb), 0.12);
}

.bookable-service-select.has-selection {
    border-color: var(--wm-primary-lighter);

}

.bookable-service-select-content {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr) auto;
    width: 100%;
    min-width: 0;
    align-items: center;
    gap: 0.7rem;
}

.bookable-service-select-loading {
    display: none;
    align-items: center;
    gap: 0.55rem;
    color: var(--wm-muted);
    font-size: 0.8125rem;
}

.bookable-service-select.htmx-request .bookable-service-select-content {
    display: none;
}

.bookable-service-select.htmx-request .bookable-service-select-loading {
    display: inline-flex;
}

.bookable-service-select-copy {
    display: grid;
    min-width: 0;
    gap: 0.05rem;
}

.bookable-service-select-name,
.bookable-service-select-meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bookable-service-select-name {
    color: var(--bs-body-color);
    font-size: 0.85rem;
    line-height: 1.2;
}

.bookable-service-select.has-selection .bookable-service-select-name {
    font-weight: 600;
}

.bookable-service-select-meta {
    color: var(--wm-muted);
    font-size: 0.7rem;
}

.bookable-service-select-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.bookable-service-select-check {
    color: var(--wm-primary);
    opacity: 0;
    transform: scale(0.75);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.bookable-service-select.has-selection .bookable-service-select-check {
    opacity: 1;
    transform: scale(1);
}

.bookable-service-select-chevron {
    color: var(--wm-muted);
    font-size: 0.75rem;
    transition: transform 0.15s ease;
}

.bookable-service-select[aria-expanded="true"] .bookable-service-select-chevron {
    transform: rotate(180deg);
}

.bookable-service-select-icon,
.bookable-service-option-icon {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    color: var(--wm-primary);
    background: var(--wm-primary-light);
    border-radius: var(--wm-radius-md);
}

.bookable-service-select-icon {
    width: 2rem;
    height: 2rem;
}

.bookable-service-menu {
    padding: 0.45rem;
    border-color: var(--wm-border);
    border-radius: var(--wm-radius-lg);
    box-shadow: var(--wm-shadow-md);
    overflow-x: hidden;
}

.bookable-service-group-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.4rem 0.55rem;
    color: var(--wm-muted);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-top: 0.45rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--wm-border);
}

.bookable-service-menu > .bookable-service-group-heading:first-child {
    margin-top: 0;
    padding-top: 0.35rem;
    border-top: 0;
}

.bookable-service-group-heading > span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.bookable-service-option {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr) 1.25rem;
    align-items: center;
    gap: 0.65rem;
    min-height: 3.25rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid transparent;
    border-radius: var(--wm-radius-md);
    transition: border-color 0.15s ease, background-color 0.15s ease;
    white-space: normal;
}

.bookable-service-menu li + li .bookable-service-option {
    margin-top: 0.15rem;
}

.bookable-service-option:hover,
.bookable-service-option:focus-visible,
.bookable-service-option.active {
    color: var(--bs-body-color);
    background: var(--wm-primary-light);
    border-color: var(--wm-primary-lighter);
    outline: 0;
}

.bookable-service-option-icon {
    width: 2rem;
    height: 2rem;
}

.bookable-service-select-icon.is-addon,
.bookable-service-option-icon.is-addon {
    color: var(--wm-info-text);
    background: var(--wm-info-bg);
}

.bookable-service-select-icon.is-package,
.bookable-service-option-icon.is-package {
    color: var(--wm-warning-text);
    background: var(--wm-warning-bg);
}

.bookable-service-select-icon.is-other,
.bookable-service-option-icon.is-other {
    color: var(--wm-muted);
    background: var(--wm-surface);
}

.bookable-service-option-content {
    display: grid;
    min-width: 0;
    gap: 0.1rem;
}

.bookable-service-option-name {
    overflow: hidden;
    font-size: 0.8125rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bookable-service-option-meta {
    overflow: hidden;
    color: var(--wm-muted);
    font-size: 0.68rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bookable-service-option-check {
    color: var(--wm-primary);
    opacity: 0;
    transform: scale(0.75);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.bookable-service-option.active .bookable-service-option-check {
    opacity: 1;
    transform: scale(1);
}
