/* MEMOVIAJE v2.8.0 — Responsive Mobile-First Stylesheet
   Base: 375px → responsive → 1400px+

   Breakpoints:
   - 375px+   (mobile)
   - 600px+   (tablet)
   - 900px+   (desktop)
   - 1400px+  (HD)

   IMPORTANTE: La mayoría de selectores están scopeados a 'body.vista-v28'
   para evitar romper las vistas legacy. Solo se aplican cuando se navega a
   /viaje/:id/tabs-v28 (activado en ruta.2.6.5.js).
*/

:root {
  --primary: #c93d3d;
  --primary-dark: #a64729;
  --bg: #fbfaf8;
  --bg-alt: #f9f9f9;
  --text: #333;
  --text-muted: #999;
  --border: #eee;
  --border-light: #f5f5f5;
  --radius: 8px;
  --radius-sm: 4px;
  --gap: 16px;
  --gap-sm: 8px;
  --navbar-height: 60px;
  --header-height: 56px;
}

/* box-sizing:border-box global ya lo trae el legacy (styles.2.6.5.css, línea
   161) — mantenerlo aquí no pisa nada, es lo mismo que ya había. */
* { box-sizing: border-box; }

/* margin/padding a 0 SOLO en los componentes propios del rediseño v2.8.0,
   nunca global. Antes iba en el "*" de arriba y se llevaba por delante el
   espaciado de las pantallas legacy que se renderizan en esta misma página
   (biblioteca, familia, diario, mapa, planes, libro… todas cargan en
   app.html junto con este CSS). .card, .btn, .cargando y .timeline existen
   con el mismo nombre en ambas hojas (ver colisiones, Fase 1) y se dejan
   fuera a propósito: cada una ya fija su propio padding más abajo, así que
   no necesitan el reset y así no tocan al elemento homónimo legacy. */
body.vista-v28 header, body.vista-v28 header *,
body.vista-v28 .layout-home, body.vista-v28 .sidebar-velo, body.vista-v28 .sidebar-home, body.vista-v28 .sidebar-home *,
body.vista-v28 .navbar-bottom, body.vista-v28 .navbar-bottom *,
body.vista-v28 .grid, body.vista-v28 .viaje-card, body.vista-v28 .viaje-card *, body.vista-v28 .stat, body.vista-v28 .stat-val,
body.vista-v28 .tabs, body.vista-v28 .tabs *,
body.vista-v28 .modal, body.vista-v28 .modal *,
body.vista-v28 .card-title, body.vista-v28 .card-text,
body.vista-v28 .timeline-item, body.vista-v28 .timeline-time, body.vista-v28 .timeline-title, body.vista-v28 .timeline-desc,
body.vista-v28 .dia-card, body.vista-v28 .nombre, body.vista-v28 .gallery, body.vista-v28 .gallery * {
  margin: 0;
  padding: 0;
}

body.vista-v28 html, body.vista-v28 body {
  width: 100%;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

body.vista-v28 body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ============ HEADER ============ */

body.vista-v28 header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: white;
  border-bottom: 1px solid var(--border);
}

body.vista-v28 .barra {
  display: flex;
  align-items: center;
  height: var(--header-height);
  padding: 0 var(--gap-sm);
  gap: var(--gap-sm);
}

body.vista-v28 .marca {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  flex: 0 0 auto;
}

body.vista-v28 .marca svg { width: 32px; height: 32px; }
body.vista-v28 .nombre { font-size: 14px; font-weight: 600; letter-spacing: -0.5px; }
body.vista-v28 .nombre span { display: none; }

@media (min-width: 600px) {
  body.vista-v28 .nombre span { display: inline; }
}

body.vista-v28 .cabecera-hueco { flex: 1; }

body.vista-v28 .atras, body.vista-v28 .sidebar-toggle, body.vista-v28 .gps-badge, body.vista-v28 .salir {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  font-size: 14px;
  color: var(--text);
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

body.vista-v28 .atras:hover, body.vista-v28 .sidebar-toggle:hover, body.vista-v28 .salir:hover {
  background: var(--border-light);
}

body.vista-v28 .barra-buscar {
  padding: var(--gap-sm);
  border-top: 1px solid var(--border);
}

body.vista-v28 .buscador {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-alt);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

body.vista-v28 .buscador-ic { font-size: 16px; opacity: 0.6; }
body.vista-v28 .buscador input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 13px;
}

/* ============ LAYOUT ============ */

body.vista-v28 .layout-home {
  display: flex;
  flex: 1;
  overflow: hidden;
}

body.vista-v28 .sidebar-velo {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 50;
}

body.vista-v28 .sidebar-home {
  position: fixed;
  left: 0;
  top: var(--header-height);
  bottom: var(--navbar-height);
  width: 280px;
  background: white;
  overflow-y: auto;
  z-index: 60;
  transform: translateX(-100%);
  transition: transform 0.3s;
  padding: var(--gap);
  border-right: 1px solid var(--border);
}

body.vista-v28 .sidebar-home[aria-hidden="false"] {
  transform: translateX(0);
}

@media (min-width: 900px) {
  body.vista-v28 .sidebar-home {
    position: relative;
    transform: translateX(0) !important;
    top: 0;
    bottom: 0;
    width: 280px;
  }

  body.vista-v28 .sidebar-velo { display: none !important; }
  body.vista-v28 .sidebar-toggle { display: none !important; }
}

body.vista-v28 main#app {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--gap);
}

@media (min-width: 900px) {
  body.vista-v28 main#app {
    padding: var(--gap) calc(var(--gap) * 2);
  }
}

/* ============ NAVBAR BOTTOM ============ */

body.vista-v28 .navbar-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  height: var(--navbar-height);
  background: white;
  border-top: 1px solid var(--border);
  gap: var(--gap-sm);
  padding-bottom: max(var(--gap-sm), env(safe-area-inset-bottom));
}

@media (min-width: 900px) {
  body.vista-v28 .navbar-bottom { display: none; }
}

body.vista-v28 .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

body.vista-v28 .nav-item.active {
  color: var(--primary);
  font-weight: 600;
}

body.vista-v28 .nav-icon { font-size: 20px; }

/* ============ CONTENT SPACING ============ */

body.vista-v28 main {
  padding-bottom: calc(var(--navbar-height) + var(--gap));
}

@media (min-width: 900px) {
  body.vista-v28 main { padding-bottom: var(--gap); }
}

/* ============ CARDS & GRIDS ============ */

body.vista-v28 .grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: 1fr;
  margin-bottom: var(--gap);
}

@media (min-width: 600px) {
  body.vista-v28 .grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
  body.vista-v28 .grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1400px) {
  body.vista-v28 .grid { grid-template-columns: repeat(4, 1fr); }
}

body.vista-v28 .card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: var(--gap);
  transition: all 0.2s;
}

body.vista-v28 .card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  border-color: var(--primary);
}

body.vista-v28 .card-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

body.vista-v28 .card-text {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ============ VIAJE CARD ============ */

body.vista-v28 .viaje-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 120px;
  background: linear-gradient(135deg, #a64729, #d46a57);
  color: white;
  padding: var(--gap);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s;
}

body.vista-v28 .viaje-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(201,61,61,0.2);
}

body.vista-v28 .viaje-title {
  font-size: 16px;
  font-weight: 600;
}

body.vista-v28 .viaje-meta {
  font-size: 11px;
  opacity: 0.9;
  margin-top: 4px;
}

body.vista-v28 .viaje-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap-sm);
  margin-top: 8px;
}

@media (min-width: 600px) {
  body.vista-v28 .viaje-stats { grid-template-columns: repeat(4, 1fr); }
}

body.vista-v28 .stat {
  font-size: 10px;
  text-align: center;
  background: rgba(255,255,255,0.2);
  padding: 6px;
  border-radius: var(--radius-sm);
}

body.vista-v28 .stat-val {
  font-weight: 600;
  display: block;
}

/* ============ BUTTONS ============ */

body.vista-v28 .btn {
  padding: 12px 16px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  transition: all 0.2s;
  display: inline-block;
  text-align: center;
}

body.vista-v28 .btn-primary {
  background: var(--primary);
  color: white;
  width: 100%;
}

body.vista-v28 .btn-primary:hover {
  background: var(--primary-dark);
}

body.vista-v28 .btn-secondary {
  background: var(--bg-alt);
  color: var(--text);
  width: 100%;
  border: 1px solid var(--border);
}

body.vista-v28 .btn-secondary:hover {
  background: var(--border-light);
}

/* ============ TABS ============ */

body.vista-v28 .tabs {
  display: flex;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--gap);
  overflow-x: auto;
  font-size: 12px;
  font-weight: 500;
}

body.vista-v28 .tab {
  padding: 12px 0;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

body.vista-v28 .tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

body.vista-v28 .tab:hover:not(.active) {
  color: var(--text);
}

/* ============ TIMELINE ============ */

body.vista-v28 .timeline {
  position: relative;
  padding-left: 20px;
}

body.vista-v28 .timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

body.vista-v28 .timeline-item {
  position: relative;
  margin-bottom: 16px;
}

body.vista-v28 .timeline-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 2px;
  width: 12px;
  height: 12px;
  background: var(--primary);
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 0 2px var(--border);
}

body.vista-v28 .timeline-time {
  font-size: 10px;
  font-weight: 600;
  color: var(--primary);
}

body.vista-v28 .timeline-title {
  font-weight: 600;
  font-size: 13px;
  margin: 4px 0;
}

body.vista-v28 .timeline-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* ============ GALLERY ============ */

body.vista-v28 .gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap-sm);
  margin-bottom: var(--gap);
}

@media (min-width: 600px) {
  body.vista-v28 .gallery { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 900px) {
  body.vista-v28 .gallery { grid-template-columns: repeat(6, 1fr); }
}

body.vista-v28 .gallery-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background: var(--border-light);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
}

body.vista-v28 .gallery-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 999px;
}

/* Usados por viaje-tabs.2.8.0.js / dia-tabs.2.8.0.js (TabManager) */
body.vista-v28 .tab-content { margin-top: 4px; }
body.vista-v28 .dia-card { cursor: pointer; }

body.vista-v28 .gallery-item:hover {
  transform: scale(0.95);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

body.vista-v28 .gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ============ MODALS & OVERLAYS ============ */

body.vista-v28 .modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

body.vista-v28 .modal.active {
  display: flex;
}

body.vista-v28 .modal-content {
  background: white;
  border-radius: var(--radius);
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--gap);
}

/* ============ FORMS ============ */

body.vista-v28 input, body.vista-v28 textarea, body.vista-v28 select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

body.vista-v28 input:focus, body.vista-v28 textarea:focus, body.vista-v28 select:focus {
  border-color: var(--primary);
}

body.vista-v28 textarea {
  resize: vertical;
  min-height: 80px;
}

body.vista-v28 label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 6px;
}

/* ============ UTILITIES ============ */

body.vista-v28 .cargando {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-muted);
}

.offline {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #ff6b6b;
  color: white;
  padding: 8px;
  text-align: center;
  font-size: 12px;
  z-index: 999;
}

.section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 16px 0 8px 0;
  letter-spacing: 0.5px;
}

/* ============ DARK MODE ============ */

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a1a;
    --bg-alt: #2a2a2a;
    --text: #e0e0e0;
    --text-muted: #999;
    --border: #333;
    --border-light: #2a2a2a;
  }

  body.vista-v28 header, body.vista-v28 .navbar-bottom, body.vista-v28 .card, body.vista-v28 .sidebar-home, body.vista-v28 main { background: #222; }
}

/* ============ A11Y ============ */

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ============ PRINT ============ */

@media print {
  body.vista-v28 header, body.vista-v28 .navbar-bottom, body.vista-v28 .sidebar-home { display: none; }
  body.vista-v28 { margin: 0; padding: 0; }
}
