/* ═══════ FishMap CSS — Ocean Blue Theme ═══════ */
:root {
  --fish-primary: #1E40AF;
  --fish-primary-dark: #1E3A8A;
  --fish-accent: #3B82F6;
  --fish-accent-light: #60A5FA;
  --fish-light: #DBEAFE;
  --fish-surface: #ffffff;
  --fish-surface-alt: #F8FAFC;
  --fish-text: #0F172A;
  --fish-text-secondary: #64748B;
  --fish-text-muted: #94A3B8;
  --fish-border: #E2E8F0;
  --fish-success: #059669;
  --fish-warning: #D97706;
  --fish-danger: #DC2626;
  --fish-radius: 16px;
  --fish-radius-sm: 10px;
  --fish-header-h: 56px;
  --fish-search-h: 96px;
  --fish-shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  --fish-shadow-lg: 0 8px 40px rgba(15, 23, 42, 0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--fish-text);
  background: var(--fish-surface-alt);
  -webkit-font-smoothing: antialiased;
}

/* ═══════ SPLASH ═══════ */
.splash {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(135deg, #1E40AF 0%, #1E3A8A 50%, #0F172A 100%);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.splash.hidden { opacity: 0; pointer-events: none; transform: scale(1.05); }
.splash-content { text-align: center; color: white; }
.splash-icon { font-size: 72px; animation: float 2s ease-in-out infinite; }
.splash-title { font-size: 42px; font-weight: 800; margin: 8px 0; letter-spacing: -1px; }
.splash-sub { font-size: 18px; font-weight: 500; opacity: 0.85; margin-bottom: 24px; }
.splash-status { font-size: 13px; opacity: 0.6; margin-top: 16px; }
.splash-loader { width: 120px; height: 4px; background: rgba(255,255,255,0.15); border-radius: 2px; margin: 0 auto; overflow: hidden; }
.splash-wave { width: 50%; height: 100%; background: rgba(255,255,255,0.6); border-radius: 2px; animation: wave 1.5s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes wave { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }

/* ═══════ HEADER ═══════ */
.header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--fish-header-h);
  background: var(--fish-primary);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; z-index: 1000;
  box-shadow: 0 2px 12px rgba(30,64,175,0.3);
}
.header-left { display: flex; align-items: center; gap: 8px; }
.header-icon { font-size: 24px; }
.header-title { font-size: 20px; font-weight: 800; color: white; letter-spacing: -0.5px; }
.header-badge {
  background: rgba(255,255,255,0.2); color: white;
  font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 12px;
}
.header-right { display: flex; align-items: center; gap: 6px; }
.btn-icon {
  width: 38px; height: 38px; border: none; border-radius: 12px;
  background: rgba(255,255,255,0.15);
  color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.btn-icon:hover { background: rgba(255,255,255,0.25); }
.btn-locate { background: rgba(255,255,255,0.25); }

/* ═══════ SEARCH ═══════ */
.search-container {
  position: fixed;
  top: var(--fish-header-h);
  left: 0; right: 0;
  padding: 8px 12px;
  z-index: 999;
  background: linear-gradient(to bottom, var(--fish-surface) 70%, transparent);
}
.search-box {
  display: flex; align-items: center;
  background: var(--fish-surface);
  border: 1.5px solid var(--fish-border);
  border-radius: var(--fish-radius-sm);
  padding: 0 12px; height: 42px;
  box-shadow: var(--fish-shadow);
  transition: border-color 0.2s;
}
.search-box:focus-within { border-color: var(--fish-accent); }
.search-icon { color: var(--fish-text-muted); flex-shrink: 0; }
.search-box input {
  flex: 1; border: none; outline: none; background: none;
  font-size: 14px; font-family: inherit; color: var(--fish-text);
  padding: 0 8px;
}
.search-box input::placeholder { color: var(--fish-text-muted); }
.search-clear {
  border: none; background: none; color: var(--fish-text-muted);
  cursor: pointer; font-size: 16px; padding: 4px;
  display: none;
}
.search-clear.visible { display: block; }

.filter-chips {
  display: flex; gap: 6px; margin-top: 8px;
  overflow-x: auto; scrollbar-width: none;
  -ms-overflow-style: none; padding-bottom: 2px;
}
.filter-chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 6px 12px; border-radius: 20px;
  border: 1.5px solid var(--fish-border);
  background: var(--fish-surface);
  color: var(--fish-text-secondary);
  font-size: 12px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: all 0.2s;
  white-space: nowrap;
}
.chip:hover { border-color: var(--fish-accent); color: var(--fish-accent); }
.chip.active {
  background: var(--fish-primary);
  border-color: var(--fish-primary);
  color: white;
}

/* ═══════ MAP ═══════ */
#map {
  position: fixed;
  top: var(--fish-header-h);
  left: 0; right: 0; bottom: 0;
  z-index: 1;
}

/* Map markers */
.marker-spot {
  background: var(--fish-primary);
  color: white;
  border-radius: 50%;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  box-shadow: 0 2px 8px rgba(30,64,175,0.4);
  border: 2px solid white;
  transition: transform 0.15s;
}
.marker-spot:hover { transform: scale(1.15); }
.marker-spot.embalse { background: #0369A1; }
.marker-spot.rio { background: #0891B2; }
.marker-spot.costa { background: #1E40AF; }
.marker-spot.puerto { background: #6D28D9; }
.marker-spot.playa { background: #059669; }
.marker-spot.escollera { background: #7C3AED; }

.marker-shop {
  background: #D97706;
  color: white;
  border-radius: 50%;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  box-shadow: 0 2px 6px rgba(217,119,6,0.4);
  border: 2px solid white;
}
.marker-shop.partner {
  background: #059669;
  box-shadow: 0 2px 6px rgba(5,150,105,0.4), 0 0 0 3px rgba(5,150,105,0.2);
}

.marker-user {
  width: 16px; height: 16px;
  background: var(--fish-accent);
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(59,130,246,0.3), 0 2px 8px rgba(0,0,0,0.2);
}

/* ═══════ SCORE BAR ═══════ */
.score-bar {
  position: fixed;
  bottom: 200px; left: 12px; right: 12px;
  z-index: 800;
  pointer-events: none;
}
.score-bar-inner {
  background: var(--fish-surface);
  border-radius: var(--fish-radius-sm);
  padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--fish-shadow-lg);
  pointer-events: auto;
}
.score-label { font-size: 12px; font-weight: 600; color: var(--fish-text-secondary); white-space: nowrap; }
.score-value { font-size: 20px; font-weight: 800; color: var(--fish-primary); min-width: 32px; }
.score-gauge { flex: 1; height: 6px; background: var(--fish-border); border-radius: 3px; overflow: hidden; }
.score-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease, background 0.5s ease; }

/* ═══════ PANEL (bottom sheet) ═══════ */
.panel {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-height: 45vh;
  background: var(--fish-surface);
  border-radius: var(--fish-radius) var(--fish-radius) 0 0;
  box-shadow: 0 -4px 24px rgba(15,23,42,0.08);
  z-index: 900;
  transition: transform 0.3s ease;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.panel.collapsed { transform: translateY(calc(100% - 48px)); }
.panel-handle {
  width: 36px; height: 4px;
  background: var(--fish-border);
  border-radius: 2px;
  margin: 10px auto 6px;
  cursor: grab;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px 10px;
}
.panel-title { font-size: 15px; font-weight: 700; }
.panel-count {
  font-size: 12px; font-weight: 700;
  background: var(--fish-light);
  color: var(--fish-primary);
  padding: 2px 8px; border-radius: 10px;
}
.panel-list {
  overflow-y: auto; flex: 1;
  padding: 0 12px 16px;
  -webkit-overflow-scrolling: touch;
}

/* Spot card */
.spot-card {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px;
  background: var(--fish-surface);
  border: 1px solid var(--fish-border);
  border-radius: var(--fish-radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.spot-card:hover { border-color: var(--fish-accent); box-shadow: var(--fish-shadow); }
.spot-card-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--fish-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.spot-card-info { flex: 1; min-width: 0; }
.spot-card-name { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.spot-card-meta { font-size: 12px; color: var(--fish-text-secondary); }
.spot-card-tags { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.spot-tag {
  font-size: 10px; font-weight: 600;
  padding: 2px 6px; border-radius: 6px;
  background: var(--fish-surface-alt);
  color: var(--fish-text-secondary);
}
.spot-tag.no-kill { background: #DCFCE7; color: #166534; }
.spot-tag.coto { background: #FEF3C7; color: #92400E; }
.spot-tag.invasive { background: #FEE2E2; color: #991B1B; }
.spot-card-dist {
  font-size: 12px; font-weight: 700;
  color: var(--fish-primary);
  white-space: nowrap;
}
.spot-card-rating {
  font-size: 11px; color: var(--fish-warning);
  font-weight: 600;
}

/* ═══════ DETAIL OVERLAY ═══════ */
.detail-overlay, .species-overlay {
  position: fixed; inset: 0;
  background: var(--fish-surface);
  z-index: 2000;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.detail-overlay.open, .species-overlay.open { transform: translateX(0); }

.detail-header {
  position: sticky; top: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  background: var(--fish-primary);
  color: white;
  z-index: 10;
}
.btn-back {
  width: 36px; height: 36px;
  border: none; border-radius: 10px;
  background: rgba(255,255,255,0.15);
  color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.detail-title { font-size: 16px; font-weight: 700; flex: 1; }

.detail-body { padding: 16px; }

/* Detail sections */
.detail-section { margin-bottom: 20px; }
.detail-section-title {
  font-size: 13px; font-weight: 700; color: var(--fish-text-secondary);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.detail-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--fish-border);
}
.detail-row:last-child { border-bottom: none; }
.detail-label { font-size: 13px; color: var(--fish-text-secondary); }
.detail-value { font-size: 14px; font-weight: 600; }

.detail-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.detail-tag {
  font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 8px;
  background: var(--fish-light);
  color: var(--fish-primary);
}

.detail-species-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  border: 1px solid var(--fish-border);
  border-radius: var(--fish-radius-sm);
  margin-bottom: 6px;
}
.detail-species-icon { font-size: 24px; }
.detail-species-name { font-size: 14px; font-weight: 600; }
.detail-species-sci { font-size: 11px; color: var(--fish-text-muted); font-style: italic; }
.detail-species-abundance {
  margin-left: auto; font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 6px;
}
.abundance-muy_alta { background: #DCFCE7; color: #166534; }
.abundance-alta { background: #D1FAE5; color: #065F46; }
.abundance-media { background: #FEF3C7; color: #92400E; }
.abundance-baja { background: #FEE2E2; color: #991B1B; }

/* Catch card */
.catch-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  border: 1px solid var(--fish-border);
  border-radius: var(--fish-radius-sm);
  margin-bottom: 6px;
}
.catch-icon { font-size: 20px; }
.catch-info { flex: 1; }
.catch-species { font-size: 13px; font-weight: 600; }
.catch-detail { font-size: 11px; color: var(--fish-text-secondary); }
.catch-date { font-size: 11px; color: var(--fish-text-muted); }

/* Action buttons */
.detail-actions { display: flex; gap: 8px; margin-top: 16px; }
.btn-action {
  flex: 1; padding: 12px;
  border: none; border-radius: var(--fish-radius-sm);
  font-size: 14px; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-primary { background: var(--fish-primary); color: white; }
.btn-primary:hover { background: var(--fish-primary-dark); }
.btn-secondary { background: var(--fish-light); color: var(--fish-primary); }
.btn-secondary:hover { background: #BFDBFE; }

/* ═══════ SPECIES OVERLAY ═══════ */
.species-filters {
  padding: 12px 16px;
  display: flex; gap: 6px;
  overflow-x: auto;
  background: var(--fish-surface-alt);
}
.species-list { padding: 12px 16px; }
.species-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border: 1px solid var(--fish-border);
  border-radius: var(--fish-radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.species-card:hover { border-color: var(--fish-accent); }
.species-card-icon { font-size: 28px; }
.species-card-info { flex: 1; }
.species-card-name { font-size: 14px; font-weight: 700; }
.species-card-sci { font-size: 11px; color: var(--fish-text-muted); font-style: italic; }
.species-card-meta { font-size: 11px; color: var(--fish-text-secondary); margin-top: 2px; }
.species-card-badge {
  font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 6px;
}
.badge-invasive { background: #FEE2E2; color: #991B1B; }
.badge-dulce { background: #D1FAE5; color: #065F46; }
.badge-costa { background: #DBEAFE; color: #1E40AF; }

/* ═══════ SPECIES ZONE MARKERS ═══════ */
.marker-species-zone {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25));
  animation: zone-pop 0.3s ease-out;
}
@keyframes zone-pop { 0% { transform: scale(0); } 100% { transform: scale(1); } }

/* ═══════ SPECIES ZONE BAR ═══════ */
.species-zone-bar {
  position: fixed;
  top: calc(var(--fish-header-h) + 8px);
  left: 50%; transform: translateX(-50%);
  z-index: 1100;
  background: var(--fish-surface);
  border-radius: var(--fish-radius);
  padding: 8px 14px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--fish-shadow-lg);
  animation: slide-down 0.3s ease-out;
  max-width: 90vw;
}
@keyframes slide-down { 0% { opacity: 0; transform: translateX(-50%) translateY(-20px); } 100% { opacity: 1; transform: translateX(-50%) translateY(0); } }
.szb-info { display: flex; align-items: center; gap: 8px; }
.szb-icon { font-size: 22px; }
.szb-name { font-size: 14px; font-weight: 700; color: var(--fish-text); }
.szb-count {
  font-size: 11px; font-weight: 700;
  background: var(--fish-light); color: var(--fish-primary);
  padding: 2px 8px; border-radius: 10px;
}
.szb-close {
  width: 28px; height: 28px; border: none; border-radius: 8px;
  background: var(--fish-surface-alt);
  color: var(--fish-text-secondary);
  cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.szb-close:hover { background: var(--fish-border); }

/* ═══════ TOAST ═══════ */
.fish-toast {
  position: fixed;
  bottom: 80px; left: 50%; transform: translateX(-50%) translateY(20px);
  z-index: 9000;
  background: var(--fish-text);
  color: white;
  padding: 10px 20px;
  border-radius: var(--fish-radius-sm);
  font-size: 13px; font-weight: 600;
  box-shadow: var(--fish-shadow-lg);
  opacity: 0; transition: opacity 0.3s, transform 0.3s;
  pointer-events: none; white-space: nowrap;
  max-width: 90vw;
}
.fish-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ═══════ MAP ZONES BUTTON ═══════ */
.btn-map-zones {
  background: linear-gradient(135deg, var(--fish-primary), var(--fish-accent)) !important;
  color: white !important;
  font-size: 15px !important;
  padding: 14px !important;
  border-radius: var(--fish-radius-sm) !important;
  box-shadow: 0 4px 16px rgba(30,64,175,0.3);
  transition: box-shadow 0.2s, transform 0.2s;
}
.btn-map-zones:hover { box-shadow: 0 6px 24px rgba(30,64,175,0.4); transform: translateY(-1px); }

/* ═══════ MONTH TAGS ═══════ */
.month-tags { gap: 4px !important; }
.month-tag {
  background: #EFF6FF !important;
  color: var(--fish-primary) !important;
  font-size: 11px !important;
  padding: 3px 8px !important;
}

/* ═══════ SPOT CARD MINI ═══════ */
.spot-card-mini {
  padding: 10px !important;
  margin-bottom: 6px !important;
}
.spot-card-mini .spot-card-icon {
  width: 32px; height: 32px;
  font-size: 16px;
  border-radius: 8px;
}
.spot-card-mini .spot-card-name { font-size: 13px; }
.spot-card-mini .spot-card-meta { font-size: 11px; }

/* ═══════ SPECIES BADGES ═══════ */
.species-card-badges { display: flex; gap: 4px; flex-direction: column; align-items: flex-end; }

/* ═══════ FOOTER ═══════ */
.footer {
  position: fixed;
  bottom: 8px; left: 50%; transform: translateX(-50%);
  z-index: 500;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(8px);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 10px;
  color: var(--fish-text-muted);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.footer a { color: var(--fish-primary); text-decoration: none; }
.footer-sep { margin: 0 4px; }

/* ═══════ EMPTY STATE ═══════ */
.empty-state {
  text-align: center; padding: 32px 16px;
  color: var(--fish-text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 8px; }
.empty-state-text { font-size: 14px; font-weight: 500; }
.empty-state-sub { font-size: 12px; margin-top: 4px; }

/* ═══════ LOADING ═══════ */
.loading-spinner {
  text-align: center; padding: 24px;
}
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--fish-border);
  border-top-color: var(--fish-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════ RESPONSIVE ═══════ */
@media (min-width: 768px) {
  .panel {
    left: auto; right: 16px; bottom: 16px;
    width: 380px; max-height: 70vh;
    border-radius: var(--fish-radius);
  }
  .panel.collapsed { transform: translateY(calc(100% - 56px)); }
  .score-bar { left: auto; right: 412px; bottom: 16px; width: 280px; }
  .footer { bottom: 16px; }
  .detail-overlay, .species-overlay { left: auto; width: 420px; }
}

@media (min-width: 1024px) {
  .panel { width: 400px; }
  .detail-overlay, .species-overlay { width: 480px; }
}
