/* ═══════════════════════════════════════════════════════════
   ESCATA — Styles
   Design: Mediterranean Blue | Mobile-first
═══════════════════════════════════════════════════════════ */

/* ─── Tokens ─── */
:root {
  --blue-900: #03045E;
  --blue-800: #023E8A;
  --blue-600: #0077B6;
  --blue-400: #0096C7;
  --blue-200: #00B4D8;
  --blue-100: #90E0EF;
  --blue-50:  #CAF0F8;
  --blue-bg:  #F0F8FF;

  --green:    #2DC653;
  --red:      #D62828;
  --orange:   #F77F00;
  --amber:    #FCBF49;
  --text:     #1a1a2e;
  --text-2:   #4a4a6a;
  --text-3:   #8888aa;
  --surface:  #ffffff;
  --border:   #dde5f0;

  --radius-sm:  8px;
  --radius:     14px;
  --radius-lg:  22px;
  --shadow:     0 2px 16px rgba(0,100,180,0.10);
  --shadow-lg:  0 8px 32px rgba(0,100,180,0.18);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--blue-bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ─── Splash Screen ─── */
.splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(160deg, #023E8A 0%, #0077B6 60%, #00B4D8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.splash.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: splashIn 0.5s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes splashIn {
  from { transform: scale(0.7) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0);      opacity: 1; }
}
.splash-logo-wrap {
  width: 100px;
  height: 100px;
  background: rgba(255,255,255,0.12);
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25), 0 0 0 2px rgba(255,255,255,0.15);
  margin-bottom: 4px;
}
.splash-logo { width: 72px; height: 72px; }
.splash-name {
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}
.splash-tagline {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.75);
  letter-spacing: 0.01em;
}
.splash-dots {
  display: flex;
  gap: 7px;
  margin-top: 20px;
}
.splash-dots span {
  width: 7px; height: 7px;
  background: rgba(255,255,255,0.5);
  border-radius: 50%;
  animation: dotPulse 1.4s ease-in-out infinite;
}
.splash-dots span:nth-child(2) { animation-delay: 0.2s; }
.splash-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotPulse {
  0%,80%,100% { transform: scale(0.6); opacity: 0.4; }
  40%         { transform: scale(1);   opacity: 1; }
}

/* ─── Install Banner ─── */
.install-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 500;
  padding: 0 0 env(safe-area-inset-bottom, 0);
  animation: bannerUp 0.35s cubic-bezier(0.34,1.2,0.64,1) both;
}
.install-banner[hidden] { display: none; }
@keyframes bannerUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.install-banner-inner {
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 24px rgba(0,60,140,0.12);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.install-banner-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  flex-shrink: 0;
}
.install-banner-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.install-banner-text strong {
  font-size: 0.95rem;
  color: var(--text);
}
.install-banner-text span {
  font-size: 0.78rem;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.install-btn-accept {
  flex-shrink: 0;
  background: var(--blue-600);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 20px;
  cursor: pointer;
  border: none;
  transition: background 0.15s;
}
.install-btn-accept:hover { background: var(--blue-800); }
.install-btn-close {
  flex-shrink: 0;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  border-radius: 50%;
  transition: background 0.15s;
}
.install-btn-close:hover { background: var(--blue-bg); }
.install-btn-close svg { width: 16px; height: 16px; }

/* ─── Header ─── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--blue-600);
  padding-top: calc(var(--safe-top) + 0px);
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  max-width: 640px;
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { border-radius: 10px; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; }
.brand-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}
.brand-sub {
  font-size: 0.68rem;
  color: var(--blue-100);
  letter-spacing: 0.3px;
}
.info-btn {
  color: var(--blue-100);
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  transition: background 0.15s;
}
.info-btn:hover { background: rgba(255,255,255,0.12); }
.info-btn svg { width: 22px; height: 22px; }

/* ─── Main ─── */
main {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px calc(var(--safe-bottom) + 32px);
}

/* ─── Search section ─── */
.search-section { }
.search-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--blue-800);
  margin-bottom: 14px;
  text-align: center;
}

/* Search bar */
.search-bar-wrap { position: relative; }
.search-bar {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0 14px;
  gap: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-bar:focus-within {
  border-color: var(--blue-400);
  box-shadow: 0 0 0 3px rgba(0,150,199,0.15);
}
.search-icon { width: 20px; height: 20px; color: var(--text-3); flex-shrink: 0; }
.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  padding: 14px 0;
  font-size: 1rem;
  color: var(--text);
  background: transparent;
}
.search-bar input::placeholder { color: var(--text-3); }
.clear-btn {
  width: 28px; height: 28px;
  color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
}
.clear-btn:hover { background: var(--border); color: var(--text); }
.clear-btn svg { width: 16px; height: 16px; }

/* Divider */
.divider {
  display: flex; align-items: center;
  gap: 10px;
  margin: 18px 0;
  color: var(--text-3);
  font-size: 0.85rem;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Upload area */
.upload-area {
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.upload-area:hover, .upload-area:focus {
  border-color: var(--blue-400);
  background: rgba(0,150,199,0.04);
  outline: none;
}
.upload-area.drag-over {
  border-color: var(--blue-600);
  background: var(--blue-50);
}
.upload-content {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; padding: 20px 16px; text-align: center; width: 100%;
}
.upload-buttons {
  display: flex; align-items: stretch;
  width: 100%; gap: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1.5px solid var(--border);
}
.upload-btn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px;
  padding: 16px 12px;
  font-size: 0.85rem; font-weight: 600;
  color: var(--blue-800);
  background: var(--blue-bg);
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}
.upload-btn:hover, .upload-btn:focus {
  background: var(--blue-50);
  color: var(--blue-600);
  outline: none;
}
.upload-btn svg { width: 28px; height: 28px; }
.upload-sep {
  width: 1px;
  background: var(--border);
  flex-shrink: 0;
}
.upload-hint { font-size: 0.75rem; color: var(--text-3); }

.upload-preview { position: relative; width: 100%; }
.upload-preview img {
  width: 100%; max-height: 240px;
  object-fit: cover;
  border-radius: var(--radius);
}
.identifying-overlay {
  position: absolute; inset: 0;
  background: rgba(2,62,138,0.6);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px; color: #fff;
  font-size: 0.9rem; font-weight: 600;
  border-radius: var(--radius);
}

/* Espai publicitari */
.ad-container { margin: 20px 0 4px; }

.ad-placeholder {
  border: 2px dashed var(--blue-100);
  border-radius: var(--radius);
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(144, 224, 239, 0.06);
}
.ad-placeholder-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  pointer-events: none;
  user-select: none;
}

.ad-slideshow {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--border);
}
.ad-slides-track {
  display: flex;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.ad-slide { flex-shrink: 0; width: 100%; }
.ad-slide a { display: block; }
.ad-slide img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}
.ad-dots {
  position: absolute;
  bottom: 7px;
  left: 0; right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
}
.ad-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  padding: 0;
  transition: background 0.2s, transform 0.2s;
  pointer-events: all;
}
.ad-dot.active {
  background: #fff;
  transform: scale(1.3);
}

/* Spinner */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Results section ─── */
.results-section { animation: fadeUp 0.25s ease; }
.results-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.results-header h2 { font-size: 1rem; font-weight: 600; color: var(--text-2); }
.back-btn {
  display: flex; align-items: center; gap: 4px;
  font-size: 0.85rem; color: var(--blue-600);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.back-btn:hover { background: rgba(0,119,182,0.08); }
.back-btn svg { width: 18px; height: 18px; }

/* Species card (in list) */
.species-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--border);
}
.species-card:hover, .species-card:focus {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  outline: none;
}
.card-status-bar {
  width: 6px;
  flex-shrink: 0;
}
.card-status-bar.open     { background: var(--green); }
.card-status-bar.closed   { background: var(--red); }
.card-status-bar.banned   { background: var(--text-3); }
.card-status-bar.spawning { background: #f59e0b; }

.card-body {
  flex: 1;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.card-names { flex: 1; min-width: 0; }
.card-catalan  { font-size: 1rem; font-weight: 700; color: var(--text); }
.card-scientific {
  font-size: 0.78rem;
  color: var(--text-3);
  font-style: italic;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-spanish  { font-size: 0.8rem; color: var(--text-2); }
.card-meta {
  flex-shrink: 0;
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
}
.status-badge {
  font-size: 0.7rem; font-weight: 700;
  padding: 3px 8px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.status-badge.open     { background: #e8f8ee; color: #1a7a3a; }
.status-badge.closed   { background: #fde8e8; color: #9b1c1c; }
.status-badge.banned   { background: #f0f0f0; color: #555; }
.status-badge.spawning { background: #fff7e6; color: #b45309; }

.card-limit {
  font-size: 0.75rem;
  color: var(--text-3);
}

.card-inat-score {
  font-size: 0.7rem;
  color: var(--blue-400);
  font-weight: 700;
}
.card-chevron {
  color: var(--text-3); width: 18px; height: 18px; flex-shrink: 0;
}

/* ─── Detail section ─── */
.detail-section { animation: fadeUp 0.25s ease; }

.detail-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1.5px solid var(--border);
  margin-top: 12px;
}

/* Status banner */
.detail-banner {
  padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.detail-banner.open        { background: linear-gradient(135deg, #2DC653, #1fa83e); }
.detail-banner.closed      { background: linear-gradient(135deg, #D62828, #a01e1e); }
.detail-banner.banned      { background: linear-gradient(135deg, #555, #333); }
.detail-banner.spawning    { background: linear-gradient(135deg, #f59e0b, #d97706); }
.detail-banner.unregulated { background: linear-gradient(135deg, #0096C7, #0077B6); }
.banner-status {
  font-size: 1rem; font-weight: 800; color: #fff;
  text-transform: uppercase; letter-spacing: 1px;
}
.banner-sub { font-size: 0.78rem; color: rgba(255,255,255,0.8); }

/* Header de noms */
.detail-names {
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.detail-catalan  { font-size: 1.5rem; font-weight: 800; color: var(--blue-800); }
.detail-scientific {
  font-size: 0.95rem; font-style: italic; color: var(--text-3);
  margin-top: 2px;
}
.detail-taxonomy { font-size: 0.78rem; color: var(--text-3); margin-top: 3px; letter-spacing: 0.02em; text-transform: uppercase; }
.detail-spanish  { font-size: 0.88rem; color: var(--text-2); margin-top: 4px; }

/* Dades regulació */
.detail-regs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}
.reg-cell {
  background: var(--surface);
  padding: 14px 18px;
  display: flex; flex-direction: column; gap: 2px;
}
.reg-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-3); }
.reg-value { font-size: 1.25rem; font-weight: 800; color: var(--blue-800); }
.reg-unit  { font-size: 0.72rem; color: var(--text-3); }

/* Calendari veda */
.veda-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.veda-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-3);
  margin-bottom: 10px;
}
.veda-calendar {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 3px;
}
.month-cell {
  aspect-ratio: 1;
  border-radius: 5px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  transition: transform 0.1s;
}
.month-cell.open          { background: #e8f8ee; color: #1a7a3a; }
.month-cell.closed        { background: #fde8e8; color: #9b1c1c; }
.month-cell.partial-early { background: #fde8e8; color: #9b1c1c; }
.month-cell.partial-late  { background: #fef3e8; color: #92400e; }
.month-cell.current { outline: 2.5px solid var(--blue-600); outline-offset: 1px; }
.month-cell .month-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  margin-top: 1px;
}
.month-cell.open          .month-dot { background: #2DC653; }
.month-cell.closed        .month-dot { background: var(--red); }
.month-cell.partial-early .month-dot { background: linear-gradient(to right, var(--red) 50%, #2DC653 50%); }
.month-cell.partial-late  .month-dot { background: linear-gradient(to right, #2DC653 50%, var(--red) 50%); }
.veda-legend {
  display: flex; gap: 14px; margin-top: 10px;
  font-size: 0.72rem; color: var(--text-3);
}
.legend-dot {
  display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  margin-right: 4px; vertical-align: middle;
}

/* Wikipedia section */
.wiki-section {
  padding: 16px 20px;
}
.wiki-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
}
.wiki-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-3);
}
.wiki-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.wiki-extract {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-2);
}
.wiki-link {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--blue-600);
  text-decoration: none;
  font-weight: 600;
}
.wiki-link:hover { text-decoration: underline; }
.wiki-loading, .wiki-error {
  font-size: 0.85rem;
  color: var(--text-3);
  font-style: italic;
}

/* Espècie no regulada */
.unregulated-note {
  margin: 14px 20px;
  padding: 12px 14px;
  background: #e8f4fd;
  border-left: 4px solid var(--blue-400);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.84rem;
  color: var(--blue-800);
  line-height: 1.55;
}

/* Nota legal */
.detail-legal {
  padding: 10px 20px 16px;
  font-size: 0.72rem;
  color: var(--text-3);
  line-height: 1.5;
  border-top: 1px solid var(--border);
}
.legal-support-link {
  color: var(--text-3);
  text-decoration: underline;
}
.legal-support-link:hover { color: var(--blue-600); }

/* ─── Modal ─── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(2,62,138,0.55);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex; align-items: flex-end;
  padding: 0;
  animation: fadeIn 0.2s ease;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 24px 20px calc(var(--safe-bottom) + 24px);
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  position: relative;
  max-height: 80dvh;
  overflow-y: auto;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.2);
  animation: slideUp 0.25s ease;
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px;
  color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  transition: background 0.15s;
}
.modal-close:hover { background: var(--border); }
.modal-close svg { width: 18px; height: 18px; }
.modal-box h2 { font-size: 1.2rem; margin-bottom: 12px; color: var(--blue-800); }
.modal-box p  { font-size: 0.88rem; color: var(--text-2); margin-bottom: 10px; line-height: 1.6; }
.modal-box ul { margin: 0 0 10px 20px; }
.modal-box li { font-size: 0.88rem; color: var(--text-2); margin-bottom: 4px; line-height: 1.5; }
.modal-disclaimer {
  background: #fff9e6; border-left: 4px solid var(--amber);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 12px;
  font-size: 0.82rem !important;
  color: #5a4000 !important;
}
.modal-link {
  display: inline-block; margin-top: 10px;
  font-size: 0.85rem; color: var(--blue-600);
  text-decoration: none; font-weight: 600;
}
.modal-link:hover { text-decoration: underline; }

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 24px);
  left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--text);
  color: #fff;
  padding: 10px 20px;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  max-width: 90vw;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast.error { background: var(--red); }

/* ─── Animacions ─── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideUp {
  from { transform: translateY(60px); }
  to   { transform: translateY(0); }
}

/* ─── Empty / loading states ─── */
.empty-state {
  text-align: center; padding: 32px 16px;
  color: var(--text-3);
  font-size: 0.9rem;
}
.empty-state svg {
  width: 48px; height: 48px;
  margin: 0 auto 12px;
  opacity: 0.3;
}

/* ─── Prohibited banner ─── */
.prohibited-banner {
  background: #fff0f0;
  border: 1.5px solid #fcc;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 16px 20px;
  font-size: 0.88rem;
  color: var(--red);
  font-weight: 600;
  text-align: center;
}

/* ─── Desktop tweak ─── */
@media (min-width: 640px) {
  .modal-box  { border-radius: var(--radius-lg); margin: auto; }
  .modal-overlay { align-items: center; }
  .veda-calendar { gap: 5px; }
  .month-cell { font-size: 0.7rem; border-radius: 8px; }
}

/* ─── Header actions ─── */
.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.header-icon-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.85);
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.header-icon-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }
.header-icon-btn svg  { width: 20px; height: 20px; }
.header-icon-btn .user-avatar {
  width: 28px; height: 28px;
  background: rgba(255,255,255,0.22);
  border: 2px solid rgba(255,255,255,0.55);
  border-radius: 50%;
  font-size: 0.85rem; font-weight: 700;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
}

/* ─── Perfil ─── */
.profile-section { padding-bottom: 40px; }
.profile-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 16px 20px;
}
.profile-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-600), var(--blue-400));
  color: #fff;
  font-size: 2rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,100,180,0.25);
}
.profile-email {
  font-size: 0.88rem;
  color: var(--text-3);
}
.profile-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 16px;
}
.profile-section-divider {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.auth-success {
  background: #e8fce8;
  border: 1px solid #a3d9a5;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 0.85rem;
  color: #1a7a1a;
}
.profile-danger-zone {
  margin: 28px 16px 0;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.profile-logout-btn {
  display: block;
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--red);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  transition: background 0.15s;
}
.profile-logout-btn:hover { background: #b91c1c; }
.profile-delete-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--red);
  background: transparent;
  color: var(--red);
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  transition: background 0.15s, color 0.15s;
}
.profile-delete-btn:hover { background: var(--red); color: #fff; }

.profile-support {
  margin: 12px 16px 24px;
  padding: 14px 16px;
  background: var(--blue-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.profile-support-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
  margin-bottom: 8px;
}
.profile-support-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--blue-600);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}
.profile-support-link:hover { text-decoration: underline; }
.profile-support-link svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ─── Auth modal ─── */
.auth-modal-box { max-width: 360px; width: 100%; }
.auth-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.auth-tab {
  flex: 1;
  padding: 10px 8px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-3);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.auth-tab.active { color: var(--blue-600); border-bottom-color: var(--blue-600); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
}
.auth-field input {
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s;
  outline: none;
}
.auth-field input:focus { border-color: var(--blue-400); }
.auth-error {
  background: #fff0f0;
  border: 1px solid #f5c6c6;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 0.85rem;
  color: var(--red);
}
.auth-submit {
  background: var(--blue-600);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 12px;
  border-radius: var(--radius-sm);
  margin-top: 4px;
  transition: background 0.15s;
}
.auth-submit:hover { background: var(--blue-800); }
.auth-submit:disabled { opacity: 0.6; cursor: default; }

/* ─── Add-catch modal ─── */
.catch-modal-box { max-width: 400px; width: 100%; }
.catch-modal-box h2 { font-size: 1.1rem; margin-bottom: 4px; }
.catch-modal-species {
  font-size: 0.85rem;
  color: var(--text-2);
  margin-bottom: 18px;
  font-style: italic;
}
.catch-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.catch-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 12px;
}
.catch-field:last-child { margin-bottom: 0; }
.catch-field span { display: block; }
.catch-field input,
.catch-field textarea {
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.92rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s;
  outline: none;
  width: 100%;
}
.catch-field input:focus,
.catch-field textarea:focus { border-color: var(--blue-400); }
.catch-field small { font-size: 0.75rem; color: var(--orange); font-weight: 500; }
.catch-field textarea { resize: vertical; min-height: 60px; }
.catch-photo-field {
  margin-bottom: 14px;
}
.catch-photo-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 7px;
}
.catch-photo-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.88rem;
  font-weight: 500;
  transition: border-color 0.12s, color 0.12s;
  width: 100%;
  justify-content: center;
}
.catch-photo-btn:hover { border-color: var(--blue-400); color: var(--blue-600); }
.catch-photo-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.catch-photo-preview {
  position: relative;
  display: inline-block;
  margin-bottom: 8px;
}
.catch-photo-preview img {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  display: block;
}
.catch-photo-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0,0,0,.55);
  color: #fff;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.catch-photo-remove svg { width: 14px; height: 14px; }

.catch-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}
.catch-btn-cancel {
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  background: var(--red);
  border: none;
  transition: background 0.12s;
}
.catch-btn-cancel:hover { background: #b91c1c; }
.catch-btn-submit {
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  background: var(--blue-600);
  color: #fff;
  transition: background 0.15s;
}
.catch-btn-submit:hover { background: var(--blue-800); }
.catch-btn-submit:disabled { opacity: 0.6; cursor: default; }

/* ─── "Registra captura" button (dins el detall) ─── */
.add-catch-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 32px);
  margin: 16px auto 0;
  padding: 12px;
  background: var(--blue-600);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.add-catch-btn:hover { background: var(--blue-800); }
.add-catch-btn svg { width: 18px; height: 18px; }

/* ─── Comptador captures d'avui (dins el detall) ─── */
.today-catch-counter {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--blue-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  width: calc(100% - 32px);
  margin: 8px auto 0;
  font-size: 0.88rem;
  color: var(--text-2);
}
.today-catch-counter.at-limit {
  background: #fff8e1;
  border-color: var(--amber);
  color: #7a5c00;
}
.today-catch-counter strong { color: var(--text); }

/* ─── Diary section ─── */
.diary-section { padding-bottom: 40px; }
.diary-summary { padding: 0 16px 4px; }
.diary-summary-card {
  background: linear-gradient(135deg, var(--blue-800), var(--blue-600));
  color: #fff;
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}
.diary-summary-card strong { font-size: 1rem; }
.diary-day-group { margin-bottom: 8px; }
.diary-day-header {
  padding: 8px 16px 4px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.catch-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 13px 16px;
  transition: background 0.12s;
}
.catch-card:first-of-type { border-top: 1px solid var(--border); }
.catch-card-body { flex: 1; min-width: 0; }
.catch-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}
.catch-card-details {
  font-size: 0.8rem;
  color: var(--text-3);
  margin-top: 2px;
}
.catch-card-notes {
  font-size: 0.8rem;
  color: var(--text-2);
  margin-top: 3px;
  font-style: italic;
}
.catch-limit-warn {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #7a5c00;
  background: #fff8e1;
  border-radius: 4px;
  padding: 2px 7px;
}
.catch-delete-btn {
  flex-shrink: 0;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  border-radius: 50%;
  transition: background 0.12s, color 0.12s;
}
.catch-delete-btn:hover { background: #fff0f0; color: var(--red); }
.catch-delete-btn svg { width: 16px; height: 16px; }

.catch-thumb-btn {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid var(--border);
}
.catch-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.15s;
}
.catch-thumb-btn:hover .catch-thumb { opacity: 0.85; }

/* ─── Lightbox ─── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  cursor: zoom-out;
}
.lightbox img {
  max-width: 100%;
  max-height: calc(100vh - 60px);
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
}
.lightbox-hint {
  margin-top: 14px;
  font-size: 0.78rem;
  color: rgba(255,255,255,.45);
  letter-spacing: .03em;
}

/* ─── Calendari de reproducció ─── */
.month-cell.repro {
  background: #fff3cd;
  color: #92400e;
}
.month-cell.repro .month-dot { background: #f59e0b; }

.month-cell.repro-peak {
  background: #fee2e2;
  color: #991b1b;
}
.month-cell.repro-peak .month-dot { background: #dc2626; }

.month-cell.neutral {
  background: var(--surface);
  color: var(--text-3);
}
.month-cell.neutral .month-dot { background: var(--border); }

/* ─── Hàbitat i profunditat ─── */
.habitat-section {
  padding: 16px 16px 4px;
  border-top: 1px solid var(--border);
}
.habitat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}
.habitat-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--blue-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 11px;
  font-size: 0.82rem;
  color: var(--text-2);
}
.habitat-chip--depth {
  background: #e8f0fe;
  border-color: #c3d3f5;
  color: var(--blue-800);
  font-weight: 600;
}

/* ─── Vulnerabilitat ─── */
.vuln-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.vuln-dot-inline {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}
.vuln-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  padding: 3px 10px 3px 8px;
  border-radius: 20px;
  border: 1px solid;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: .01em;
}
.vuln-badge--dot-only {
  border-color: var(--border) !important;
  background: var(--surface) !important;
}

