/*
 * SAMI Reservation Form Style – giao diện "Cổ điển (AN 2.1)"
 *
 * Giữ đúng giao diện của AN Table Reservation Manager 2.1.10 (và add-on 1.0.0) cho website chuyển từ AN:
 * - Chỉ sắp xếp bố cục form (hàng/cột, biểu tượng, ô ngày, ô chọn không có mũi tên). Màu, viền, chữ của trường
 *   nhập để cho CSS của theme / snippet của website (như khi còn dùng AN), không ghi đè.
 * - Lịch chọn ngày tối, ngày không chọn được gạch ngang chữ số (không gạch chéo X như giao diện sáng).
 *
 * Áp dụng cho form .sami-reservation-form và form cũ .an-reservation-form.
 *
 * Đổi màu lịch bằng biến CSS (đặt ở :root trong Giao diện → Tùy biến → CSS bổ sung, được in sau file này):
 *   --sami-rdp-bg:#17140f;  --sami-rdp-text:#cbb895;  --sami-rdp-border:#8B6D47;  --sami-rdp-day-bg:#241f17;
 *   --sami-rdp-accent:#8B6D47;  --sami-rdp-accent-text:#ffffff;  --sami-rdp-radius:18px  (0 = góc vuông)
 */

:root {
    --sami-rdp-bg: #17140f;
    --sami-rdp-text: #cbb895;
    --sami-rdp-border: #8B6D47;
    --sami-rdp-day-bg: #241f17;
    --sami-rdp-accent: #8B6D47;
    --sami-rdp-accent-text: #ffffff;
    --sami-rdp-radius: 18px;
}

/* ==========================================================================
   1. BỐ CỤC FORM
   ========================================================================== */

.sami-reservation-form .sami-input-wrapper,
.sami-reservation-form .sami-select-wrapper,
.an-reservation-form .an-input-wrapper,
.an-reservation-form .an-select-wrapper {
    position: relative;
}

.sami-reservation-form .sami-input-wrapper,
.an-reservation-form .an-input-wrapper {
    overflow: visible !important;
}

.sami-reservation-form .sami-input-icon,
.an-reservation-form .an-input-icon {
    pointer-events: none;
    z-index: 2;
}

/* Ô chọn không có mũi tên (giống AN 2.1) */
.sami-reservation-form select,
.an-reservation-form select {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-image: none !important;
}
.sami-reservation-form select::-ms-expand,
.an-reservation-form select::-ms-expand {
    display: none !important;
}
.sami-reservation-form .sami-select-wrapper::after,
.an-reservation-form .an-select-wrapper::after {
    display: none !important;
}

/* Ô ngày: bấm để mở lịch */
.sami-reservation-form .wpcf7-form-control-wrap[data-name="res-date"],
.an-reservation-form .wpcf7-form-control-wrap[data-name="res-date"] {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
}
body .sami-reservation-form input[name="res-date"],
body .an-reservation-form input[name="res-date"] {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    text-align: left !important;
}
/* Như AN 2.1.10: chọn theo #res-date để thắng CSS form của theme / snippet */
.sami-reservation-form input[name="res-date"].sami-date-portal-field,
.sami-reservation-form #res-date.sami-date-portal-field,
.an-reservation-form input[name="res-date"].sami-date-portal-field,
.an-reservation-form #res-date.sami-date-portal-field {
    padding-left: 50px !important;
    padding-right: 22px !important;
}

@media (max-width: 767px) {
    .sami-reservation-form .sami-form-row-2,
    .sami-reservation-form .sami-form-row-3,
    .an-reservation-form .an-form-row-2,
    .an-reservation-form .an-form-row-3 {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 24px !important;
    }
    .sami-reservation-form .sami-form-group,
    .sami-reservation-form .sami-input-wrapper,
    .sami-reservation-form .sami-textarea-wrapper,
    .sami-reservation-form .wpcf7-form-control-wrap,
    .an-reservation-form .an-form-group,
    .an-reservation-form .an-input-wrapper,
    .an-reservation-form .an-textarea-wrapper,
    .an-reservation-form .wpcf7-form-control-wrap {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    .sami-reservation-form input,
    .sami-reservation-form select,
    .sami-reservation-form textarea,
    .an-reservation-form input,
    .an-reservation-form select,
    .an-reservation-form textarea {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        display: block !important;
    }
    .sami-reservation-form input[name="res-date"].sami-date-portal-field,
    .sami-reservation-form #res-date.sami-date-portal-field,
    .an-reservation-form input[name="res-date"].sami-date-portal-field,
    .an-reservation-form #res-date.sami-date-portal-field {
        padding-left: 96px !important;
    }
}

/* ==========================================================================
   2. GIỜ KHÔNG CÒN CHỖ / ĐÃ QUA, FORM TẠM KHÓA
   ========================================================================== */

.sami-reservation-form select[name="res-time"] option:disabled,
.sami-reservation-form select[name="res-time"] option.sami-res-time-expired,
.an-reservation-form select[name="res-time"] option:disabled,
.an-reservation-form select[name="res-time"] option.sami-res-time-expired {
    color: rgba(139, 109, 71, .38) !important;
    background: var(--sami-rdp-bg) !important;
}

.sami-reservation-form .sami-res-time-unavailable-group,
.an-reservation-form .sami-res-time-unavailable-group {
    opacity: .3 !important;
}
.sami-reservation-form .sami-res-time-unavailable-group label,
.sami-reservation-form .sami-res-time-unavailable-wrap,
.sami-reservation-form select.sami-res-time-unavailable,
.an-reservation-form .sami-res-time-unavailable-group label,
.an-reservation-form .sami-res-time-unavailable-wrap,
.an-reservation-form select.sami-res-time-unavailable {
    cursor: not-allowed !important;
}

.sami-res-booking-closed {
    margin: 0 0 18px;
    padding: 14px 16px;
    border: 1px solid #d8b577;
    border-radius: 12px;
    background: #fff4df;
    color: #6a4300;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
}

.sami-reservation-form[aria-disabled="true"] :is(input, select, textarea, button):disabled,
.an-reservation-form[aria-disabled="true"] :is(input, select, textarea, button):disabled {
    cursor: not-allowed !important;
    opacity: .55 !important;
}

/* ==========================================================================
   3. LỊCH CHỌN NGÀY (màu lấy từ biến --sami-rdp-* ở trên, xem CSS của plugin chính)
   ========================================================================== */

#sami-res-date-portal .sami-rdp-head button {
    background: var(--sami-rdp-day-bg) !important;
    border-color: color-mix(in srgb, var(--sami-rdp-border) 75%, transparent) !important;
}

/* AN 2.1: ngày không chọn được gạch ngang chữ số, không có dấu X */
#sami-res-date-portal .sami-rdp-days button.is-disabled {
    opacity: .24 !important;
    text-decoration: line-through !important;
}
#sami-res-date-portal .sami-rdp-days button.is-disabled::before,
#sami-res-date-portal .sami-rdp-days button.is-disabled::after {
    content: none !important;
    display: none !important;
}
