/* ==========================================================================
   badminton-court.css
   สไตล์เฉพาะหน้า badminton-court.php เท่านั้น (ไม่ใช้ไฟล์ style.css กลาง
   เพื่อไม่ให้กระทบหน้าอื่นที่ยังใช้ .hero-slider / .hero-slider--compact เดิม)
   ========================================================================== */

/* === Hero: แผนที่สนามแบดมินตันใกล้เคียง (สูงเท่าหน้าแรก) === */
.court-hero {
    position: relative;
    overflow: hidden;
    min-height: clamp(460px, 68vh, 700px); /* อ้างอิงความสูง hero ของหน้าแรก (index.php) */
}

.court-hero-map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: var(--light-bg, #e2e8f0);
}

.court-hero-overlay {
    position: absolute;
    top: 24px;
    left: 24px;
    right: 24px;
    z-index: 1001; /* อยู่เหนือ control/popup ของ Leaflet */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    pointer-events: none;
}

.court-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(15, 76, 129, 0.92);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25);
}

.court-hero-title {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--dark, #1e293b);
    background: rgba(255, 255, 255, 0.92);
    padding: 8px 18px;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.15);
    max-width: 520px;
}

.court-hero-empty {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    color: var(--text-muted, #64748b);
    background: var(--light-bg, #f8fafc);
    font-size: 15px;
}

/* หมุดสนามแบดบนแผนที่: วงกลมสีหลักของเว็บ + ไอคอนลูกขนไก่สีขาวตรงกลาง */
.court-marker-wrapper { background: transparent; border: none; }
.court-marker-pin {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary, #0f4c81);
    border: 2px solid #ffffff;
    box-shadow: 0 3px 8px rgba(15, 23, 42, 0.35);
}
.court-marker-icon {
    width: 16px;
    height: 16px;
    background-color: #ffffff;
    -webkit-mask: url('images/map_icon/shuttle.png') center / contain no-repeat;
    mask: url('images/map_icon/shuttle.png') center / contain no-repeat;
}

/* ป้ายชื่อสนามที่แสดงค้างไว้เหนือหมุดตลอด (Leaflet permanent tooltip) */
.court-marker-label {
    padding: 4px 12px;
    border: 1.5px solid #ffffff;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary, #0f4c81), var(--primary-dark, #0a3356));
    color: #ffffff;
    font-family: 'Prompt', sans-serif;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: 0.2px;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.35);
}
.court-marker-label i { margin-right: 4px; font-size: 11px; }
/* ลูกศรชี้ลงหาหมุด (ทับสไตล์ลูกศรสีขาว default ของ Leaflet ให้เป็นสีเดียวกับป้าย) */
.court-marker-label.leaflet-tooltip-top::before { border-top-color: var(--primary-dark, #0a3356); }

/* ป็อปอัปหมุดสนามบนแผนที่ */
.court-map-popup { font-family: 'Prompt', sans-serif; }
.court-map-popup strong { display: block; font-size: 14px; color: var(--dark, #1e293b); margin-bottom: 4px; }
.court-map-popup p { margin: 0 0 6px; font-size: 13px; color: var(--text-muted, #64748b); }
.court-map-popup a { font-size: 13px; font-weight: 500; color: var(--primary, #0f4c81); }

@media (max-width: 576px) {
    .court-hero { min-height: 500px; }
    .court-hero-overlay { top: 16px; left: 16px; right: 16px; gap: 8px; }
    .court-hero-title { font-size: 18px; padding: 6px 14px; max-width: 100%; }
    .court-hero-badge { font-size: 11px; padding: 4px 10px; }
}

/* === ปุ่มสลับมุมมอง คอลัมน์ / แถว ของ "สนามแบดทั้งหมด" === */
.view-toggle {
    display: inline-flex;
    flex: 0 0 auto;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    overflow: hidden;
}

.view-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 36px;
    border: 0;
    background: var(--white, #ffffff);
    color: var(--text-muted, #64748b);
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.view-toggle-btn + .view-toggle-btn { border-left: 1px solid var(--border, #e2e8f0); }
.view-toggle-btn:hover:not(.is-active) { background: var(--light-bg, #f8fafc); }
.view-toggle-btn.is-active { background: var(--primary, #0f4c81); color: #ffffff; }

/* === การ์ดสนามแบด: มุมมองคอลัมน์ (ค่าเริ่มต้น) === */
.court-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.court-card {
    display: block;
    overflow: hidden;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    background: var(--white, #ffffff);
    box-shadow: var(--shadow, 0 4px 12px rgba(15, 23, 42, 0.05));
    transition: box-shadow 0.2s, transform 0.2s;
}
.court-card:hover { box-shadow: var(--shadow-lg, 0 10px 24px rgba(15, 23, 42, 0.12)); transform: translateY(-2px); }

.court-card-banner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 158px;
    overflow: hidden;
    background: var(--border, #e2e8f0);
}
.court-card-banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.court-card-placeholder { position: relative; z-index: 0; font-size: 32px; color: var(--text-muted, #64748b); }
.court-card-views {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.78);
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
}

.court-card-body { padding: 18px 16px; }
.court-card-body h3 {
    margin-bottom: 8px;
    font-size: 18px;
    line-height: 1.35;
    color: var(--dark, #1e293b);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.court-card-directions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    color: var(--primary, #0f4c81);
    font-size: 13px;
    font-weight: 600;
}
.court-card-directions:hover { color: var(--primary-dark, #0a3356); }

/* === มุมมองแถว: การ์ดนอนแนวนอนเรียงเป็นลิสต์ === */
.court-grid.is-row-view { grid-template-columns: 1fr; gap: 14px; }
.court-grid.is-row-view .court-card { display: flex; flex-direction: row; align-items: stretch; }
.court-grid.is-row-view .court-card-banner { flex: 0 0 220px; height: auto; }
.court-grid.is-row-view .court-card-body { flex: 1 1 auto; padding: 16px 20px; }
.court-grid.is-row-view .court-card-body h3 { line-clamp: 2; -webkit-line-clamp: 2; }

@media (max-width: 992px) {
    .court-grid { grid-template-columns: repeat(2, 1fr); }
    .court-grid.is-row-view .court-card-banner { flex-basis: 160px; }
}

@media (max-width: 576px) {
    .court-grid { grid-template-columns: 1fr; gap: 14px; }
    .court-grid.is-row-view .court-card { flex-direction: column; }
    .court-grid.is-row-view .court-card-banner { flex-basis: auto; height: 150px; }
}
