/* Naiyang Charm Beach Hotel — restyle widget จอง hoteliers.guru ให้เข้าธีม
   โหลดคู่กับ assets/ibe/css/t-datepicker.min.css (ปฏิทิน popup) — ไฟล์นี้ดูแล layout bar + popup ห้อง
   markup/คลาสมาจาก template-parts/home/booking-bar.php (คง class ที่ ibe-booking.js hook)
   NOTE: ไม่โหลด Bootstrap/FontAwesome ของ widget — จัด layout + ไอคอนเอง
*/

/* ---- shell: override .booking-bar__form (เดิมเป็น grid) ให้เป็นการ์ดขาวใบเดียว ---- */
.booking-bar__form { display: block; padding: 0; overflow: visible; }
#ibe.reservation_box { width: 100%; }
#ibe .reservation { display: flex; flex-wrap: wrap; align-items: stretch; }
#ibe .clearfix { display: none; }

/* แต่ละช่อง */
#ibe .padding_box { display: flex; min-width: 0; }
.padding_box--date   { flex: 1.9 1 300px; }
.padding_box--room   { flex: 1.1 1 180px; }
.padding_box--promo  { flex: 1 1 150px; }
.padding_box--submit { flex: 0 0 auto; }
/* เส้นคั่นแนวตั้งระหว่างช่อง */
.padding_box--room, .padding_box--promo { border-left: 1px solid var(--c-line); }
.padding_box--submit { padding: 8px; }

#ibe .box_inout, #ibe .box_room, #ibe .box_promocode, #ibe .box_book { width: 100%; }

/* label (ไอคอน + ข้อความ) */
#ibe p { margin: 0 0 4px; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--c-dark); line-height: 1.2; }
#ibe p .hw-icon { width: 20px; height: 20px; color: var(--c-primary); flex: none; }

/* ---- วันที่ (check-in / check-out) ----
   t-datepicker inject .t-dates (วันที่) เข้ามาในช่อง + บังคับ .t-dates{height:24px} / label absolute
   จัดเป็นแนวตั้ง: <p> ของเรา (ไอคอน + เช็คอิน/เอาท์) = caption บรรทัดบน, วันที่อยู่ล่าง
   คลิกทั้งช่องเปิดปฏิทินได้ (delegate .t-check-in → .t-dates ใน ibe-booking.js) */
.box_inout.t-datepicker { display: flex; }
#ibe .t-check-in, #ibe .t-check-out { flex: 1; min-width: 0; float: none; width: auto; position: relative; cursor: pointer; display: flex; flex-direction: column; justify-content: center; gap: 3px; padding: 10px 18px; }
#ibe .t-check-out { border-left: 1px solid var(--c-line); }
#ibe .t-check-in > p, #ibe .t-check-out > p { margin: 0; }
#ibe .t-dates { height: auto; min-height: 0; z-index: auto; display: flex; flex-wrap: nowrap; align-items: baseline; gap: 2px 5px; white-space: nowrap; font-size: 15px; color: var(--c-text); }
#ibe .t-date-info-title { display: none; } /* label ของ t-dp ว่าง (มีวันที่แล้ว) — ใช้ <p> ของเราแทน */
#ibe .t-check-in .fa, #ibe .t-check-out .fa { display: none; }
#ibe .input_in_out:empty { display: none; }
.t-day-check-in, .t-day-check-out { font-size: 18px; font-weight: 700; color: var(--c-dark); }
.t-month-check-in, .t-month-check-out, .t-year-check-in, .t-year-check-out { color: var(--c-muted); }

/* ---- ห้อง / ผู้เข้าพัก ---- */
.box_room { display: flex; flex-direction: column; justify-content: center; padding: 10px 18px; }
.reservation-check { position: relative; display: flex; align-items: center; }
.input-room { -webkit-appearance: none; appearance: none; width: 100%; padding: 2px 22px 2px 0; border: 0; background: transparent; font: inherit; font-size: 15px; color: var(--c-text); cursor: pointer; outline-offset: 4px; }
.arrow_index { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid var(--c-muted); pointer-events: none; }

/* ---- โค้ดส่วนลด ---- */
.box_promocode { display: flex; flex-direction: column; justify-content: center; padding: 10px 18px; }
.input_promocode { width: 100%; padding: 2px 0; border: 0; background: transparent; font: inherit; font-size: 15px; color: var(--c-text); outline-offset: 4px; }
.input_promocode::placeholder { color: var(--c-muted); }

/* ---- ปุ่มค้นหา (ได้ .btn .btn--primary จาก markup แล้ว) ---- */
.btnbook_reser.btn { width: 100%; height: 100%; min-height: 54px; border: 0; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; }

/* ---- popup เลือกจำนวนห้อง/ผู้เข้าพัก ----
   markup เขา gen มาเป็น 2 ช่องเล็ก (ผู้ใหญ่/เด็ก) + div ว่างหลายอัน → จัดใหม่ให้เต็มกว้าง ไม่โหวง */
.content_ibe { position: relative; }
.popup_content { display: none; position: absolute; z-index: 500; top: calc(100% + 10px); left: 0; width: 280px; max-width: calc(100vw - 32px); background: #fff; border: 1px solid var(--c-line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; text-align: left; }
.popup_content.popupTop { top: auto; bottom: calc(100% + 10px); }
#numOfroom:empty { display: none; }
/* ซ่อนเฉพาะ .clearfix ที่ "ว่างจริง" (ตัวคั่น) — ห้ามซ่อน #field_total_adult_children* ที่ก็มี class clearfix */
.popup_content .clearfix:empty { display: none; }
/* widget ตั้ง inline height + overflow:scroll เมื่อห้อง > 2 → ปล่อยให้สูงตามเนื้อหาแทน (ไม่เหลือที่ว่าง/scroll เพี้ยน) */
#popup_room_list > #numberrroomRow { display: block; height: auto !important; overflow: visible !important; }
.numberroom { display: flex; align-items: baseline; gap: 6px; margin-bottom: 12px; }
.numberroom label { font-size: 12px; font-weight: 600; color: var(--c-muted); margin: 0; letter-spacing: .02em; }
.popup_content .fa { display: none; }
.popup_content .form-group { margin: 0 0 10px; }
/* บังคับช่องผู้ใหญ่/เด็กให้เต็มกว้าง เรียงบนลงล่าง (override inline-block 48% ของ widget) */
.popup_content .form_group_half { display: block; width: 100%; margin: 0 0 10px; }
.popup_content .form_group_half + .form_group_half { margin-left: 0; }
.popup_content .input-group { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--c-line); border-radius: 10px; padding: 10px 14px; }
.popup_content .input-group-addon { font-size: 14px; font-weight: 600; color: var(--c-dark); white-space: nowrap; }
.popup_content select { min-width: 0; text-align: right; text-align-last: right; border: 0; background: transparent; font: inherit; font-size: 14px; color: var(--c-text); cursor: pointer; }
.popup_content .select-form { width: auto; }
.popup_content [id^="ageOfChildren"] { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.popup_content [id^="ageRow"] { display: block; font-size: 12px; font-weight: 600; color: var(--c-muted); margin: 2px 0 6px; }
.popup_content .col-xs-4 .input-group { padding: 8px 10px; }
.padding_apply { margin-top: 4px; }
.btn_apply { width: 100%; padding: 12px; border: 0; border-radius: 10px; background: var(--c-primary); color: #fff; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; }
.btn_apply:hover { background: var(--c-primary-dark); }

/* ---- ปฏิทิน popup ----
   ⚠️ widget ไม่ได้ตั้ง position ให้ปฏิทิน (.t-datepicker-day / .t-datepicker-days) ใน CSS ที่เราโหลด
   → มันอยู่ใน flow พอเปิดจะดันช่องขยาย (desktop ดันขึ้นเพราะ transform ของ hero-bar / mobile กินที่)
   บังคับเป็น absolute dropdown เปิดลงล่างเสมอ (ใต้แถบจองมีที่ว่างพอ ไม่ชน header) */
#ibe .t-datepicker { position: static; }
#ibe .t-datepicker-day { position: absolute !important; left: 0; top: calc(100% + 8px) !important; bottom: auto !important; z-index: 600; }
#ibe .t-arrow-top { display: none !important; }

/* ---------- responsive (mobile: stack เต็มกว้าง มีเส้นคั่น เหมือน widget มือถือทั่วไป) ---------- */
@media (max-width: 860px) {
	#ibe .reservation { flex-direction: column; }
	/* สำคัญ: บน desktop flex:1.9 1 300px คุมความกว้าง, พอเป็น column 300px กลายเป็นความสูง → โหวง
	   รีเซ็ตให้สูงตามเนื้อหา + เต็มกว้าง */
	#ibe .padding_box { flex: 0 0 auto; width: 100%; }
	/* วันที่: เลิกวาง check-in|check-out คู่กัน → เรียงลงล่างเต็มกว้าง */
	.box_inout.t-datepicker { flex-direction: column; }
	#ibe .t-check-in, #ibe .t-check-out { width: 100%; }
	/* เส้นคั่นแนวนอนระหว่างทุกช่อง */
	#ibe .t-check-out,
	.padding_box--room, .padding_box--promo { border-left: 0; border-top: 1px solid var(--c-line); }
	.padding_box--submit { padding: 14px; }
	/* popup + ปฏิทิน เต็มกว้างช่อง */
	.popup_content { width: 100%; }
	#ibe .t-datepicker-day { width: 100% !important; padding: 6px 0 !important; font-size: 13px; }
	/* ย่อปฏิทินบนมือถือ: ลด padding cell (เดิม 10px) + หัวเดือน + ชื่อวัน */
	#ibe .t-table-condensed td, #ibe .t-table-condensed th { padding: 5px 2px !important; }
	#ibe .t-date-title { padding: 8px 0 6px !important; font-size: 15px; }
	#ibe .t-next, #ibe .t-prev { padding: 4px 8px !important; }
}
