/* ============================================================================
 * styles.css
 * ระบบยื่นคำร้องขอข้อมูลภาพกล้องวงจรปิด (CCTV) และแผนที่จุดติดตั้ง GIS
 * เทศบาลนครเจ้าพระยาสุรศักดิ์ (Antigravity 2.0 + Supabase + Cloudflare)
 * ============================================================================ */

:root {
  --primary: #00897b;
  --primary-dark: #00695c;
  --primary-light: #e0f2f1;
  --accent: #4f46e5;
  --danger: #dc2626;
  --warning: #d97706;
  --success: #059669;
  --bg-page: #f1f5f9;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Prompt", "Sarabun", sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Navigation Pill Active State */
.nav-tab-btn {
  transition: all 0.2s ease;
}
.nav-tab-btn.active {
  background: linear-gradient(135deg, #00897b 0%, #0d9488 100%);
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(0, 137, 123, 0.35);
}

/* AI OCR Smart Scan Button (Inspired by Bangpla Form) */
.btn-ocr-gradient {
  background: linear-gradient(135deg, #5b6cf9 0%, #7c3aed 100%);
  color: #ffffff;
  transition: all 0.25s ease;
  box-shadow: 0 6px 20px rgba(91, 108, 249, 0.35);
}
.btn-ocr-gradient:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 25px rgba(91, 108, 249, 0.48);
}
.btn-ocr-gradient:active {
  transform: scale(0.98);
}

/* Submit Green Gradient Button */
.btn-submit-gradient {
  background: linear-gradient(135deg, #00b09b 0%, #76b852 100%);
  color: #ffffff;
  transition: all 0.25s ease;
  box-shadow: 0 6px 20px rgba(0, 176, 155, 0.35);
}
.btn-submit-gradient:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 25px rgba(0, 176, 155, 0.45);
}

/* Drag & Drop Upload Box (Inspired by BMA CCTV Form) */
.dropzone-box {
  border: 2px dashed #10b981;
  background-color: #f8fafc;
  border-radius: 16px;
  transition: all 0.2s ease;
  cursor: pointer;
}
.dropzone-box:hover,
.dropzone-box.dragover {
  background-color: #ecfdf5;
  border-color: #059669;
  transform: translateY(-1px);
}

/* Auto-fill Highlight Flash */
@keyframes autofillPulse {
  0% {
    background-color: #d1fae5;
    border-color: #10b981;
  }
  100% {
    background-color: #f8fafc;
  }
}
.autofill-highlight {
  animation: autofillPulse 2.2s ease-out;
}

/* Leaflet Custom Markers */
.cctv-marker-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2.5px solid #ffffff;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.35);
  transition: transform 0.15s ease;
}
.cctv-marker-pin i {
  transform: rotate(45deg);
  color: #ffffff;
  font-size: 13px;
}
.cctv-marker-normal {
  background: linear-gradient(135deg, #0284c7, #0369a1);
}
.cctv-marker-lpr {
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
}
.cctv-marker-selected {
  background: linear-gradient(135deg, #059669, #047857);
  width: 38px;
  height: 38px;
  border: 3px solid #fef08a;
  box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.35), 0 4px 10px rgba(0, 0, 0, 0.4);
}
.cctv-marker-broken {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
}
.incident-marker-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border: 3px solid #ffffff;
  box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.25), 0 4px 12px rgba(0, 0, 0, 0.4);
}
.incident-marker-pin i {
  transform: rotate(45deg);
  color: #ffffff;
  font-size: 15px;
}

/* Smart Camera Aiming Overlay */
.idcard-aim-frame {
  width: min(88vw, 440px);
  aspect-ratio: 1.586;
  border: 3px solid #10b981;
  border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.68);
  position: relative;
}
.idcard-scan-line {
  position: absolute;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #34d399, #ec4899, transparent);
  animation: scanLineMove 2s infinite ease-in-out;
}
@keyframes scanLineMove {
  0% {
    top: 6%;
  }
  50% {
    top: 92%;
  }
  100% {
    top: 6%;
  }
}

/* Leaflet Popup Styling */
.leaflet-popup-content-wrapper {
  border-radius: 14px !important;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.16) !important;
  padding: 2px !important;
}
.leaflet-popup-content {
  margin: 12px 14px !important;
  font-family: "Prompt", sans-serif !important;
}
