/* ═══════════════════════════════════════
   FisherGuard — PWA Dark Blue Theme
   ═══════════════════════════════════════ */

:root {
  --bg: #0a0e1a;
  --bg2: #0f1729;
  --bg3: #131b2e;
  --bg4: #182240;
  --border: #1e2a45;
  --border2: #253352;
  --text: #e2e8f0;
  --text2: #94a3b8;
  --text3: #64748b;
  --blue: #3b82f6;
  --blue2: #60a5fa;
  --blue3: #2563eb;
  --green: #22c55e;
  --teal: #14b8a6;
  --orange: #f97316;
  --red: #ef4444;
  --yellow: #eab308;
  --r: 12px;
  --rs: 8px;
  --nav-h: 64px;
  --header-h: 56px;
}

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

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ═══ SPLASH ═══ */
#splash-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s, visibility 0.5s;
}

#splash-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.splash-content { text-align: center; }
.splash-icon { margin-bottom: 16px; }
.splash-content h1 { font-size: 28px; font-weight: 800; background: linear-gradient(135deg, var(--blue2), var(--teal)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.splash-content p { color: var(--text3); margin-top: 4px; font-size: 14px; }

.splash-loader { width: 120px; height: 3px; background: var(--border); border-radius: 2px; margin: 20px auto 0; overflow: hidden; }
.splash-bar { width: 0; height: 100%; background: linear-gradient(90deg, var(--blue), var(--teal)); border-radius: 2px; animation: splashLoad 1.5s ease forwards; }
@keyframes splashLoad { to { width: 100%; } }

/* ═══ APP LAYOUT ═══ */
#app { display: flex; flex-direction: column; height: 100vh; }

/* ═══ HEADER ═══ */
#app-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.header-left { display: flex; align-items: center; gap: 10px; }
.header-title { font-size: 16px; font-weight: 700; background: linear-gradient(135deg, var(--blue2), var(--teal)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.header-right { display: flex; align-items: center; gap: 10px; }

.weather-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  background: rgba(59,130,246,0.1);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--blue2);
}

.header-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text2);
  width: 36px; height: 36px;
  border-radius: var(--rs);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}

.header-badge {
  position: absolute;
  top: -4px; right: -4px;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  background: var(--red);
  color: white;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
}

/* ═══ CONTENT ═══ */
#app-content {
  flex: 1;
  overflow-y: auto;
  padding-bottom: calc(var(--nav-h) + 8px);
}

.app-tab { display: none; padding: 16px; animation: fadeIn 0.3s ease; }
.app-tab.active { display: block; }

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

/* ═══ BOTTOM NAV ═══ */
#bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--bg2);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text3);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--rs);
  transition: all 0.2s;
}

.nav-tab.active {
  color: var(--blue2);
}

.nav-tab.active svg { stroke: var(--blue2); }

/* ═══ WELCOME CARD ═══ */
.welcome-card {
  background: linear-gradient(135deg, rgba(59,130,246,0.12), rgba(20,184,166,0.08));
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--r);
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.welcome-greeting { font-size: 12px; color: var(--blue2); font-weight: 500; }
.welcome-card h2 { font-size: 22px; margin: 4px 0; }
.welcome-sub { font-size: 13px; color: var(--text3); }

.welcome-stats { display: flex; gap: 20px; }
.ws { text-align: center; }
.ws-val { display: block; font-size: 22px; font-weight: 700; color: var(--blue2); }
.ws-lbl { font-size: 10px; color: var(--text3); }

/* ═══ SECTION TITLES ═══ */
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 10px;
  letter-spacing: 0.3px;
}

/* ═══ QUICK ACTIONS ═══ */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text2);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 11px;
  font-family: 'Inter', sans-serif;
}

.quick-btn:hover, .quick-btn:active {
  background: var(--bg4);
  border-color: var(--blue);
  color: var(--blue2);
  transform: translateY(-1px);
}

/* ═══ SPOTS LIST ═══ */
.spots-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }

.spot-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  transition: all 0.2s;
}

.spot-card:hover { border-color: var(--blue); transform: translateX(4px); }

.spot-icon {
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 18px;
  flex-shrink: 0;
}

.spot-icon.excellent { background: rgba(34,197,94,0.15); }
.spot-icon.good { background: rgba(59,130,246,0.15); }
.spot-icon.moderate { background: rgba(249,115,22,0.15); }

.spot-info { flex: 1; }
.spot-name { font-size: 14px; font-weight: 600; }
.spot-meta { font-size: 11px; color: var(--text3); margin-top: 2px; }
.spot-density { font-size: 12px; font-weight: 600; color: var(--green); }

/* ═══ WARNINGS ═══ */
.warnings-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }

.warning-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.15);
  border-radius: var(--r);
  border-left: 3px solid var(--red);
}

.warning-icon { font-size: 18px; flex-shrink: 0; }
.warning-text { flex: 1; }
.warning-title { font-size: 13px; font-weight: 600; color: var(--red); }
.warning-desc { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* ═══ LEADERBOARD ═══ */
.leaderboard { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }

.leader-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--rs);
}

.leader-rank {
  width: 28px; height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.leader-rank.gold { background: linear-gradient(135deg, #f59e0b, #d97706); color: white; }
.leader-rank.silver { background: linear-gradient(135deg, #94a3b8, #64748b); color: white; }
.leader-rank.bronze { background: linear-gradient(135deg, #b45309, #92400e); color: white; }
.leader-rank.default { background: var(--bg4); color: var(--text3); }

.leader-name { flex: 1; font-size: 13px; font-weight: 500; }
.leader-credits { font-size: 13px; font-weight: 700; color: var(--blue2); }

/* ═══ MAP ═══ */
.map-container { position: relative; height: calc(100vh - var(--header-h) - var(--nav-h) - 32px); border-radius: var(--r); overflow: hidden; }

#map-canvas { width: 100%; height: 100%; background: #0a1628; display: block; }

.map-legend {
  position: absolute;
  top: 12px; right: 12px;
  background: rgba(15,23,41,0.9);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.legend-item { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text2); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.legend-dot.excellent { background: var(--green); }
.legend-dot.good { background: var(--blue); }
.legend-dot.moderate { background: var(--orange); }
.legend-dot.restricted { background: var(--red); }

.map-info-card {
  position: absolute;
  bottom: 16px; left: 16px; right: 16px;
  background: rgba(15,23,41,0.95);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  backdrop-filter: blur(10px);
}

.map-info-card h4 { font-size: 15px; margin-bottom: 8px; }
.map-info-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--text2); padding: 4px 0; }

/* ═══ RECYCLE ═══ */
.recycle-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, rgba(59,130,246,0.12), rgba(20,184,166,0.08));
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--r);
  padding: 20px;
  margin-bottom: 20px;
}

.credit-amount { display: block; font-size: 36px; font-weight: 800; color: var(--blue2); }
.credit-label { font-size: 12px; color: var(--text3); }

.credit-ring { position: relative; width: 80px; height: 80px; }
.ring-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--blue2); }

.return-form {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 20px;
}

.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 12px; font-weight: 500; color: var(--text2); margin-bottom: 4px; }
.form-group input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  color: var(--text);
  font-size: 14px;
  outline: none;
  font-family: 'Inter', sans-serif;
}

.form-group input:focus { border-color: var(--blue); }

.return-result {
  margin-top: 12px;
  padding: 12px;
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.2);
  border-radius: var(--rs);
  font-size: 13px;
  color: var(--green);
  text-align: center;
}

/* Tiers */
.tier-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 20px; }

.tier-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--rs);
}

.tier-card.active { border-color: var(--blue); background: rgba(59,130,246,0.06); }

.tier-icon {
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 800;
  color: white;
}

.tier-icon.bronze { background: linear-gradient(135deg, #b45309, #92400e); }
.tier-icon.silver { background: linear-gradient(135deg, #94a3b8, #64748b); }
.tier-icon.gold { background: linear-gradient(135deg, #f59e0b, #d97706); }
.tier-icon.platinum { background: linear-gradient(135deg, var(--blue), var(--teal)); }

.tier-info strong { font-size: 13px; display: block; }
.tier-info p { font-size: 11px; color: var(--text3); margin-top: 2px; }

.history-list { display: flex; flex-direction: column; gap: 6px; }

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  font-size: 13px;
}

/* ═══ AI CHAT ═══ */
.ai-hero { text-align: center; padding: 16px 0; }
.ai-hero h3 { font-size: 18px; margin: 8px 0 2px; }
.ai-hero p { font-size: 12px; color: var(--text3); }

.ai-chat {
  height: 300px;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 10px;
}

.chat-msg {
  display: flex;
  gap: 8px;
  padding: 8px;
  animation: fadeIn 0.2s ease;
}

.chat-av {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
}

.chat-msg.bot .chat-av { background: var(--blue); color: white; }
.chat-msg.user .chat-av { background: var(--teal); color: white; }

.chat-bbl { font-size: 13px; line-height: 1.5; color: var(--text2); max-width: 85%; }

.ai-input-row { display: flex; gap: 8px; margin-bottom: 10px; }
.ai-input-row input {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  color: var(--text);
  font-size: 13px;
  outline: none;
  font-family: 'Inter', sans-serif;
}

.ai-input-row input:focus { border-color: var(--blue); }

.quick-prompts { display: flex; flex-wrap: wrap; gap: 6px; }

.prompt-chip {
  padding: 6px 12px;
  background: rgba(59,130,246,0.08);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--blue2);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}

.prompt-chip:hover { background: rgba(59,130,246,0.15); border-color: var(--blue); }

/* Catch Upload */
.catch-upload { margin-bottom: 16px; }

.upload-box {
  border: 2px dashed var(--border2);
  border-radius: var(--r);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text3);
  font-size: 13px;
  transition: all 0.2s;
}

.upload-box:hover { border-color: var(--blue); }

#catch-img-preview { max-width: 100%; max-height: 200px; border-radius: var(--r); margin-bottom: 8px; }

.ai-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  font-size: 13px;
  color: var(--text2);
}

.spinner-sm { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--blue); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══ ALERTS ═══ */
.alerts-list { display: flex; flex-direction: column; gap: 8px; }

.alert-card {
  padding: 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  border-left: 3px solid var(--orange);
}

.alert-card.danger { border-left-color: var(--red); }
.alert-card.info { border-left-color: var(--blue); }

.alert-title { font-size: 13px; font-weight: 600; }
.alert-msg { font-size: 12px; color: var(--text3); margin-top: 4px; }
.alert-meta { display: flex; gap: 8px; margin-top: 6px; }
.alert-tag { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 10px; text-transform: uppercase; }
.alert-tag.danger { background: rgba(239,68,68,0.12); color: var(--red); }
.alert-tag.warning { background: rgba(249,115,22,0.12); color: var(--orange); }
.alert-tag.info { background: rgba(59,130,246,0.12); color: var(--blue2); }

.illegal-zones { display: flex; flex-direction: column; gap: 8px; }

.illegal-zone-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(239,68,68,0.04);
  border: 1px solid rgba(239,68,68,0.12);
  border-radius: var(--r);
}

.zone-icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(239,68,68,0.12); color: var(--red); font-size: 16px; flex-shrink: 0; }
.zone-info { flex: 1; }
.zone-name { font-size: 13px; font-weight: 600; }
.zone-reason { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* ═══ BUTTONS ═══ */
.btn {
  padding: 10px 16px;
  border-radius: var(--rs);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}

.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: var(--blue3); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ═══ RESPONSIVE ═══ */
@media (min-width: 768px) {
  #app { max-width: 480px; margin: 0 auto; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}
