/* ==== Map container ==== */
.aq-map {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
}

.aq-map-wrap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 86px; /* room for floating bottom nav */
}

#aq-map {
  width: 100%;
  height: 100%;
}

/* Override Leaflet default to play nicely with our header + status + filter bar */
.leaflet-top { top: 178px !important; }
.leaflet-control-zoom {
  border: none !important;
  border-radius: 12px !important;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(2, 44, 26, 0.18) !important;
}
.leaflet-control-zoom a {
  background: rgba(255,255,255,0.95) !important;
  color: var(--aq-green-dark, #08653a) !important;
  border-bottom-color: var(--aq-border-soft, #f4f4f1) !important;
  font-weight: 600 !important;
  width: 34px !important;
  height: 34px !important;
  line-height: 34px !important;
  backdrop-filter: blur(8px);
}
.leaflet-control-zoom a:hover { background: #fff !important; }
.leaflet-control-attribution {
  background: rgba(255,255,255,0.85) !important;
  border-radius: 6px 0 0 0 !important;
  padding: 2px 6px !important;
  font-size: 9px !important;
}

/* ==== Custom cluster icons ==== */
.aq-cluster-wrap { background: transparent !important; border: none !important; }
.aq-cluster {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  border: 3px solid #fff;
  box-shadow: 0 3px 10px rgba(0,0,0,.28);
  position: relative;
}
.aq-cluster::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: .28;
}
.aq-cluster--green  { background: var(--status-green, #16A34A); }
.aq-cluster--orange { background: var(--status-orange, #F59E0B); }
.aq-cluster--red    { background: var(--status-red, #DC2626); animation: aq-blink-slow 1.8s ease-in-out infinite; }
.aq-cluster--grey   { background: var(--status-grey, #9CA3AF); }
.aq-cluster--red.aq-cluster { animation: aq-cluster-pulse 1.6s ease-in-out infinite; }
@keyframes aq-cluster-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(.94); }
}

/* ==== Custom marker pin ==== */
.aq-marker {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
}

.aq-marker::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: rgba(255,255,255,.35);
}

.aq-marker--green { background: var(--status-green, #16A34A); }
.aq-marker--orange { background: var(--status-orange, #F59E0B); }
.aq-marker--red { background: var(--status-red, #DC2626); }
.aq-marker--grey { background: var(--status-grey, #9CA3AF); }

/* ==== Blink animations ==== */
@keyframes aq-blink-fast {
  0%, 100% { opacity: 1; transform: rotate(-45deg) scale(1); }
  50% { opacity: .35; transform: rotate(-45deg) scale(0.85); }
}

@keyframes aq-blink-slow {
  0%, 100% { opacity: 1; transform: rotate(-45deg) scale(1); }
  50% { opacity: .5; transform: rotate(-45deg) scale(0.92); }
}

.aq-marker--blink-fast { animation: aq-blink-fast 0.8s ease-in-out infinite; }
.aq-marker--blink-slow { animation: aq-blink-slow 2.0s ease-in-out infinite; }

/* Pulse ring for red markers */
.aq-marker--red.aq-marker--blink-fast::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--status-red);
  opacity: .6;
  animation: aq-pulse 1.4s ease-out infinite;
}

@keyframes aq-pulse {
  0% { transform: scale(.6); opacity: .8; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* ==== Mosque popup ==== */
.aq-popup {
  font-family: inherit;
  min-width: 240px;
}

.aq-popup__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.aq-popup__icon {
  font-size: 20px;
  line-height: 1;
  flex: 0 0 auto;
}

.aq-popup h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
  color: var(--aq-green, #1B5E20);
}

/* Gambar masjid dalam popup — auto-resize, saiz kecil & seragam */
.aq-popup__img {
  display: block;
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 8px;
  background: #eef0ee;
}

.aq-popup__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 12px;
  color: var(--aq-muted, #6B7280);
  margin-bottom: 8px;
}

.aq-popup__meta a {
  color: var(--aq-green, #1B5E20);
  text-decoration: none;
}

.aq-popup__addr {
  font-size: 12px;
  color: var(--aq-muted, #6B7280);
  margin-bottom: 8px;
}

.aq-popup__status {
  display: inline-block;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  margin-bottom: 10px;
  font-weight: 600;
}

.aq-popup__status--green { background: #D1FAE5; color: #065F46; }
.aq-popup__status--orange { background: #FEF3C7; color: #92400E; }
.aq-popup__status--red { background: #FEE2E2; color: #991B1B; }
.aq-popup__status--grey { background: #F3F4F6; color: #374151; }

.aq-popup__btn {
  display: block;
  text-align: center;
  background: var(--aq-green, #1B5E20);
  color: #fff;
  text-decoration: none;
  padding: 10px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  margin-top: 8px;
}

/* ==== Floating action buttons (GPS + Search) ==== */
.aq-gps-btn {
  position: fixed;
  right: 16px;
  bottom: 110px;
  width: 50px;
  height: 50px;
  border-radius: 16px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(231, 230, 225, 0.7);
  box-shadow: 0 8px 22px rgba(2, 44, 26, 0.18);
  display: grid;
  place-items: center;
  z-index: 999;
  cursor: pointer;
  color: var(--aq-green-dark, #08653a);
  transition: transform .12s, box-shadow .15s;
}
.aq-gps-btn:hover { box-shadow: 0 10px 28px rgba(2, 44, 26, 0.25); }
.aq-gps-btn:active { transform: scale(0.94); }
.aq-gps-btn svg { width: 22px; height: 22px; stroke-width: 2; }

/* ==================================================================
   Filter chips bar (above the map)
   ================================================================== */
.aq-filter-bar {
  position: fixed;
  top: 124px;
  left: 0;
  right: 0;
  z-index: 999;
  padding: 6px 12px 6px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  background: linear-gradient(180deg, rgba(245,240,229,.95) 0%, rgba(245,240,229,.0) 100%);
  -webkit-overflow-scrolling: touch;
}
.aq-filter-bar::-webkit-scrollbar { display: none; }

.aq-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  background: #fff;
  border: 1px solid var(--aq-border, #E5E7EB);
  color: #475569;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, transform .1s;
  box-shadow: 0 2px 4px rgba(0,0,0,.06);
}
.aq-chip:active { transform: scale(.96); }
.aq-chip.is-active {
  background: var(--aq-green, #1B5E20);
  border-color: var(--aq-green, #1B5E20);
  color: #fff;
}
.aq-chip__icon { font-size: 13px; }

/* ==================================================================
   Search overlay
   ================================================================== */
.aq-search-btn {
  position: fixed;
  right: 16px;
  bottom: 170px;
  width: 50px;
  height: 50px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--aq-green, #0c803c), var(--aq-green-dark, #08653a));
  border: none;
  box-shadow: 0 10px 24px rgba(8, 101, 58, 0.32);
  display: grid;
  place-items: center;
  z-index: 999;
  cursor: pointer;
  color: #fff;
  transition: transform .12s, box-shadow .15s;
}
.aq-search-btn:hover { box-shadow: 0 12px 30px rgba(8, 101, 58, 0.42); }
.aq-search-btn:active { transform: scale(.94); }
.aq-search-btn svg { width: 22px; height: 22px; stroke-width: 2; }

.aq-search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  z-index: 1090;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  display: flex;
  flex-direction: column;
}
.aq-search-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.aq-search-box {
  background: #fff;
  margin: 14px;
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 12px 28px -8px rgba(15,23,42,.4);
  transform: translateY(-12px);
  transition: transform .22s ease;
}
.aq-search-overlay.is-open .aq-search-box {
  transform: translateY(0);
}
.aq-search-box input {
  flex: 1;
  border: none;
  outline: none;
  font: inherit;
  font-size: 15px;
  color: var(--aq-text);
  background: transparent;
}
.aq-search-box input::placeholder { color: #94a3b8; }
.aq-search-box__close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: #f1f5f9;
  cursor: pointer;
  color: #475569;
  font-size: 16px;
  display: grid;
  place-items: center;
}

.aq-search-results {
  margin: 0 14px;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 22px -6px rgba(15,23,42,.3);
  max-height: 60vh;
  overflow-y: auto;
}
.aq-search-results:empty { display: none; }

.aq-search-result {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background-color .12s;
}
.aq-search-result:last-child { border-bottom: none; }
.aq-search-result:hover, .aq-search-result.is-focused { background: #f8fafc; }
.aq-search-result:active { background: #ecfdf5; }

.aq-search-result__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.aq-search-result__dot--green  { background: var(--status-green); }
.aq-search-result__dot--orange { background: var(--status-orange); }
.aq-search-result__dot--red    { background: var(--status-red); }
.aq-search-result__dot--grey   { background: var(--status-grey); }

.aq-search-result__body { flex: 1; min-width: 0; }
.aq-search-result__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--aq-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.aq-search-result__addr {
  font-size: 12px;
  color: var(--aq-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.aq-search-result__name mark {
  background: #fef3c7;
  color: #92400e;
  padding: 0 2px;
  border-radius: 3px;
}

.aq-search-empty {
  padding: 18px;
  text-align: center;
  color: var(--aq-muted);
  font-size: 13px;
}

/* ==================================================================
   Bottom Sheet (mosque detail modal)
   - Slides up from bottom; two snap points: peek (~45vh) & full (~88vh)
   - Drag handle on top; backdrop tap to dismiss
   ================================================================== */

.aq-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .35);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.aq-sheet-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.aq-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1101;
  background: #fff;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -12px 32px -8px rgba(15, 23, 42, .25);
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.32, .72, .35, 1);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.aq-sheet.is-peek { transform: translateY(55%); }
.aq-sheet.is-full { transform: translateY(0); }
.aq-sheet.is-dragging { transition: none; }

.aq-sheet__handle {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 8px 0 6px;
  cursor: grab;
  flex-shrink: 0;
  touch-action: none;
}
.aq-sheet__handle:active { cursor: grabbing; }
.aq-sheet__handle::before {
  content: '';
  width: 40px;
  height: 4px;
  border-radius: 3px;
  background: #cbd5e1;
}

.aq-sheet__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(241, 245, 249, .9);
  border: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 18px;
  color: #475569;
  z-index: 2;
  transition: background .15s;
}
.aq-sheet__close:hover { background: #e2e8f0; }
.aq-sheet__close:active { transform: scale(.92); }

.aq-sheet__head {
  padding: 4px 56px 12px 18px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--aq-border, #E5E7EB);
}
.aq-sheet__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--aq-green, #1B5E20);
  line-height: 1.3;
}
.aq-sheet__addr {
  margin-top: 4px;
  font-size: 13px;
  color: var(--aq-muted, #6B7280);
  line-height: 1.4;
}
.aq-sheet__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.aq-sheet__status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}
.aq-sheet__status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.aq-sheet__status--green { background: #D1FAE5; color: #065F46; }
.aq-sheet__status--orange { background: #FEF3C7; color: #92400E; }
.aq-sheet__status--red { background: #FEE2E2; color: #991B1B; }
.aq-sheet__status--grey { background: #F3F4F6; color: #374151; }
.aq-sheet__distance {
  font-size: 12px;
  color: var(--aq-muted, #6B7280);
}

.aq-sheet__body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 18px 16px;
}

.aq-sheet__section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  color: #94a3b8;
  text-transform: uppercase;
  margin: 0 0 8px;
}

.aq-ann-card {
  background: linear-gradient(135deg, #ecfdf5 0%, #fff 100%);
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.aq-ann-card__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.aq-ann-card__prayer {
  font-size: 15px;
  font-weight: 700;
  color: var(--aq-green-dark, #0E3F12);
  text-transform: capitalize;
}
.aq-ann-card__time {
  font-size: 13px;
  color: var(--aq-green, #1B5E20);
  font-weight: 600;
}
.aq-ann-card__type {
  font-size: 13px;
  color: #475569;
  margin-top: 4px;
}
.aq-ann-card__type b { color: #1f2937; }
.aq-ann-card__name {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  margin-top: 6px;
  padding: 4px 8px;
  background: rgba(255,255,255,.6);
  border-radius: 6px;
  border-left: 3px solid var(--aq-green, #1B5E20);
}
.aq-ann-card__notes {
  font-size: 12px;
  color: #64748b;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #d1fae5;
  line-height: 1.4;
}

.aq-sheet__empty {
  text-align: center;
  padding: 18px 12px;
  color: var(--aq-muted, #6B7280);
  background: #f8fafc;
  border-radius: 12px;
  font-size: 13px;
}
.aq-sheet__empty-icon { font-size: 24px; display: block; margin-bottom: 6px; }

.aq-sheet__actions {
  flex-shrink: 0;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0));
  border-top: 1px solid var(--aq-border, #E5E7EB);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: #fff;
}
.aq-sheet__actions .aq-sheet__btn--primary {
  grid-column: 1 / -1;
}

.aq-sheet__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 12px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform .1s, box-shadow .1s, background-color .15s;
  font-family: inherit;
}
.aq-sheet__btn:active { transform: scale(.97); }
.aq-sheet__btn--primary {
  background: var(--aq-green, #1B5E20);
  color: #fff;
  box-shadow: 0 3px 8px -2px rgba(27, 94, 32, .35);
}
.aq-sheet__btn--primary:hover { background: var(--aq-green-dark, #0E3F12); }
.aq-sheet__btn--ghost {
  background: #f1f5f9;
  color: #334155;
}
.aq-sheet__btn--ghost:hover { background: #e2e8f0; }
.aq-sheet__btn--ghost.is-active {
  background: #fef3c7;
  color: #92400e;
}

/* Toast (PWA) */
.aq-toast-stack {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(80px + env(safe-area-inset-bottom, 0));
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 360px;
}
.aq-toast {
  pointer-events: auto;
  background: #1f2937;
  color: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  box-shadow: 0 8px 18px -4px rgba(15,23,42,.35);
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
}
.aq-toast.is-visible { opacity: 1; transform: translateY(0); }
.aq-toast--success { background: #064e3b; }
.aq-toast--error   { background: #7f1d1d; }
.aq-toast--info    { background: #1e3a8a; }

/* Loading row for sheet body */
.aq-sheet__skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: aq-sheet-shimmer 1.4s linear infinite;
  border-radius: 8px;
  height: 56px;
  margin-bottom: 8px;
}
@keyframes aq-sheet-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
