/* ===================================================================
   SILAPOR DLH KABUPATEN LEMBATA — ULTRA-LIGHTWEIGHT & MOBILE-FIRST CSS
   =================================================================== */

:root {
  --primary: #059669;
  --primary-dark: #064e3b;
  --primary-light: #10b981;
  --primary-soft: #ecfdf5;
  --accent: #d97706;
  --bg-body: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.12);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ===================================================================
   HEADER
   =================================================================== */
.app-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 3px 8px rgba(5, 150, 105, 0.3);
}

.brand-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary-dark);
  line-height: 1.2;
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-cloud-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-cloud-badge:hover {
  background: #e2e8f0;
}

.dot-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.btn-wa-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #25d366;
  color: white;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  transition: all 0.2s;
}

.btn-wa-header:hover {
  background: #20ba5a;
}

@media (max-width: 600px) {
  .btn-wa-header span {
    display: none;
  }
}

/* ===================================================================
   NAVIGATION BAR (TABS)
   =================================================================== */
.nav-bar {
  background: #ffffff;
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 65px;
  z-index: 90;
}

.nav-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 8px;
}

.nav-inner::-webkit-scrollbar {
  display: none;
}

.nav-tab-btn {
  background: none;
  border: none;
  padding: 12px 16px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

.nav-tab-btn:hover {
  color: var(--primary);
}

.nav-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ===================================================================
   MAIN CONTAINER & TABS
   =================================================================== */
.main-wrap {
  flex: 1;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 16px 80px 16px;
}

.tab-content {
  display: none;
  animation: fadeIn 0.25s ease-out forwards;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Welcome Box */
.welcome-box {
  background: linear-gradient(135deg, #064e3b 0%, #047857 100%);
  color: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
}

.welcome-tag {
  display: inline-block;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #a7f3d0;
  margin-bottom: 10px;
}

.welcome-heading {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 8px;
}

.welcome-desc {
  font-size: 0.88rem;
  color: #d1fae5;
  line-height: 1.5;
}

/* ===================================================================
   FORMULIR ADUAN UTAMA
   =================================================================== */
.form-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.form-card-header {
  padding: 20px 24px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}

.form-card-badge {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.form-card-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
}

.form-card-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.aduan-form {
  padding: 24px;
}

.form-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin: 18px 0 14px 0;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--primary-soft);
}

.form-section-title:first-child {
  margin-top: 0;
}

.form-section-title span {
  width: 22px;
  height: 22px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 640px) {
  .form-row-2 {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.form-field {
  margin-bottom: 16px;
}

.field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
}

.req {
  color: #e11d48;
}

.input-text,
.input-select,
.input-textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #ffffff;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
}

.input-text:focus,
.input-select:focus,
.input-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.input-sm {
  padding: 6px 10px;
  font-size: 0.82rem;
  background: #f8fafc;
}

/* Category Selection Chips */
.category-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.chip-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  transition: all 0.2s;
}

.chip-item input[type="radio"] {
  display: none;
}

.chip-item:hover {
  background: var(--primary-soft);
  border-color: #86efac;
}

.chip-item.active {
  background: #dcfce7;
  border-color: var(--primary);
  color: #065f46;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.15);
}

/* GPS Button Box */
.gps-box {
  margin-bottom: 12px;
}

.btn-gps {
  width: 100%;
  padding: 10px 16px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #059669;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-gps:hover {
  background: #dcfce7;
}

.gps-status-msg {
  font-size: 0.78rem;
  margin-top: 6px;
  display: none;
}

/* Main Submit Button */
.btn-submit-main {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--primary) 0%, #047857 100%);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3);
  transition: all 0.2s;
  margin-top: 10px;
}

.btn-submit-main:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(5, 150, 105, 0.4);
}

.submit-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 10px;
}

/* ===================================================================
   TRACKING TAB
   =================================================================== */
.track-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 28px 24px;
  box-shadow: var(--shadow-sm);
}

.track-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 6px;
}

.track-sub {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.track-input-group {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.input-track {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.btn-track-action {
  padding: 10px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.btn-track-action:hover {
  background: #047857;
}

.quick-sample-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.btn-sample-tag {
  background: #f1f5f9;
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 0.78rem;
  cursor: pointer;
}

.btn-sample-tag:hover {
  background: #e2e8f0;
}

.track-result-wrap {
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 28px;
  margin-top: 20px;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 8px;
  width: 2px;
  background: #e2e8f0;
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
}

.timeline-dot {
  position: absolute;
  left: -28px;
  top: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #cbd5e1;
}

.timeline-item.completed .timeline-dot {
  background: var(--primary);
  border-color: var(--primary-soft);
}

.timeline-item.active .timeline-dot {
  background: #f59e0b;
  border-color: #fef3c7;
}

.timeline-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-main);
}

.timeline-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.timeline-desc {
  font-size: 0.85rem;
  color: #475569;
  background: #f8fafc;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-top: 4px;
}

/* ===================================================================
   MAP TAB
   =================================================================== */
.map-card-box {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.map-header-bar {
  padding: 16px 20px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.map-filters-inline {
  display: flex;
  gap: 8px;
}

.select-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
}

.map-render-container {
  height: 480px;
  width: 100%;
  background: #e0f2fe;
}

/* ===================================================================
   DATA & TABLE TAB
   =================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.kpi-box {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.kpi-num {
  font-family: 'Outfit', sans-serif;
  font-size: 1.7rem;
  font-weight: 900;
  color: var(--text-main);
  margin-top: 2px;
}

.kpi-baru .kpi-num { color: #e11d48; }
.kpi-proses .kpi-num { color: #d97706; }
.kpi-selesai .kpi-num { color: #059669; }

.table-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-toolbar {
  padding: 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 260px;
}

.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.data-table th {
  background: #f1f5f9;
  color: #475569;
  font-weight: 700;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.data-table tr:hover {
  background: #f8fafc;
}

.table-footer-info {
  padding: 12px 16px;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: #f8fafc;
  border-top: 1px solid var(--border);
}

/* Status Badges */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-baru { background: #ffe4e6; color: #e11d48; }
.badge-diverifikasi { background: #fef3c7; color: #d97706; }
.badge-ditindaklanjuti { background: #dbeafe; color: #2563eb; }
.badge-selesai { background: #dcfce7; color: #15803d; }
.badge-ditolak { background: #f1f5f9; color: #64748b; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #047857; }

.btn-secondary { background: #e2e8f0; color: #334155; }
.btn-secondary:hover { background: #cbd5e1; }

.btn-outline { background: white; border-color: var(--border); color: #334155; }
.btn-outline:hover { background: #f1f5f9; }

.btn-sm { padding: 4px 8px; font-size: 0.78rem; }

/* ===================================================================
   MODAL WINDOWS
   =================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.show {
  display: flex;
}

.modal-dialog {
  background: #ffffff !important;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
}

.modal-header {
  padding: 16px 20px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3,
.modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}

.modal-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  background: #f8fafc;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 11000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.toast {
  background: #0f172a;
  color: white;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.toast-success { border-left: 4px solid #10b981; }
.toast-warning { border-left: 4px solid #f59e0b; }
.toast-info { border-left: 4px solid #3b82f6; }

/* Floating WhatsApp Button */
.floating-wa-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: inline-flex;
  align-items: center;
  background: #25d366;
  color: white;
  border-radius: 999px;
  padding: 12px;
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.4);
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-wa-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.floating-wa-text {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  font-weight: 700;
  font-size: 0.85rem;
  opacity: 0;
  transition: all 0.25s ease;
}

.floating-wa-btn:hover {
  padding: 12px 18px;
  gap: 8px;
  transform: translateY(-2px);
}

.floating-wa-btn:hover .floating-wa-text {
  max-width: 140px;
  opacity: 1;
}

/* ===================================================================
   MOBILE-FIRST PERFECTION & OVERFLOW SHIELD (< 520px)
   =================================================================== */
html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden !important;
}

@media (max-width: 520px) {
  .header-inner {
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .brand-icon {
    width: 34px;
    height: 34px;
    font-size: 1.1rem;
    border-radius: 8px;
  }

  .brand-name {
    font-size: 0.92rem;
  }

  .brand-sub {
    font-size: 0.68rem;
  }

  .header-right {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
  }

  .btn-cloud-badge {
    font-size: 0.72rem;
    padding: 6px 10px;
    flex: 1;
    justify-content: center;
  }

  .btn-wa-header {
    font-size: 0.72rem;
    padding: 6px 10px;
    flex: 1;
    justify-content: center;
  }

  .btn-wa-header span {
    display: inline !important;
  }

  .nav-bar {
    position: sticky;
    top: auto;
  }

  .nav-tab-btn {
    padding: 10px 12px;
    font-size: 0.8rem;
  }

  .main-wrap {
    padding: 14px 10px 80px 10px;
  }

  .welcome-box {
    padding: 16px 14px;
    border-radius: var(--radius-md);
  }

  .welcome-heading {
    font-size: 1.12rem;
  }

  .welcome-desc {
    font-size: 0.82rem;
  }

  .form-card {
    border-radius: var(--radius-md);
  }

  .form-card-header {
    padding: 14px 16px;
  }

  .form-card-title {
    font-size: 1.05rem;
  }

  .aduan-form {
    padding: 16px 14px;
  }

  .form-section-title {
    font-size: 0.92rem;
    margin: 14px 0 10px 0;
  }

  .category-chips {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .chip-item {
    padding: 10px 12px;
    font-size: 0.82rem;
  }

  .input-text, .input-select, .input-textarea {
    font-size: 0.88rem;
    padding: 9px 12px;
  }

  .btn-submit-main {
    font-size: 0.95rem;
    padding: 12px 16px;
  }

  .track-card {
    padding: 18px 14px;
    border-radius: var(--radius-md);
  }

  .track-title {
    font-size: 1.15rem;
  }

  .track-input-group {
    flex-direction: column;
  }

  .btn-track-action {
    width: 100%;
    padding: 12px;
  }

  .map-render-container {
    height: 320px;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .kpi-box {
    padding: 10px 12px;
  }

  .kpi-num {
    font-size: 1.3rem;
  }

  .floating-wa-btn {
    bottom: 16px;
    right: 16px;
    padding: 10px;
  }
}
