/**
 * assets/floorplan.css
 * ชุด CSS ของ "ผังที่นั่ง + hotspot คลิกเลือกโต๊ะ" ใช้ร่วมกันทั้งเว็บหลัก (reservation/, concert-booking/)
 * และ backoffice (backoffice/events/detail/) เพื่อให้ 2 ฝั่งมี UI/พฤติกรรมเดียวกัน ไม่ต้องดูแลสไตล์แยกกัน 2 ชุด
 * เดิมอยู่ใน assets/style.css (เฉพาะเว็บหลัก) — แยกออกมาไฟล์นี้ตอนที่ backoffice เริ่มใช้ผังแบบเดียวกัน
 *
 * markup มาตรฐาน: <div class="floorplan-wrap"><img class="floorplan-img">
 *   <div class="hotspot" style="left:%;top:%;width:%;height:%"></div> ...</div>
 * และ legend: <div class="legend"><div class="legend-item"><span class="legend-swatch"></span>...</div></div>
 *
 * เว็บหลัก (reservation/, concert-booking/): โต๊ะมีแค่ 2 สถานะ (ว่าง/จองแล้ว) ใช้คลาส .is-booked ตรง ๆ
 * backoffice (events/detail/): โต๊ะมี 4 สถานะ (ว่าง/รอชำระเงิน/สำเร็จ/ยกเลิก) ไม่ใช้ .is-booked (เพราะ admin
 * ต้องคลิกจัดการได้ทุกสถานะ ไม่ใช่คลิกไม่ได้แบบเว็บหลัก) แต่ใส่ box-shadow สีตามสถานะทับด้วย inline style แทน
 * (ดู config/booking-status.php สำหรับสีของแต่ละสถานะ, backoffice/events/detail/index.php สำหรับการใช้งานจริง)
 */

.legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin-bottom: 20px;
    font-size: 14px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-swatch {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,.25);
    display: inline-block;
}

.booked-swatch {
    background: repeating-linear-gradient(45deg, #999, #999 4px, #ccc 4px, #ccc 8px);
}

.floorplan-wrap {
    position: relative;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,.08);
}

.floorplan-img {
    display: block;
    width: 100%;
    height: auto;
}

/* จุดคลิกทับตำแหน่งโต๊ะ วางแบบ % ให้ responsive ตามขนาดรูปจริง */
.hotspot {
    position: absolute;
    cursor: pointer;
    border-radius: 4px;
    background: rgba(255,255,255,0);
    transition: background .15s ease, box-shadow .15s ease;
}

/* ลงสีพื้นตามประเภทที่นั่งแบบโปร่งแสง (เว็บหลักเท่านั้น — ตั้งค่าตัวแปร --cat-fill ต่อโต๊ะจาก PHP ตอน render
   ดู concert-booking/index.php concert_hex_to_rgba() ไม่ใช้แค่ background ตรง ๆ เพราะต้องให้ :hover ทับได้
   ตามลำดับ cascade ปกติ (inline style จะชนะ :hover เสมอถ้าตั้งตรง background) โต๊ะที่จองแล้ว (.is-booked)
   ไม่รับสีนี้ ให้เทาทับตามสถานะเดิมเสมอ (สถานะจองแล้วสำคัญกว่าสีประเภท) */
.hotspot:not(.is-booked) {
    background: var(--cat-fill, rgba(255,255,255,0));
}

.hotspot:hover {
    background: rgba(255,255,255,0.25);
    box-shadow: inset 0 0 0 3px rgba(0,0,0,0.55);
}

.hotspot.is-selected {
    background: rgba(255,255,255,0.35);
    box-shadow: inset 0 0 0 3px #111;
}

/* ไอคอนวางกลาง hotspot ตอนเลือก/จองแล้ว ให้เห็นชัดว่าโต๊ะไหนถูกเลือก/ไม่ว่างแล้วแม้ไม่ได้ hover/คลิกซ้ำ
   [data-status-icon] ใช้ฝั่ง backoffice (สถานะมาจาก inline box-shadow ไม่ใช่คลาส .is-booked/.is-selected
   เพราะ admin คลิกจัดการได้ทุกสถานะ — ใส่ attribute data-status-icon="<emoji>" ต่อโต๊ะแทน ว่างไว้/ไม่ใส่ = ไม่มีไอคอน
   ดู config/booking-status.php, config/reservation-status.php สำหรับ icon ต่อสถานะ) */
.hotspot.is-selected::after,
.hotspot.is-booked::after,
.hotspot[data-status-icon]::after {
    content: "";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(12px, 4vw, 20px);
    line-height: 1;
    pointer-events: none;
}

.hotspot.is-selected::after {
    content: "✓";
    color: #111;
    text-shadow: 0 1px 2px rgba(255,255,255,.6);
}

.hotspot[data-status-icon]::after {
    content: attr(data-status-icon);
}

.hotspot.is-booked {
    cursor: not-allowed;
    background: rgba(120,120,120,0.55);
}

.hotspot.is-booked::after {
    content: "🔒";
}

.hotspot.is-booked:hover {
    box-shadow: inset 0 0 0 3px rgba(80,80,80,0.8);
}
