/* === मेरो सांसद — Production-Ready MP Portal === */
:root {
  --bg: #f8f9fa;
  --white: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --nepal-red: #DC143C;
  --nepal-blue: #003893;
  --shadow-popup: 0 8px 32px rgba(0,0,0,0.16), 0 2px 8px rgba(0,0,0,0.08);
  --shadow-card: 0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  --radius: 14px;
  --font-ne: 'Noto Sans Devanagari', sans-serif;
  --font-en: 'Inter', sans-serif;
}

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

body {
  font-family: var(--font-ne);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* --- Nav --- */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 500;
}

.nav-back {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s;
}
.nav-back:hover { color: var(--nepal-red); }

.nav-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.nav-stats {
  display: flex;
  gap: 12px;
}
.nav-stat {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  font-family: var(--font-en);
  padding: 4px 12px;
  background: var(--border-light);
  border-radius: 20px;
}

/* --- Hero Section --- */
.hero {
  margin-top: 52px;
  background: linear-gradient(135deg, #fafafa 0%, #f0f0f5 100%);
  border-bottom: 3px solid;
  border-image: linear-gradient(90deg, var(--nepal-red) 0%, var(--nepal-blue) 100%) 1;
  padding: 36px 24px 28px;
  text-align: center;
  position: relative;
  z-index: 10;
}

.hero-inner {
  max-width: 600px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-block;
  padding: 4px 14px;
  background: rgba(220,20,60,0.08);
  border: 1px solid rgba(220,20,60,0.15);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--nepal-red);
  margin-bottom: 10px;
}

.hero-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.hero-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
  font-weight: 400;
}

/* --- Search --- */
.hero-search {
  position: relative;
  max-width: 420px;
  margin: 0 auto 16px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  z-index: 2;
}

.hero-search input {
  width: 100%;
  padding: 12px 16px 12px 40px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  font-family: var(--font-ne);
  background: var(--white);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.hero-search input:focus {
  border-color: var(--nepal-red);
  box-shadow: 0 0 0 3px rgba(220,20,60,0.1);
}
.hero-search input::placeholder {
  color: var(--text-light);
}

.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-popup);
  max-height: 300px;
  overflow-y: auto;
  display: none;
  z-index: 600;
}
.search-results.visible { display: block; }

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid var(--border-light);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: #f8f9fa; }

.search-result-photo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.search-result-info { flex: 1; min-width: 0; }
.search-result-name { font-size: 13px; font-weight: 600; }
.search-result-meta { font-size: 11px; color: var(--text-muted); }
.search-result-party {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  color: white;
  font-family: var(--font-en);
}

/* --- Chips --- */
.hero-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.hero-chip {
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--text-muted);
  transition: all 0.15s;
  font-family: var(--font-en);
}
.hero-chip:hover { border-color: var(--nepal-red); color: var(--nepal-red); }
.hero-chip .chip-count { 
  font-weight: 700;
  margin-left: 2px;
}

/* --- Map Viewport --- */
.map-viewport {
  position: relative;
  width: 100%;
  height: calc(100vh - 230px);
  background: var(--white);
  overflow: hidden;
  cursor: grab;
}
.map-viewport:active { cursor: grabbing; }

.map-canvas {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: 0 0;
}

.map-canvas svg {
  width: 92%;
  max-width: 1200px;
  height: auto;
  max-height: calc(100vh - 280px);
  pointer-events: all;
}

/* --- Zoom Controls --- */
.zoom-controls {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 150;
}

.zoom-btn {
  width: 42px;
  height: 42px;
  border: none;
  background: var(--white);
  color: var(--text);
  font-size: 20px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-card);
  transition: background 0.15s, transform 0.1s;
  font-family: var(--font-en);
}
.zoom-btn:hover { background: #f3f4f6; }
.zoom-btn:active { transform: scale(0.92); }

/* --- Keyboard Hint --- */
.keyboard-hint {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
  padding: 8px 20px;
  background: rgba(26,26,46,0.85);
  backdrop-filter: blur(8px);
  color: rgba(255,255,255,0.8);
  border-radius: 24px;
  font-size: 11px;
  font-family: var(--font-en);
  font-weight: 500;
  z-index: 150;
  opacity: 0.8;
  transition: opacity 0.3s;
  pointer-events: none;
}

/* === RICH POPUP CARD === */
.map-popup {
  position: fixed;
  z-index: 200;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-popup);
  min-width: 340px;
  max-width: 400px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.97);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
  pointer-events: none;
  overflow: hidden;
}
.map-popup.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.popup-accent { height: 4px; width: 100%; }

.popup-close {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: all 0.15s;
}
.popup-close:hover { background: #f3f4f6; color: var(--text); }

.popup-content { padding: 16px 18px 14px; }

.popup-arrow {
  position: absolute;
  bottom: -8px; left: 50%;
  transform: translateX(-50%);
  width: 16px; height: 8px;
  overflow: hidden;
}
.popup-arrow::after {
  content: '';
  position: absolute;
  top: -6px; left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 12px; height: 12px;
  background: var(--white);
  box-shadow: 2px 2px 4px rgba(0,0,0,0.08);
}

/* Profile Section */
.popup-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  padding-right: 24px;
}

.popup-photo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  border: 2px solid var(--white);
}

.popup-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: white;
  font-family: var(--font-en);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.popup-names { flex: 1; min-width: 0; }

.popup-name-ne {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  margin: 0;
}
.popup-name-en {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  font-family: var(--font-en);
  margin-top: 1px;
}

/* Party Row */
.popup-party-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--border-light);
  border-radius: 8px;
  margin-bottom: 12px;
}
.popup-party-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.popup-party-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
}
.popup-party-badge {
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: white;
  font-family: var(--font-en);
}

/* Info Grid */
.popup-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}
.popup-info-item { display: flex; gap: 6px; padding: 4px 0; }
.popup-info-icon { font-size: 13px; margin-top: 1px; flex-shrink: 0; }
.popup-info-data { min-width: 0; }
.popup-info-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1px;
}
.popup-info-value {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}

/* Performance mini-bar */
.popup-perf {
  display: flex;
  gap: 10px;
  padding: 6px 0 10px;
  border-top: 1px solid var(--border-light);
  margin-bottom: 8px;
}
.perf-item {
  text-align: center;
  flex: 1;
}
.perf-num {
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-en);
  color: var(--text);
}
.perf-label {
  font-size: 9px;
  color: var(--text-light);
  font-weight: 500;
}

/* Action Buttons */
.popup-actions {
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.popup-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s;
  cursor: pointer;
  border: none;
}
.popup-btn-detail {
  background: var(--text);
  color: white;
}
.popup-btn-detail:hover {
  background: #2d2d4e;
}
.popup-btn-icon { font-size: 13px; }

/* Multi-MP List */
.popup-list-title { font-size: 15px; font-weight: 600; margin-bottom: 2px; padding-right: 24px; }
.popup-list-count { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.popup-mp-list {
  max-height: 260px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
}
.popup-mp-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.1s;
}
.popup-mp-item:hover { background: #f8f9fa; }
.popup-mp-item:last-child { border-bottom: none; }
.popup-mp-photo { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.popup-mp-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.popup-mp-info { flex: 1; min-width: 0; }
.popup-mp-name { font-size: 13px; font-weight: 600; }
.popup-mp-const { font-size: 11px; color: var(--text-muted); }
.popup-mp-arrow { color: var(--text-light); font-size: 14px; font-family: var(--font-en); }

/* Scrollbar */
.popup-mp-list::-webkit-scrollbar { width: 4px; }
.popup-mp-list::-webkit-scrollbar-track { background: transparent; }
.popup-mp-list::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

/* === MP DETAIL OVERLAY === */
.mp-detail-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(26,26,46,0.6);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
.mp-detail-overlay.visible {
  display: flex;
}

.mp-detail-card {
  background: var(--white);
  border-radius: 20px;
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.25);
  position: relative;
  animation: slideUp 0.3s ease;
}

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

.detail-close {
  position: sticky;
  top: 12px;
  float: right;
  margin: 12px 12px 0 0;
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--border);
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.15s;
}
.detail-close:hover { background: var(--border-light); color: var(--text); }

/* Detail Content Components */
.detail-header {
  text-align: center;
  padding: 32px 24px 20px;
  background: linear-gradient(135deg, #f8f8fc 0%, #f0f0f5 100%);
  border-bottom: 3px solid;
}

.detail-photo {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--white);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  margin-bottom: 12px;
}

.detail-name-ne {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}
.detail-name-en {
  font-size: 14px;
  color: var(--text-muted);
  font-family: var(--font-en);
  font-weight: 400;
  margin-bottom: 12px;
}

.detail-party-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 20px;
  color: white;
  font-size: 13px;
  font-weight: 600;
}
.detail-party-pill img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

.detail-body { padding: 24px; }

.detail-section {
  margin-bottom: 20px;
}
.detail-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border-light);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.detail-grid-item { }
.detail-grid-label {
  font-size: 10px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 3px;
}
.detail-grid-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.detail-bio {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

/* Performance Stats Grid */
.detail-perf-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.detail-perf-item {
  text-align: center;
  padding: 14px 8px;
  background: var(--border-light);
  border-radius: 12px;
}
.detail-perf-num {
  font-size: 24px;
  font-weight: 700;
  font-family: var(--font-en);
  color: var(--text);
}
.detail-perf-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

/* === Mobile === */
@media (max-width: 640px) {
  .hero { padding: 24px 16px 20px; }
  .hero-title { font-size: 22px; }
  .map-viewport { height: calc(100vh - 200px); }
  .map-popup { min-width: 290px; max-width: 330px; }
  .popup-content { padding: 12px 14px; }
  .popup-photo, .popup-avatar { width: 44px; height: 44px; }
  .popup-name-ne { font-size: 15px; }
  .popup-info-grid { grid-template-columns: 1fr; }
  .keyboard-hint { display: none; }
  .mp-detail-card { max-width: 100%; border-radius: 16px; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-perf-grid { grid-template-columns: repeat(2, 1fr); }
}

/* === COMPLAINT BUTTON (in detail page) === */
.detail-complaint-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--nepal-red) 0%, #b91c3c 100%);
  color: white;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-family: var(--font-ne);
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(220,20,60,0.3);
  margin-top: 8px;
}
.detail-complaint-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(220,20,60,0.4);
}
.detail-complaint-btn:active { transform: scale(0.98); }
.detail-complaint-btn .btn-en {
  font-family: var(--font-en);
  font-weight: 600;
  font-size: 13px;
  opacity: 0.9;
}

/* === COMPLAINT FORM === */
.complaint-card { max-width: 560px; }

.complaint-header {
  text-align: center;
  padding: 28px 24px 20px;
  background: linear-gradient(135deg, #fef2f2 0%, #fff1f2 100%);
  border-bottom: 3px solid var(--nepal-red);
}
.complaint-header-icon { font-size: 36px; margin-bottom: 8px; }
.complaint-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}
.complaint-subtitle {
  font-size: 13px;
  font-family: var(--font-en);
  color: var(--text-muted);
  margin-bottom: 12px;
}
.complaint-mp-info {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--white);
  border-radius: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.complaint-mp-photo {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
}
.complaint-mp-name { font-size: 13px; font-weight: 600; }
.complaint-mp-party {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  color: white;
  font-family: var(--font-en);
}

.complaint-form { padding: 20px 24px; }

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

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-label-en {
  font-family: var(--font-en);
  font-weight: 400;
  font-size: 11px;
  color: var(--text-muted);
}

.form-select, .form-input, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: var(--font-ne);
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color 0.2s;
}
.form-select:focus, .form-input:focus, .form-textarea:focus {
  border-color: var(--nepal-red);
}
.form-textarea { resize: vertical; min-height: 100px; }
.form-select { cursor: pointer; }

.form-upload {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-align: center;
}
.form-upload:hover { border-color: var(--nepal-red); background: #fef2f2; }

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
}
.upload-icon { font-size: 24px; }

.upload-preview {
  position: relative;
  display: inline-block;
}
.upload-preview img {
  max-width: 200px;
  max-height: 150px;
  border-radius: 8px;
  object-fit: cover;
}
.upload-remove {
  position: absolute;
  top: -6px; right: -6px;
  width: 24px; height: 24px;
  background: var(--nepal-red);
  color: white;
  border: 2px solid white;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.form-note {
  padding: 10px 14px;
  background: #f0fdf4;
  border-radius: 10px;
  font-size: 12px;
  color: #166534;
  margin-bottom: 16px;
  line-height: 1.5;
}

.complaint-submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--nepal-red) 0%, #b91c3c 100%);
  color: white;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-family: var(--font-ne);
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(220,20,60,0.3);
}
.complaint-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(220,20,60,0.4);
}

/* Success State */
.complaint-success {
  text-align: center;
  padding: 40px 24px;
}
.success-icon { font-size: 48px; margin-bottom: 12px; }
.success-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.success-subtitle {
  font-size: 14px;
  font-family: var(--font-en);
  color: var(--text-muted);
  margin-bottom: 16px;
}
.success-msg {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 12px;
}
.success-ref {
  display: inline-block;
  padding: 6px 16px;
  background: var(--border-light);
  border-radius: 8px;
  font-size: 12px;
  font-family: var(--font-en);
  font-weight: 600;
  color: var(--text-muted);
}
