/* =============================================================================
   El Palmar Tide Timeline — tide-timeline.css
   ============================================================================= */

:root {
  --ep-bar:        #e5eef2;
  --ep-accent:     #10b981;
  --ep-badge-bg:   #123f52;
  --ep-text:       #6b8795;
  --ep-wave-line:  #1a6b8a;
  --ep-card-bg:    #ffffff;
  --ep-radius:     14px;
  --ep-font:       -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

/* ── Contenedor del widget ─────────────────────────────────────────────────── */

.ep-tide-widget {
  font-family: var(--ep-font);
  background:  var(--ep-card-bg);
  border-radius: var(--ep-radius);
  padding: 18px 20px 14px;
  box-shadow: 0 2px 16px rgba(18, 63, 82, 0.09), 0 0 0 1px rgba(18, 63, 82, 0.05);
  color: var(--ep-text);
  width: 100%;
  box-sizing: border-box;
}

/* ── Estado de carga ───────────────────────────────────────────────────────── */

.ep-tide-loading {
  text-align: center;
  padding: 28px 0;
  font-size: 13px;
  color: var(--ep-text);
  opacity: 0.65;
  letter-spacing: 0.02em;
}

/* ── Fallback / error ──────────────────────────────────────────────────────── */

.ep-tide-fallback {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px;
  background: #f4f8fa;
  border-radius: 10px;
  font-size: 13px;
  color: var(--ep-text);
}

.ep-tide-fallback-icon {
  width: 20px;
  height: 20px;
  fill: var(--ep-text);
  flex-shrink: 0;
  opacity: 0.6;
}

/* ── Cabecera / estado actual ──────────────────────────────────────────────── */

.ep-tide-header {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 6px;
}

.ep-tide-dot-live {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ep-accent);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22);
  flex-shrink: 0;
  animation: ep-pulse 2.4s ease-in-out infinite;
}

@keyframes ep-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22); }
  50%       { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.10); }
}

.ep-tide-header-text {
  font-size: 13px;
  font-weight: 500;
  color: #2c4e5e;
  line-height: 1.4;
}

.ep-tide-trend {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.ep-tide-trend--rising  { color: #0d9488; }
.ep-tide-trend--falling { color: #4a7c91; }

/* ── Área del gráfico ──────────────────────────────────────────────────────── */

/*
 * La altura (148px) incluye:
 *   - zona de badges de pleamar: ~44px superiores del viewBox
 *   - curva de marea: de y=48 a y=100 del viewBox (52px)
 *   - zona de badges de bajamar: ~48px inferiores del viewBox
 *
 * Con preserveAspectRatio="none" el SVG rellena exactamente el contenedor,
 * y las posiciones del overlay en % son coherentes con las coordenadas SVG.
 */

.ep-tide-chart-wrap {
  position: relative;
  height: 148px;
  margin: 8px 0 2px;
}

.ep-tide-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── Overlay HTML (indicador actual + badges) ──────────────────────────────── */

.ep-tide-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Línea vertical de hora actual */
.ep-tide-now-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: var(--ep-accent);
  opacity: 0.55;
  transform: translateX(-50%);
}

/* Punto verde en la curva */
.ep-tide-now-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ep-accent);
  border: 2px solid #fff;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
  transform: translate(-50%, -50%);
}

/* Badges pleamar / bajamar */
.ep-tide-badge {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  background: var(--ep-badge-bg);
  color: #fff;
  border-radius: 7px;
  padding: 4px 9px 5px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  transform: translateX(-50%);
  letter-spacing: 0.01em;
}

.ep-tide-badge--high {
  top: 3px;
}

.ep-tide-badge--low {
  bottom: 3px;
}

.ep-tide-badge-sub {
  font-size: 10px;
  font-weight: 400;
  opacity: 0.72;
}

/* Conector (puntito) entre badge y curva */
.ep-tide-badge-tick {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ep-badge-bg);
  transform: translateX(-50%);
  opacity: 0.6;
}

.ep-tide-badge-tick--high {
  /* se posiciona con JS en el top correcto */
}

.ep-tide-badge-tick--low {
  /* se posiciona con JS en el bottom correcto */
}

/* ── Eje de tiempo (00:00 … 24:00) ────────────────────────────────────────── */

.ep-tide-time-axis {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--ep-text);
  margin-top: 3px;
  padding: 0 1px;
  opacity: 0.7;
  user-select: none;
}

/* ── Lista de eventos del día ──────────────────────────────────────────────── */

.ep-tide-events-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #edf3f6;
}

.ep-tide-evt {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.01em;
}

.ep-tide-evt--high {
  background: rgba(18, 63, 82, 0.09);
  color: #123f52;
}

.ep-tide-evt--low {
  background: rgba(107, 135, 149, 0.1);
  color: var(--ep-text);
}

/* ── Responsive ────────────────────────────────────────────────────────────── */

@media (max-width: 520px) {
  .ep-tide-widget {
    padding: 14px 13px 11px;
    border-radius: 11px;
  }

  .ep-tide-chart-wrap {
    height: 116px;
  }

  .ep-tide-header-text {
    font-size: 12px;
  }

  .ep-tide-badge {
    font-size: 10px;
    padding: 3px 6px 4px;
    border-radius: 6px;
  }

  .ep-tide-badge-sub {
    font-size: 9px;
  }

  .ep-tide-time-axis {
    font-size: 9px;
  }

  .ep-tide-evt {
    font-size: 10.5px;
    padding: 3px 8px;
  }

  .ep-tide-now-dot {
    width: 10px;
    height: 10px;
  }
}

@media (max-width: 340px) {
  .ep-tide-widget {
    padding: 12px 10px 10px;
  }

  .ep-tide-header-text {
    font-size: 11px;
  }

  .ep-tide-badge {
    font-size: 9px;
    padding: 2px 5px 3px;
  }

  .ep-tide-evt {
    font-size: 9.5px;
    padding: 2px 7px;
  }
}

/* ════════════════════════════════════════════════════════════════════════════
   Condiciones de surf — barra horizontal ancha bajo las mareas
   ════════════════════════════════════════════════════════════════════════════ */

.ep-tide-conditions {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #edf3f6;
}

/* ── Fila superior: estrellas + calidad ─────────────────────────────────── */

.ep-tide-stars-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.ep-tide-stars {
  display: inline-flex;
  gap: 3px;
  line-height: 1;
}

.ep-tide-star {
  font-size: 20px;
  color: #d0dde4;
  transition: color 0.2s;
}

.ep-tide-star--on {
  color: #f59e0b;
}

.ep-tide-quality {
  font-size: 13px;
  font-weight: 500;
  color: #2c4e5e;
  margin: 4px 0 12px;
  line-height: 1.5;
}

/* ── Tiles: 5 columnas iguales, sin caja exterior ───────────────────────── */

.ep-tide-cond-tiles {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.ep-tide-cond-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: #f0f6f9;
  border-radius: 12px;
  padding: 14px 8px 12px;
  text-align: center;
}

.ep-tide-cond-icon {
  font-size: 20px;
  line-height: 1;
}

.ep-tide-cond-value {
  font-size: 16px;
  font-weight: 800;
  color: #0d2d3c;
  line-height: 1.1;
}

.ep-tide-cond-label {
  font-size: 10px;
  color: var(--ep-text);
  letter-spacing: 0.03em;
  line-height: 1.3;
  text-transform: uppercase;
}

/* Color semáforo del viento */
.ep-tide-wind--offshore { color: #0d9488; font-weight: 700; }
.ep-tide-wind--cross    { color: #d97706; font-weight: 700; }
.ep-tide-wind--onshore  { color: #dc2626; font-weight: 700; }

/* ── Pie de actualización ───────────────────────────────────────────────── */

.ep-tide-cond-updated {
  margin: 10px 0 0;
  font-size: 10px;
  color: var(--ep-text);
  opacity: 0.5;
  text-align: right;
}

/* ── Responsive condiciones ─────────────────────────────────────────────── */

@media (max-width: 560px) {
  .ep-tide-cond-tiles {
    grid-template-columns: repeat(3, 1fr);
  }

  .ep-tide-cond-tile:nth-child(4),
  .ep-tide-cond-tile:nth-child(5) {
    grid-column: span 1;
  }

  .ep-tide-star     { font-size: 17px; }
  .ep-tide-quality  { font-size: 13px; }
  .ep-tide-cond-value { font-size: 15px; }
}

@media (max-width: 360px) {
  .ep-tide-cond-tiles {
    grid-template-columns: repeat(2, 1fr);
  }
}
