.user-pin {
  pointer-events: none !important;
}

/* ===== ตั้งค่าโครงสร้างพื้นฐาน ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  padding-bottom: 65px;
  background: #f9fafb;
  color: #1f2937;
  min-height: 100vh;
}

.page {
  display: none;
  min-height: calc(100vh - 65px);
}

.page.active {
  display: block;
}

h2 {
  font-size: 22px;
  margin-bottom: 20px;
  color: #1f2937;
}

/* === หน้าล็อกอิน (Auth Screen) === */
#screen-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #22c55e 0%, #15803d 100%);
  padding: 20px;
  min-height: 100vh;
  z-index: 3000;
  position: fixed;
  inset: 0;
}

.auth-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  padding: 30px;
  border-radius: 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.auth-input {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  font-size: 14px;
  outline: none;
  background: #fff;
}

.auth-btn {
  width: 100%;
  padding: 12px;
  background: #22c55e;
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 6px;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

/* === แถบด้านบนของหน้าแผนที่ === */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  z-index: 1500;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
  border-bottom: 1px solid rgba(229, 231, 235, 0.8);
}

.top-location-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 9999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
  cursor: pointer;
  transition: background 0.2s ease;
}

.top-location-btn:hover {
  background: #e5e7eb;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #e5e7eb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  font-size: 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background 0.2s ease;
}

.top-icon-btn:active {
  transform: scale(0.95);
}

.top-badge {
  display: flex;
  position: absolute;
  top: -2px;
  right: -2px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
}

/* === แผนที่ & ปุ่มควบคุมบนแผนที่ === */
#map {
  position: fixed;
  top: 52px;
  left: 0;
  right: 0;
  bottom: 65px;
  width: 100%;
  height: calc(100vh - 52px - 65px);
  z-index: 1;
}

.leaflet-control-zoom {
  position: absolute !important;
  top: 14px !important;
  left: 12px !important;
}

.leaflet-control-attribution {
  font-size: 9px !important;
  opacity: 0.65 !important;
  background: transparent !important;
  margin: 0 !important;
  color: #6b7280 !important;
}

/* ==========================================
   ☰ เมนูโหมดบนแผนที่แบบปุ่มเดียวขยายออก
   ========================================== */
.menu-toggle-btn {
  position: fixed;
  top: 66px;
  right: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #0E4D24, #168039);
  color: white;
  font-size: 20px;
  cursor: pointer;
  z-index: 1300;
  box-shadow: 0 4px 12px rgba(22, 128, 57, 0.35);
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-toggle-btn:hover {
  transform: scale(1.05);
}

.menu-toggle-btn.open {
  transform: rotate(90deg);
  background: linear-gradient(135deg, #374151, #4b5563);
}

.menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1200;
}

.menu-overlay.open {
  opacity: 1;
  visibility: visible;
}

.menu-items-container {
  position: fixed;
  top: 124px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1250;
  pointer-events: none;
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  opacity: 0;
  transform: translateX(30px);
  transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transition-delay: calc(var(--i) * 50ms);
  pointer-events: none;
}

.menu-items-container.open .menu-item {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.menu-item-label {
  background: #ffffff;
  padding: 8px 14px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 500;
  color: #1f2937;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid #e5e7eb;
}

.menu-item-label:hover {
  background: #f0fdf4;
  color: #0E4D24;
}

.menu-item-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s;
  flex-shrink: 0;
}

.menu-item-icon:hover {
  transform: scale(1.08);
  background: #f0fdf4;
}

.menu-item.active .menu-item-icon {
  background: linear-gradient(135deg, #0E4D24, #168039);
  color: white;
  border-color: #168039;
  box-shadow: 0 2px 10px rgba(22, 128, 57, 0.25);
}

/* ==========================================
   📊 แผงข้อมูลล่าง 2 ระดับ (สไลด์ขึ้น-ลง)
   ========================================== */
.bottom-panel-container {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 65px;
  z-index: 1100;
  touch-action: pan-y;
  pointer-events: none;
}

.bottom-panel {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  padding: 14px 20px 20px;
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  overflow: hidden;
}

.drag-handle {
  width: 36px;
  height: 4px;
  background: #d1d5db;
  border-radius: 2px;
  margin: 0 auto 14px;
  cursor: grab;
}

/* ===== ระดับที่ 1: ย่อ ===== */
.panel-collapsed {
  transform: translateY(calc(100% - 215px));
}

.panel-collapsed .expanded-details {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  margin-top: 0;
}

/* ===== ระดับที่ 2: ขยาย ===== */
.panel-expanded {
  transform: translateY(0);
}

.expanded-details {
  max-height: 360px;
  opacity: 1;
  transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  margin-top: 20px;
}

/* ===== ส่วนบน: แถบความคืบหน้า ===== */
.progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 6px;
}

.battery-text {
  color: #168039;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.progress-bar {
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  margin-bottom: 16px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0E4D24, #168039);
  border-radius: 4px;
  width: 100%;
  transition: width 0.3s ease;
}

/* ===== สถิติหลัก 4 ช่อง ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
}

.stat-label {
  font-size: 12px;
  color: #6b7280;
  margin-top: 3px;
}

/* ===== แถบปุ่มควบคุม ===== */
.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.icon-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: #f3f4f6;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: #e5e7eb;
}

.main-action-btn {
  flex: 1;
  padding: 14px 20px;
  border-radius: 9999px;
  border: none;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #0E4D24, #168039);
  color: white;
  box-shadow: 0 4px 14px rgba(22, 128, 57, 0.3);
}

.main-action-btn.tracking {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.main-action-btn:active {
  transform: scale(0.97);
}

/* ===== ส่วนรายละเอียดเพิ่มเติม ===== */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.detail-card {
  background: #f3f4f6;
  border-radius: 12px;
  padding: 12px 14px;
}

.detail-label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}

.detail-value {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
}

/* ปุ่มระบุตำแหน่งปัจจุบันบนแผนที่ */
.locate-btn {
  position: fixed;
  bottom: 295px;
  right: 16px;
  z-index: 1050;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #e5e7eb;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: bottom 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.bottom-panel-container.is-expanded~.locate-btn {
  bottom: 530px;
}

/* === แถบเมนูด้านล่าง 5 จุด (ตรึงถาวรทุกหน้า) === */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 65px;
  background: #fff;
  display: flex;
  border-top: 1px solid #eee;
  z-index: 2500;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #9ca3af;
  transition: color 0.2s;
}

.nav-item.active {
  color: #22c55e;
  font-weight: 600;
}

.nav-icon {
  font-size: 20px;
  margin-bottom: 2px;
}

.nav-text {
  font-size: 10px;
}

#toast-notification {
  position: fixed;
  top: 62px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(31, 41, 55, 0.95);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  z-index: 3000;
  display: none;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* 1. ปรับความสูงและพื้นที่ของแถบเมนูด้านล่างให้โปร่งและรองรับอนิเมชัน */
.bottom-nav {
  height: 80px;
  /* เพิ่มความสูงจากเดิม (เช่น 60px เป็น 70px) */
  padding-bottom: env(safe-area-inset-bottom, 10px);
  /* รองรับขอบจอมือถือรุ่นใหม่ */
}

/* ปรับระยะห่างด้านล่างของหน้าจอทุกหน้าไม่ให้โดนแถบเมนูบังและเผื่อที่ให้อนิเมชัน */
.page {
  padding-bottom: 95px !important;
}

/* 2. เพิ่มเอฟเฟกต์ Fade Gradient ที่กล่องสกรอลล์สถิติ เพื่อบอกว่ามีข้อมูลด้านล่าง */
.expanded-details {
  position: relative;
  max-height: 215px;
  overflow-y: auto;
  padding-right: 2px;
  /* ทำขอบจางด้านล่าง (Fade out) เพื่อสื่อว่าเลื่อนลงดูต่อได้ */
  mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
}

/* ===== ส่วนร้านค้า / คูปอง / แคมเปญ / ผู้ประกอบการ ===== */
#my-coupons-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  max-height: 380px;
  overflow-y: auto;
  width: 100%;
  box-sizing: border-box;
  padding-right: 4px;
}

/* คอนเทนเนอร์ปุ่ม 3 ช่อง */
.merchant-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  margin: 12px 0 4px 0;
  box-sizing: border-box;
}

/* สไตล์พื้นฐานของปุ่ม */
.merchant-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.merchant-action-btn span:first-child {
  font-size: 18px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* 1. ปุ่มสแกน QR */
.btn-scan {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(6, 78, 59, 0.4) 100%);
  border: 1px solid rgba(52, 211, 153, 0.4);
  color: #34d399;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.btn-scan:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
}

/* 2. ปุ่มประวัติสิทธิ์ (ตรงกลาง) */
.btn-history {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2) 0%, rgba(12, 74, 110, 0.45) 100%);
  border: 1px solid rgba(56, 189, 248, 0.5);
  color: #38bdf8;
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.2);
}

.btn-history:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(56, 189, 248, 0.35);
}

/* 3. ปุ่มเพิ่มแคมเปญ */
.btn-campaign {
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.15) 0%, rgba(49, 46, 129, 0.4) 100%);
  border: 1px solid rgba(129, 140, 248, 0.4);
  color: #818cf8;
  box-shadow: 0 4px 12px rgba(129, 140, 248, 0.15);
}

.btn-campaign:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(129, 140, 248, 0.3);
}

/* ==========================================
   🎟️ กระเป๋าคูปองแบบซ้อนการ์ด
   ========================================== */
.wallet-nav-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wallet-nav-arrow {
  background: #f3f4f6;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 15px;
  line-height: 1;
  color: #168039;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.wallet-nav-arrow:hover:not(:disabled) {
  background: #dcfce7;
}

.wallet-nav-arrow:disabled {
  opacity: 0.25;
  cursor: default;
}

.wallet-page-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}

.wallet-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d1d5db;
  cursor: pointer;
  transition: all 0.25s ease;
}

.wallet-dot.active {
  background: #168039;
  transform: scale(1.25);
}

.coupon-stack {
  position: relative;
  width: 100%;
  min-height: 144px;
  perspective: 1200px;
  touch-action: pan-y;
}

.coupon-stack .coupon-card {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  margin: 0;
  display: flex;
  align-items: stretch;
  background: linear-gradient(135deg, #0e4d24 0%, #168039 50%, #0f3d1b 100%);
  border-radius: 16px;
  overflow: hidden;
  min-height: 128px;
  box-shadow: 0 6px 16px rgba(22, 128, 57, 0.22);
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.coupon-stack .coupon-card::before,
.coupon-stack .coupon-card::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-radius: 50%;
  z-index: 3;
}

.coupon-stack .coupon-card::before {
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
}

.coupon-stack .coupon-card::after {
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
}

.coupon-stack .coupon-notch-top {
  position: absolute;
  top: -8px;
  left: 86px;
  transform: translateX(-50%);
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-radius: 50%;
  z-index: 3;
}

.coupon-stack .coupon-notch-bottom {
  position: absolute;
  bottom: -8px;
  left: 86px;
  transform: translateX(-50%);
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-radius: 50%;
  z-index: 3;
}

.coupon-stack .coupon-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 12px;
  background: rgba(0, 0, 0, 0.15);
  width: 86px;
  flex-shrink: 0;
}

.coupon-stack .vip-badge {
  background: #FFD700;
  color: #000;
  font-weight: 800;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  margin-bottom: 6px;
}

.coupon-stack .coupon-icon {
  font-size: 24px;
}

.coupon-stack .coupon-divider {
  position: relative;
  width: 1px;
  flex-shrink: 0;
  margin: 10px 0;
  border-left: 2px dashed rgba(255, 255, 255, 0.3);
}

.coupon-stack .coupon-right {
  flex: 1;
  padding: 12px 14px 12px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
}

.coupon-stack .merchant-tag {
  font-size: 10px;
  font-weight: 600;
  color: #b2f0c4;
  background: rgba(255, 255, 255, 0.12);
  padding: 2px 8px;
  border-radius: 10px;
  margin-bottom: 2px;
  align-self: flex-start;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coupon-stack .coupon-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  word-break: break-word;
}

.coupon-stack .coupon-reward {
  font-size: 12px;
  color: #d0ffdd;
  line-height: 1.35;
  margin: 1px 0;
  word-break: break-word;
}

.coupon-stack .coupon-meta {
  font-size: 10px;
  color: #99e0ac;
  margin-top: 2px;
}

.coupon-stack .coupon-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}

.coupon-stack .delete-coupon-btn {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.45);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
}

.coupon-stack .coupon-card.redeemed {
  background: linear-gradient(135deg, #374151 0%, #1f2937 50%, #111827 100%);
}

.coupon-stack .coupon-card.redeemed .vip-badge {
  background: #9ca3af;
  color: #fff;
}

.coupon-stack .coupon-card.redeemed .merchant-tag {
  color: #d1d5db;
  background: rgba(255, 255, 255, 0.08);
}

.coupon-stack .coupon-card.redeemed .coupon-meta {
  color: #d1d5db;
}

/* ==========================================
   🎨 สไตล์ปุ่มแท็บหลัก (ทั้งหมด / สปอนเซอร์) และแท็บย่อย
   ========================================== */
.main-tabs-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 16px;
  margin-bottom: 12px;
}

.main-tab-btn {
  width: 100%;
  padding: 10px 12px;
  border-radius: 9999px;
  border: 2px solid transparent;
  background-color: #f5f5f5;
  color: #444444;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.main-tab-btn:hover {
  background-color: #e8f5e9;
  color: #0E4D24;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(22, 128, 57, 0.15);
}

.main-tab-btn.active {
  background: linear-gradient(135deg, #168039 0%, #0E4D24 100%);
  color: #ffffff;
  border-color: #168039;
  box-shadow: 0 4px 12px rgba(22, 128, 57, 0.35);
  font-weight: 700;
}

.main-tab-btn:active {
  transform: scale(0.97);
  box-shadow: 0 2px 6px rgba(22, 128, 57, 0.25);
}

#sub-categories-wrapper {
  display: flex;
  gap: 8px;
  padding: 0 16px;
  margin-bottom: 14px;
  justify-content: space-between;
}

.sub-tab-btn {
  flex: 1;
  padding: 8px 6px;
  border-radius: 9999px;
  border: 2px solid transparent;
  background-color: #f5f5f5;
  color: #555555;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.sub-tab-btn:hover {
  background-color: #e8f5e9;
  color: #0E4D24;
}

.sub-tab-btn.active {
  background: linear-gradient(135deg, #168039 0%, #0E4D24 100%);
  color: #ffffff;
  border-color: #168039;
  font-weight: 600;
}

.sub-tab-btn:active {
  transform: scale(0.96);
}

/* บังคับให้ Popup อยู่เหนือ UI ด้านล่างและเลเยอร์อื่นบนแผนที่ */
.leaflet-pane.leaflet-popup-pane {
  z-index: 99999 !important;
  pointer-events: auto;
}

.leaflet-popup {
  z-index: 99999 !important;
}

.leaflet-popup-content-wrapper {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.22);
  border: 1px solid #e2e8f0;
  padding: 4px;
}

.leaflet-popup-content {
  margin: 8px 10px;
  line-height: 1.4;
}

.leaflet-popup-tip {
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.leaflet-popup-close-button {
  color: #64748b !important;
  font-size: 16px !important;
  padding: 4px 6px 0 0 !important;
}

.leaflet-popup-close-button:hover {
  color: #0f172a !important;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
  padding: 10px 8px 18px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 2500;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
}

.nav-item {
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 16px;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  color: #9ca3af;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(14, 77, 36, 0.06), rgba(22, 128, 57, 0.08));
  color: #0E4D24;
  transform: translateY(-2px);
  padding: 6px 14px;
}

.nav-icon {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.nav-item.active .nav-icon {
  transform: scale(1.12);
}

.nav-icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 2;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: all 0.3s ease;
}

.active-indicator {
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, #0E4D24, #168039);
  border-radius: 3px;
  transition: width 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  margin-top: 2px;
}

.nav-item.active .active-indicator {
  width: 20px;
}

.nav-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.3px;
  transition: all 0.3s ease;
}

.nav-item.active .nav-label {
  font-weight: 600;
}