:root {
  --bg: #060d1a;
  --surface: #0c1829;
  --card: rgba(18, 32, 56, 0.82);
  --card-solid: #122038;
  --border: rgba(59, 130, 246, 0.22);
  --border-strong: rgba(96, 165, 250, 0.4);
  --blue: #3b82f6;
  --blue2: #60a5fa;
  --purple: #8b5cf6;
  --text: #eef3fb;
  --muted: #8fa3c1;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --r: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse 90% 50% at 10% -10%, rgba(59, 130, 246, 0.2), transparent 55%),
    radial-gradient(ellipse 70% 40% at 100% 0%, rgba(139, 92, 246, 0.12), transparent 50%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(29, 78, 216, 0.1), transparent 55%);
  background-attachment: fixed;
}

a { color: var(--blue2); text-decoration: none; }
a:hover { color: #93c5fd; }

/* NAV */
.navbar {
  background: rgba(12, 24, 41, 0.92);
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 1rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand a {
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff;
  letter-spacing: -0.02em;
}
.hamburger {
  width: 42px; height: 42px;
  display: flex; flex-direction: column; justify-content: center; gap: 5px;
  padding: 9px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card-solid);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.hamburger span {
  display: block; height: 2.5px; width: 100%;
  background: var(--text); border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.15s ease;
}
.hamburger.open span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

.nav-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  z-index: 1000; opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
.nav-overlay.open { opacity: 1; pointer-events: auto; }

.nav-menu {
  position: fixed; top: 0; right: 0;
  width: min(300px, 86vw); height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 4.5rem 1rem 1.5rem;
  display: flex; flex-direction: column; gap: 0.25rem;
  z-index: 1001;
  transform: translateX(105%);
  transition: transform 0.22s ease;
  will-change: transform;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.nav-menu.open { transform: translateX(0); }
.nav-menu a {
  display: block; padding: 0.85rem 1rem; border-radius: 10px;
  color: var(--muted); font-weight: 600; font-size: 1rem;
}
.nav-menu a.active, .nav-menu a:active {
  background: var(--blue); color: #fff;
}

.auth-box {
  margin-top: 0.75rem; padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 0.5rem;
}
.auth-box .btn-block {
  width: 100%; padding: 0.9rem; font-size: 0.95rem;
  font-weight: 700; text-align: center; border-radius: 11px;
}
.auth-hello { text-align: center; color: var(--muted); font-size: 0.85rem; }

@media (min-width: 880px) {
  .hamburger, .nav-overlay { display: none !important; }
  .nav-menu {
    position: static; transform: none; width: auto; height: auto;
    flex-direction: row; align-items: center; padding: 0;
    border: none; background: transparent; overflow: visible; gap: 0.15rem;
  }
  .nav-menu a { padding: 0.45rem 0.8rem; font-size: 0.88rem; }
  .auth-box {
    margin: 0 0 0 0.5rem; padding: 0; border: none; flex-direction: row;
  }
  .auth-box .btn-block { width: auto; padding: 0.45rem 0.9rem; font-size: 0.82rem; }
  .auth-hello { display: none; }
}

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  padding: 0.6rem 1.15rem; border-radius: 11px;
  font-weight: 700; font-size: 0.92rem; border: none;
  cursor: pointer; font-family: inherit;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, var(--blue), #2563eb);
  color: #fff;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(59, 130, 246, 0.45); }
.btn-outline {
  background: transparent; color: var(--blue2);
  border: 1px solid var(--border);
}
.btn-ghost {
  background: rgba(255,255,255,0.05); color: var(--muted);
  border: 1px solid var(--border);
}
.btn-success { background: #059669; color: #fff; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-warning { background: #d97706; color: #fff; }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.78rem; border-radius: 8px; }

/* LAYOUT */
.container { max-width: 1040px; margin: 0 auto; padding: 1.25rem 1rem 2rem; }
.page-title {
  font-size: 1.65rem; font-weight: 800;
  letter-spacing: -0.03em; margin-bottom: 0.25rem;
}
.page-subtitle { color: var(--muted); margin-bottom: 1.25rem; font-size: 0.92rem; }

/* Glass cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.2rem;
  margin-bottom: 1rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem;
}

.hero-banner {
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.85) 0%, rgba(49, 46, 129, 0.9) 55%, rgba(30, 27, 75, 0.95) 100%);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: var(--r);
  padding: 1.5rem 1.25rem;
  margin-bottom: 1.25rem;
  text-align: center;
  box-shadow: 0 8px 32px rgba(49, 46, 129, 0.35);
}
.hero-banner h2 { font-size: 1.2rem; margin-bottom: 0.3rem; }
.hero-banner p { color: #c7d2fe; font-size: 0.9rem; margin-bottom: 0.85rem; }

/* Stats */
.stats-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem; margin-bottom: 1.25rem;
}
@media (min-width: 600px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}
.stat-card {
  background: rgba(14, 24, 41, 0.9);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 0.6rem;
  text-align: center;
  border-top: 3px solid var(--blue);
  transition: border-color 0.2s, transform 0.15s;
}
.stat-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}
.stat-card .number {
  font-size: 1.85rem; font-weight: 800;
  color: var(--blue2);
  font-variant-numeric: tabular-nums;
}
.stat-card .label {
  font-size: 0.7rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em; margin-top: 0.15rem;
}

/* Map dark theme */
#map {
  height: 280px; width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  filter: brightness(0.88) contrast(1.05) saturate(0.85);
}
.map-legend {
  display: flex; flex-wrap: wrap; gap: 0.65rem 1rem;
  margin-top: 0.65rem; font-size: 0.78rem; color: var(--muted);
}
.map-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend-dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block; border: 1px solid rgba(255,255,255,0.35);
}
.legend-open { background: #3b82f6; }
.legend-progress { background: #f59e0b; }
.legend-resolved { background: #22c55e; }
.legend-rejected { background: #ef4444; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block; margin-bottom: 0.35rem;
  font-size: 0.84rem; color: var(--muted); font-weight: 600;
}
.form-control {
  width: 100%; padding: 0.75rem 0.9rem;
  background: rgba(6, 13, 26, 0.75);
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: 1rem; font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--blue); }
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238fa3c1' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.9rem center;
  padding-right: 2.2rem;
}
textarea.form-control { min-height: 100px; resize: vertical; }

.badge {
  display: inline-block; padding: 0.22rem 0.6rem;
  border-radius: 20px; font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase;
}
.badge-open { background: #1e3a5f; color: #93c5fd; }
.badge-progress { background: #422006; color: #fbbf24; }
.badge-resolved { background: #064e3b; color: #6ee7b7; }
.badge-rejected { background: #450a0a; color: #fca5a5; }
.badge-priority { background: #7f1d1d; color: #fecaca; }

.progress-bar {
  height: 6px; background: var(--border); border-radius: 3px;
  overflow: hidden; margin-top: 0.5rem;
}
.progress-fill { height: 100%; border-radius: 3px; }
.progress-open { background: var(--blue); width: 28%; }
.progress-progress { background: var(--warn); width: 58%; }
.progress-resolved { background: var(--ok); width: 100%; }
.progress-rejected { background: var(--bad); width: 100%; }

/* Chat */
.chatbot-toggle {
  position: fixed; bottom: 1.1rem; right: 1.1rem;
  width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff; border: none; font-size: 1.4rem; cursor: pointer;
  z-index: 900; box-shadow: 0 4px 16px rgba(59,130,246,0.4);
}
.chatbot-window {
  position: fixed; bottom: 5.2rem; right: 1rem;
  width: min(350px, calc(100vw - 1.5rem)); height: 420px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; display: none; flex-direction: column;
  z-index: 900; overflow: hidden;
}
.chatbot-window.open { display: flex; }
.chatbot-header {
  background: linear-gradient(135deg, #1e3a5f, #1d4ed8);
  padding: 0.8rem 1rem; display: flex;
  justify-content: space-between; align-items: center; font-weight: 700;
}
.chatbot-messages {
  flex: 1; overflow-y: auto; padding: 0.9rem;
  display: flex; flex-direction: column; gap: 0.6rem;
  -webkit-overflow-scrolling: touch;
}
.chat-msg {
  max-width: 88%; padding: 0.6rem 0.85rem;
  border-radius: 12px; font-size: 0.88rem;
}
.chat-msg.bot { background: var(--card-solid); align-self: flex-start; }
.chat-msg.user { background: var(--blue); align-self: flex-end; }
.chatbot-input-area {
  display: flex; gap: 0.4rem; padding: 0.7rem;
  border-top: 1px solid var(--border);
}
.chatbot-input-area input {
  flex: 1; padding: 0.55rem 0.8rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-size: 0.95rem;
}
.chatbot-input-area button {
  padding: 0.55rem 0.9rem;
  background: var(--blue); border: none; border-radius: 10px;
  color: #fff; font-weight: 700; cursor: pointer;
}

.footer {
  background: rgba(12, 24, 41, 0.95);
  border-top: 1px solid var(--border);
  padding: 1.5rem 1rem; margin-top: 2rem;
  text-align: center; color: var(--muted); font-size: 0.84rem;
}
.footer .powered { margin-top: 0.4rem; font-weight: 700; color: var(--text); }
.footer .powered strong { color: var(--blue2); }

.auth-container { max-width: 400px; margin: 1.75rem auto; }
.tabs {
  display: flex; background: rgba(0,0,0,0.3);
  border-radius: 10px; padding: 3px; margin-bottom: 1.1rem;
}
.tab {
  flex: 1; padding: 0.65rem; text-align: center; cursor: pointer;
  color: var(--muted); border-radius: 8px; font-weight: 700;
}
.tab.active { background: var(--blue); color: #fff; }
.auth-form { display: none; }
.auth-form.active { display: block; }

.issue-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 1rem; margin-bottom: 0.75rem;
  transition: border-color 0.2s, transform 0.15s;
}
.issue-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.issue-meta {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  margin: 0.45rem 0; font-size: 0.75rem; color: var(--muted);
}
.filters {
  display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem;
}
.filter-btn {
  padding: 0.4rem 0.8rem; border-radius: 20px;
  border: 1px solid var(--border); background: transparent;
  color: var(--muted); cursor: pointer; font-size: 0.82rem;
  font-family: inherit; font-weight: 600;
}
.filter-btn.active {
  background: var(--blue); color: #fff; border-color: var(--blue);
}

/* Team hover */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
}
.team-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 1.35rem 1rem; text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
}
.team-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: 0 12px 32px rgba(59, 130, 246, 0.2);
}
.team-card .avatar {
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; font-weight: 800; margin: 0 auto 0.7rem;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.35);
}
.team-card .role {
  color: var(--blue2); font-size: 0.82rem; font-weight: 700;
  margin: 0.2rem 0 0.4rem;
}
.team-card .email { font-size: 0.75rem; color: var(--muted); word-break: break-all; }

.help-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}
.help-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 1.5rem 1.2rem; text-align: center;
  cursor: pointer; transition: transform 0.2s, border-color 0.2s;
}
.help-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
}
.help-card .icon { font-size: 2rem; margin-bottom: 0.5rem; }

.staff-actions {
  display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.7rem;
}
.photo-preview {
  max-width: 100%; max-height: 180px; border-radius: 8px;
  margin-top: 0.5rem; display: none;
}

.live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok); margin-right: 6px;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* Skeleton loaders */
.skeleton {
  background: linear-gradient(90deg, rgba(30,58,95,0.4) 25%, rgba(59,130,246,0.15) 50%, rgba(30,58,95,0.4) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
  border-radius: 8px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-stat {
  height: 72px; border-radius: 12px;
}
.skeleton-line {
  height: 14px; margin-bottom: 0.5rem; border-radius: 6px;
}
.skeleton-card {
  height: 110px; margin-bottom: 0.75rem; border-radius: 12px;
}

/* Toasts */
.toast-wrap {
  position: fixed; top: 1rem; left: 50%;
  transform: translateX(-50%);
  z-index: 2000; display: flex; flex-direction: column;
  gap: 0.5rem; width: min(360px, calc(100vw - 1.5rem));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  animation: toastIn 0.3s ease;
  border: 1px solid transparent;
}
.toast-success {
  background: #064e3b; color: #6ee7b7; border-color: rgba(52,211,153,0.35);
}
.toast-error {
  background: #450a0a; color: #fca5a5; border-color: rgba(248,113,113,0.35);
}
.toast-info {
  background: #1e3a5f; color: #93c5fd; border-color: rgba(59,130,246,0.35);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.w-full { width: 100%; }

.alert {
  padding: 0.8rem 1rem; border-radius: 10px;
  margin-bottom: 0.9rem; font-size: 0.88rem;
}
.alert-success { background: #064e3b; color: #6ee7b7; }
.alert-error { background: #450a0a; color: #fca5a5; }
.alert-info { background: #1e3a5f; color: #93c5fd; }

.loading-text { text-align: center; color: var(--muted); padding: 1.5rem; }

@media (max-width: 640px) {
  .page-title { font-size: 1.4rem; }
  #map { height: 220px; }
  .chatbot-window { left: 0.5rem; right: 0.5rem; width: auto; }
}
