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

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

: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;
}

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

html, 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 {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

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

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

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

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

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

.cabecera-hueco { flex: 1; }

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

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

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

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

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

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

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

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

.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);
}

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

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

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

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

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

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

.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) {
  .navbar-bottom { display: none; }
}

.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;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.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;
}

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

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

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

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

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

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

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

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

.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;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

.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);
}

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

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

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

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

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

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

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

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

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

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

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

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

.modal.active {
  display: flex;
}

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

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

input, textarea, 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;
}

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

textarea {
  resize: vertical;
  min-height: 80px;
}

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

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

.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;
  }

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

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

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

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

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