/**
 * Tørring Camping – Booking antal-vælger styles
 * Bruges på produkt-sider med bookbare produkter hvor antal-valg er aktiveret.
 */

/* ===== Skjul WC Bookings' ressource-vælger ===== */
.wc-bookings-booking-form .wc_bookings_field_resource,
.wc-bookings-booking-form #wc_bookings_field_resource,
.wc-bookings-booking-form .form-field-resource {
    display: none !important;
}

/* Skjul WooCommerce's standard quantity (hvis det vises) */
form.cart > .quantity,
form.cart .woocommerce-variation-add-to-cart .quantity {
    display: none !important;
}

/* Skjul originale person-felter (vi flytter dem via JS) */
.wc-bookings-booking-form [class*="wc_bookings_field_persons_"] {
    display: none !important;
}
/* Legende labels */
legend.wc-pao-addon-name.wc-pao-legend {
    background: transparent;
}

/* ===== Vores brugerdefinerede antal-felt ===== */
.torring-qty-field {
    margin: 10px 0px 10px 0px;
    padding: 20px 24px;
    background: var(--e-global-color-f572244);
    border: 1px solid color-mix(in srgb, var(--e-global-color-f572244) 90%, var(--e-global-color-primary));
    border-radius: 8px;
}

.torring-qty-label {
    display: block;
    margin-bottom: 4px;
    font-weight: 700;
    font-size: 1.05em;
    color: #1a1a1a;
}

.torring-qty-resource-name {
    margin: 0 0 14px 0;
    font-size: 0.85em;
    color: #666;
    font-style: italic;
}

.torring-qty-input-wrap {
    display: inline-flex;
    align-items: center;
    border: 2px solid color-mix(in srgb, var(--e-global-color-primary) 15%, transparent) !important;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.torring-qty-field .torring-qty-btn {
    width: 40px !important;
    height: 40px !important;
    border: none !important;
    background: color-mix(in srgb, var(--e-global-color-primary) 15%, transparent) !important;
    font-size: 20px !important;
    font-weight: bold !important;
    color: #333 !important;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    -webkit-user-select: none;
    user-select: none;
    line-height: 1 !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    min-height: auto !important;
    box-shadow: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

.torring-qty-field .torring-qty-btn:hover {
    background: var(--e-global-color-primary) !important;
    color: #fff !important;
}

.torring-qty-field .torring-qty-btn:active {
    background: #ddd !important;
}

.torring-qty-field .torring-qty-input {
    width: 60px !important;
    height: 40px !important;
    border: none !important;
    border-left: 1px solid #eee !important;
    border-right: 1px solid #eee !important;
    text-align: center !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #1a1a1a !important;
    -moz-appearance: textfield;
    outline: none !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
    min-height: auto !important;
    min-width: 100px;
}

.torring-qty-input::-webkit-outer-spin-button,
.torring-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.torring-qty-info {
    margin: 8px 0 0 0;
    font-size: 0.8em;
    color: #888;
}

/* ===== Persons sektion (flyttet ind i boksen) ===== */
.torring-persons-section {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid color-mix(in srgb, var(--e-global-color-f572244) 90%, var(--e-global-color-primary));
}

.torring-persons-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.torring-person-field {
    flex: 1;
    min-width: 140px;
}

.torring-person-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9em;
    color: #333;
}

.torring-person-input-wrap {
    display: inline-flex;
    align-items: center;
    border: 2px solid color-mix(in srgb, var(--e-global-color-primary) 15%, transparent) !important;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    width: 100%;
    max-width: 185px;
}

.torring-qty-field .torring-person-btn,
.torring-qty-field .torring-person-input-wrap .torring-person-btn,
.torring-qty-field button.torring-person-btn {
    width: 40px !important;
    height: 40px !important;
    border: none !important;
    background: color-mix(in srgb, var(--e-global-color-primary) 15%, transparent) !important;
    background-color: color-mix(in srgb, var(--e-global-color-primary) 15%, transparent) !important;
    font-size: 18px !important;
    font-weight: bold !important;
    color: #333 !important;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    -webkit-user-select: none;
    user-select: none;
    line-height: 1 !important;
    flex-shrink: 0;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    min-height: auto !important;
    box-shadow: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

.torring-qty-field .torring-person-btn:hover {
    background: var(--e-global-color-primary) !important;
    color: #fff !important;
}

.torring-qty-field .torring-person-btn:active {
    background: #ddd !important;
}

.torring-qty-field .torring-person-input {
    width: 100% !important;
    height: 40px !important;
    border: none !important;
    border-left: 1px solid #eee !important;
    border-right: 1px solid #eee !important;
    text-align: center !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #1a1a1a !important;
    -moz-appearance: textfield;
    outline: none !important;
    flex: 1;
    min-width: 40px;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
    min-height: auto !important;
    min-width: 100px;
}

.torring-person-input::-webkit-outer-spin-button,
.torring-person-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ===== Live tilgængelighedsbesked ===== */
.torring-availability-message {
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    line-height: 1.4;
    display: none;
}

.torring-availability-message.torring-avail-error {
    display: block;
    background: #fce4ec;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

.torring-availability-message.torring-avail-ok {
    display: block;
    background: var(--e-global-color-f572244);
    color: var(--e-global-color-primary);
    border: 1px solid color-mix(in srgb, var(--e-global-color-f572244) 90%, var(--e-global-color-primary));
}

.torring-availability-message.torring-avail-loading {
    display: block;
    background: #f5f5f5;
    color: #888;
    border: 1px solid #ddd;
}

/* Deaktiveret Book Nu knap */
.wc-bookings-booking-form-button.torring-disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

/* ===== Fuldt bookede datoer i kalenderen ===== */
/* Høj specificity for at overskrive WC Bookings' .bookable styles */
.wc-bookings-date-picker .ui-datepicker table td.torring-fully-booked,
.wc-bookings-date-picker .ui-datepicker td.torring-fully-booked,
.ui-datepicker td.torring-fully-booked,
td.torring-fully-booked.bookable,
td.torring-fully-booked.partial_booked,
td.torring-fully-booked {
    background: #f5f5f5 !important;
    pointer-events: none !important;
    opacity: 0.5 !important;
}

.wc-bookings-date-picker .ui-datepicker table td.torring-fully-booked a,
.wc-bookings-date-picker .ui-datepicker td.torring-fully-booked a,
.ui-datepicker td.torring-fully-booked a,
td.torring-fully-booked.bookable a,
td.torring-fully-booked a.ui-state-default,
td.torring-fully-booked a,
td.torring-fully-booked span {
    color: #aaa !important;
    background: #e8e8e8 !important;
    cursor: default !important;
    text-decoration: line-through !important;
    pointer-events: none !important;
}

/* ===== Ressource-grid (Plads, Strøm osv.) ===== */
.torring-resource-grid,
#torring-resource-grid,
.torring-qty-field .torring-resource-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid color-mix(in srgb, var(--e-global-color-f572244) 90%, var(--e-global-color-primary));
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    overflow: visible !important;
    position: static !important;
}

.torring-resource-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    border: 2px solid color-mix(in srgb, var(--e-global-color-primary) 15%, transparent);
    border-radius: 8px;
    transition: border-color 0.2s, opacity 0.2s;
    overflow: hidden;
    min-width: 0;
}

.torring-resource-card.torring-resource-selected {
    border-color: var(--e-global-color-primary);
}

.torring-resource-card:not(.torring-resource-selected) {
    opacity: 0.55;
}

/* Låst første ressource (altid valgt, ingen toggle) */
.torring-resource-card.torring-resource-locked {
    opacity: 1;
    border-color: var(--e-global-color-primary);
    cursor: default;
}

.torring-resource-card.torring-resource-locked .torring-resource-hidden-input {
    display: none;
}

.torring-resource-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.torring-resource-name {
    font-weight: 600;
    font-size: 0.9em;
    color: #1a1a1a;
}

.torring-resource-price {
    font-size: 0.78em;
    color: var(--e-global-color-primary);
    font-weight: 500;
}

/* Toggle switch */
.torring-resource-toggle,
.wc-bookings-booking-form .torring-resource-toggle,
#wc-bookings-booking-form .torring-resource-toggle,
.torring-qty-field .torring-resource-toggle {
    position: relative;
    display: inline-flex !important;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
    margin-left: 10px;
}

.torring-resource-toggle .torring-resource-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.torring-resource-toggle .torring-resource-hidden-input {
    display: none;
}

.torring-toggle-switch {
    width: 40px;
    height: 22px;
    background: #ccc;
    border-radius: 11px;
    position: relative;
    transition: background 0.2s;
}

.torring-toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.torring-resource-checkbox:checked + .torring-toggle-switch {
    background: var(--e-global-color-primary);
}

.torring-resource-checkbox:checked + .torring-toggle-switch::after {
    transform: translateX(18px);
}

/* ===== WC Bookings pris-sektion – primær farve ===== */

/* Booking-cost container (PRISESTIMAT) */
.wc-bookings-booking-cost {
    background: var(--e-global-color-f572244) !important;
    border: 1px solid color-mix(in srgb, var(--e-global-color-f572244) 90%, var(--e-global-color-primary)) !important;
    border-radius: 8px !important;
    padding: 16px 20px !important;
    margin-top: 12px !important;
}

/* Pris-label og tekst i booking-cost */
.wc-bookings-booking-cost .woocommerce-Price-amount,
.wc-bookings-booking-cost .amount {
    color: var(--e-global-color-primary) !important;
}

/* Strip emojis fra WC Bookings headings via CSS (fallback) */
.wc-pao-addon-heading {
    color: var(--e-global-color-primary);
}

/* Responsivt */
@media (max-width: 480px) {
    .torring-persons-row {
        flex-direction: column;
        gap: 12px;
    }
    .torring-person-input-wrap {
        max-width: 100%;
    }
    .torring-resource-grid {
        grid-template-columns: 1fr;
    }
}
