/* Camino — Diario de Viaje. Tokens portados del diseño original (modo claro). */

:root {
  --bg: hsl(40 33% 96%);
  --fg: hsl(25 15% 15%);
  --border: hsl(35 15% 85%);
  --card: hsl(40 33% 98%);
  --primary: hsl(112 18% 30%);
  --primary-fg: hsl(60 10% 96%);
  --secondary: hsl(22 40% 45%);
  --muted: hsl(35 15% 90%);
  --muted-fg: hsl(25 10% 45%);
  --destructive: hsl(0 60% 50%);
  --destructive-fg: hsl(0 0% 100%);
  --radius: 0.75rem;
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --font-serif: 'Fraunces', Georgia, serif;
  --shadow-sm: 0 2px 0 0 hsl(25 15% 15% / 0.05), 0 1px 2px -1px hsl(25 15% 15% / 0.05);
  --shadow-lg: 0 2px 0 0 hsl(25 15% 15% / 0.05), 0 4px 6px -1px hsl(25 15% 15% / 0.05);
  --shadow-xl: 0 2px 0 0 hsl(25 15% 15% / 0.05), 0 8px 10px -1px hsl(25 15% 15% / 0.08);
}

* { box-sizing: border-box; border-color: var(--border); }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

::selection { background: hsl(112 18% 30% / 0.2); }

h1, h2, h3, .serif { font-family: var(--font-serif); font-weight: 500; margin: 0; }

button { font-family: inherit; cursor: pointer; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.hidden { display: none !important; }

/* ── Iconos ── */
.ic { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
.ic-sm { width: 1rem; height: 1rem; flex-shrink: 0; }
.ic-xs { width: 0.875rem; height: 0.875rem; flex-shrink: 0; }
.ic-lg { width: 2.5rem; height: 2.5rem; flex-shrink: 0; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Layout ── */
.page { min-height: 100dvh; display: flex; flex-direction: column; }
.container { max-width: 28rem; margin: 0 auto; width: 100%; padding: 0 1rem; }

.center-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
}

/* ── Botones ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 1rem;
  padding: 0 1.25rem;
  height: 3rem;
  background: transparent;
  color: inherit;
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.1s;
  text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: var(--primary-fg); box-shadow: var(--shadow-sm); }
.btn-primary:not(:disabled):hover { background: hsl(112 18% 26%); }
.btn-outline { border-color: hsl(112 18% 30% / 0.2); background: transparent; }
.btn-outline:hover { background: hsl(112 18% 30% / 0.05); color: var(--primary); }
.btn-dashed { border-style: dashed; }
.btn-ghost { border-color: transparent; }
.btn-ghost:hover { background: hsl(112 18% 30% / 0.07); }
.btn-destructive { background: var(--destructive); color: var(--destructive-fg); }
.btn-destructive:hover { background: hsl(0 60% 44%); }
.btn-lg { height: 3.5rem; border-radius: 1rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon {
  width: 2.5rem; height: 2.5rem; padding: 0; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; color: var(--muted-fg);
}
.btn-icon:hover { background: hsl(112 18% 30% / 0.08); color: var(--fg); }
.btn-icon.danger:hover { background: hsl(0 60% 50% / 0.1); color: var(--destructive); }

/* ── Tarjetas ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  box-shadow: var(--shadow-sm);
}

/* ── Cabecera pegajosa ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: hsl(40 33% 96% / 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid hsl(35 15% 85% / 0.4);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; padding: 0.85rem 1rem;
  max-width: 28rem; margin: 0 auto; width: 100%;
}

/* ── Barra de progreso ── */
.progress { height: 0.375rem; border-radius: 999px; background: hsl(112 18% 30% / 0.1); overflow: hidden; flex: 1; }
.progress > div { height: 100%; border-radius: 999px; background: var(--primary); transition: width 0.4s ease; }

/* ── Avisos ── */
.banner {
  padding: 1rem; border-radius: var(--radius);
  display: flex; align-items: flex-start; gap: 0.75rem; text-align: left;
  font-size: 0.875rem; font-weight: 500;
  animation: fadeIn 0.2s ease;
}
.banner-error { background: hsl(0 60% 50% / 0.1); color: var(--destructive); }
.banner .banner-close { margin-left: auto; background: none; border: none; color: inherit; opacity: 0.7; padding: 0; }
.banner .banner-close:hover { opacity: 1; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes zoomIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }
.anim-in { animation: fadeIn 0.25s ease; }
.anim-zoom { animation: zoomIn 0.4s ease; }

/* ── Textos utilitarios ── */
.muted { color: var(--muted-fg); }
.small { font-size: 0.875rem; }
.tiny { font-size: 0.75rem; }
.micro { font-size: 0.625rem; }
.bold { font-weight: 600; }
.upper { text-transform: uppercase; letter-spacing: 0.08em; }
.text-primary { color: var(--primary); }
.text-destructive { color: var(--destructive); }

/* ── Diálogos ── */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: hsl(25 15% 15% / 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 1.25rem;
  animation: fadeIn 0.15s ease;
}
.dialog {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  box-shadow: var(--shadow-xl);
  width: 90vw; max-width: 24rem;
  padding: 1.5rem;
  animation: zoomIn 0.18s ease;
}
.dialog h2 { font-size: 1.15rem; margin-bottom: 0.5rem; }
.dialog p { margin: 0 0 1.25rem; color: var(--muted-fg); font-size: 0.9rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }
.dialog input[type="text"] {
  width: 100%; padding: 0.7rem 0.9rem; margin-bottom: 1.25rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font: inherit; background: transparent; color: inherit;
}
.dialog input[type="text"]:focus { outline: 2px solid hsl(112 18% 30% / 0.5); outline-offset: 1px; }

/* ── Hoja inferior (drawer) ── */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: hsl(25 15% 15% / 0.45);
  display: flex; align-items: flex-end;
  animation: fadeIn 0.15s ease;
}
.sheet {
  background: var(--card);
  border-radius: 1.25rem 1.25rem 0 0;
  width: 100%; max-width: 28rem; margin: 0 auto;
  padding: 0.75rem 1rem 2rem;
  animation: sheetUp 0.22s ease;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet-handle { width: 3rem; height: 0.3rem; border-radius: 999px; background: var(--muted); margin: 0 auto 1rem; }
.sheet h2 { font-size: 1.25rem; margin-bottom: 0.25rem; }
.sheet .sheet-desc { color: var(--muted-fg); font-size: 0.875rem; margin: 0 0 1rem; }
.sheet-option {
  width: 100%; display: flex; align-items: center; gap: 1rem;
  padding: 1rem; border: 1px solid var(--border); border-radius: 1rem;
  background: var(--card); text-align: left; margin-bottom: 0.5rem;
  transition: background-color 0.15s, transform 0.1s;
}
.sheet-option:hover { background: hsl(112 18% 30% / 0.05); }
.sheet-option:active { transform: scale(0.98); }
.sheet-option .opt-icon {
  width: 2.75rem; height: 2.75rem; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.opt-icon.green { background: hsl(112 18% 30% / 0.1); color: var(--primary); }
.opt-icon.orange { background: hsl(22 40% 45% / 0.15); color: var(--secondary); }
.sheet-option .opt-title { display: block; font-weight: 500; }
.sheet-option .opt-sub { display: block; font-size: 0.75rem; color: var(--muted-fg); margin-top: 0.1rem; }

/* ── Barra inferior de acciones (etapa) ── */
.action-bar-wrap {
  position: fixed; bottom: 1rem; left: 1rem; right: 1rem; z-index: 20;
  display: flex; justify-content: center; pointer-events: none;
}
.action-bar {
  pointer-events: auto;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  border-radius: 999px;
  padding: 0.5rem;
  display: flex; align-items: center; justify-content: space-around; gap: 0.25rem;
  width: 100%; max-width: 24rem;
}
.action-bar .btn-round {
  width: 3rem; height: 3rem; border-radius: 999px; border: none;
  background: transparent; color: var(--fg);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background-color 0.15s, color 0.15s;
}
.action-bar .btn-round:hover { background: hsl(112 18% 30% / 0.1); color: var(--primary); }
.action-bar .btn-round.primary {
  background: var(--primary); color: var(--primary-fg); box-shadow: var(--shadow-sm);
}
.action-bar .btn-round.primary:hover { background: hsl(112 18% 26%); }
.action-bar .divider { width: 1px; height: 2rem; background: var(--border); margin: 0 0.25rem; }

.recording-bar {
  pointer-events: auto;
  background: var(--card);
  border: 2px solid hsl(0 60% 50% / 0.3);
  box-shadow: var(--shadow-xl);
  border-radius: 999px;
  padding: 0.5rem 0.5rem 0.5rem 1rem;
  display: flex; align-items: center; gap: 1rem;
  width: 100%; max-width: 24rem;
}
.recording-dot { width: 0.65rem; height: 0.65rem; border-radius: 999px; background: var(--destructive); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.recording-bar .rec-label { font-size: 0.875rem; font-weight: 600; color: var(--destructive); letter-spacing: 0.05em; flex: 1; display: flex; align-items: center; gap: 0.5rem; }
.recording-bar .rec-time { font-family: Menlo, monospace; font-weight: 700; font-variant-numeric: tabular-nums; }
.recording-bar .btn-stop {
  width: 3rem; height: 3rem; border-radius: 999px; border: none;
  background: var(--destructive); color: var(--destructive-fg);
  display: inline-flex; align-items: center; justify-content: center;
}

/* ── Rejilla de fotos ── */
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.photo-cell { display: flex; flex-direction: column; gap: 0.25rem; }
.photo-frame {
  position: relative; aspect-ratio: 1; border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--border); background: var(--muted);
}
.photo-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-delete {
  position: absolute; top: 0.4rem; right: 0.4rem;
  width: 2rem; height: 2rem; border-radius: 999px; border: none;
  background: hsl(0 0% 0% / 0.4); color: white;
  display: inline-flex; align-items: center; justify-content: center;
}
.media-delete:hover { background: hsl(0 0% 0% / 0.6); }

.video-frame { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: black; }
.video-frame video { width: 100%; max-height: 300px; display: block; }
.video-badge {
  position: absolute; top: 0.5rem; left: 0.5rem; pointer-events: none;
  font-size: 0.625rem; color: white; background: hsl(0 0% 0% / 0.5);
  padding: 0.1rem 0.5rem; border-radius: 999px;
}

/* ── Secciones de la etapa ── */
.media-section h3 {
  font-size: 1.1rem; display: flex; align-items: center; gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.media-section h3 .ic { color: var(--primary); }
.media-section { margin-bottom: 2rem; }

.note-card { position: relative; padding: 1rem; }
.note-card .note-text { font-size: 0.875rem; white-space: pre-wrap; padding-right: 2rem; margin: 0; line-height: 1.6; }
.note-card .note-time { font-size: 0.625rem; color: var(--muted-fg); margin: 0.75rem 0 0; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.note-card .btn-icon { position: absolute; top: 0.4rem; right: 0.4rem; width: 2rem; height: 2rem; }

.audio-card { position: relative; padding: 0.75rem; }
.audio-card audio { width: 100%; height: 2.5rem; margin-top: 0.5rem; }
.audio-head { display: flex; align-items: center; gap: 0.75rem; padding-right: 2.5rem; }
.audio-head .audio-icon {
  width: 2.5rem; height: 2.5rem; border-radius: 999px; flex-shrink: 0;
  background: hsl(112 18% 30% / 0.1); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.audio-card .btn-icon { position: absolute; top: 0.4rem; right: 0.4rem; width: 2rem; height: 2rem; }

.doc-card { display: flex; align-items: stretch; overflow: hidden; position: relative; padding: 0; }
.doc-card .doc-icon {
  width: 3rem; border-right: 1px solid var(--border);
  background: hsl(112 18% 30% / 0.05); color: hsl(112 18% 30% / 0.6);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.doc-card .doc-body { flex: 1; padding: 0.75rem; min-width: 0; padding-right: 5.5rem; }
.doc-card .doc-actions { position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 0.25rem; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Editor de nota ── */
.note-editor { padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); animation: fadeIn 0.2s ease; }
.note-editor textarea {
  width: 100%; min-height: 100px; padding: 0.75rem; font: inherit; font-size: 0.875rem;
  background: transparent; border: 1px solid var(--border); border-radius: 0.5rem;
  resize: none; color: inherit;
}
.note-editor textarea:focus { outline: 2px solid hsl(112 18% 30% / 0.5); outline-offset: 1px; }
.note-editor .editor-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.75rem; }
.btn-sm { height: 2.25rem; font-size: 0.875rem; padding: 0 0.9rem; border-radius: 0.5rem; }

/* ── Lista de viajes (inicio) ── */
.journey-card { overflow: hidden; border-width: 2px; border-color: hsl(112 18% 30% / 0.05); cursor: pointer; transition: box-shadow 0.3s, border-color 0.3s; }
.journey-card:hover { box-shadow: var(--shadow-lg); border-color: hsl(112 18% 30% / 0.2); }
.journey-card .jc-inner { padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.journey-card .jc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; }
.journey-card h2 { font-size: 1.25rem; margin-bottom: 0.3rem; }
.journey-card .jc-badge {
  width: 2.5rem; height: 2.5rem; border-radius: 999px; flex-shrink: 0;
  background: hsl(112 18% 30% / 0.05); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.journey-card .jc-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 1rem; border-top: 1px solid hsl(35 15% 85% / 0.6);
}

/* ── Cuaderno: etapas ── */
.stage-card { padding: 1rem 1.25rem; cursor: pointer; transition: box-shadow 0.2s, border-color 0.2s; }
.stage-card:hover { box-shadow: var(--shadow-lg); border-color: hsl(112 18% 30% / 0.25); }
.stage-num {
  font-size: 0.7rem; font-weight: 700; color: var(--muted-fg);
  text-transform: uppercase; letter-spacing: 0.1em;
}
.badge-done {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.7rem; font-weight: 600; color: var(--primary);
  background: hsl(112 18% 30% / 0.1); border-radius: 999px; padding: 0.15rem 0.6rem;
}
.stage-compact {
  display: flex; align-items: center; gap: 0.75rem; width: 100%;
  padding: 0.7rem 1rem; text-align: left;
  background: transparent; border: 1px solid hsl(35 15% 85% / 0.7); border-radius: var(--radius);
  color: var(--muted-fg); font-size: 0.875rem; transition: background-color 0.15s;
}
.stage-compact:hover { background: hsl(112 18% 30% / 0.04); }

/* ── Botón fijo inferior (cuaderno) ── */
.bottom-cta {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  background: linear-gradient(to top, var(--bg) 65%, transparent);
  padding: 1.5rem 1rem 1.25rem;
}
.bottom-cta .btn { max-width: 28rem; margin: 0 auto; display: flex; }

/* ── Cabecera de etapa ── */
.route-card { display: flex; align-items: center; justify-content: space-between; padding: 1rem; }
.route-card .route-col { flex: 1; text-align: center; min-width: 0; }
.route-card .route-arrow { padding: 0 1rem; color: hsl(35 15% 75%); }
.stage-stats {
  display: flex; align-items: center; justify-content: center; gap: 1rem;
  font-size: 0.875rem; font-weight: 500; color: var(--muted-fg);
  background: hsl(112 18% 30% / 0.03); padding: 0.75rem; border-radius: 1rem;
}
.stage-stats .dot { width: 0.375rem; height: 0.375rem; border-radius: 999px; background: var(--border); }

.desc-card { padding: 1rem; margin-bottom: 1.5rem; }
.desc-card p { font-size: 0.875rem; color: hsl(25 15% 15% / 0.8); line-height: 1.65; margin: 0 0 0.5rem; }
.desc-card .link-more {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-size: 0.75rem; font-weight: 600; color: var(--primary);
  background: none; border: none; padding: 0;
}
.desc-card .link-more:hover { text-decoration: underline; }

.done-banner {
  height: 3.5rem; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  background: hsl(112 18% 30% / 0.1); color: var(--primary); font-weight: 500;
  border: 1px solid hsl(112 18% 30% / 0.2);
}

/* ── Exportación ── */
.export-card { padding: 1.25rem; }
.export-card h3 { font-size: 1.1rem; display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.export-card h3 .ic { color: var(--secondary); }
.export-row { display: flex; justify-content: space-between; font-size: 0.875rem; padding: 0.2rem 0; }
.checkbox-row { display: flex; align-items: center; gap: 0.6rem; margin: 0.9rem 0; font-size: 0.875rem; cursor: pointer; user-select: none; }
.checkbox-row input { width: 1.1rem; height: 1.1rem; accent-color: var(--primary); }

/* ── Icono héroe ── */
.hero-icon {
  width: 6rem; height: 6rem; border-radius: 999px;
  background: hsl(112 18% 30% / 0.05);
  box-shadow: 0 0 40px hsl(112 18% 30% / 0.1);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 2rem; color: var(--primary);
}
.hero-icon.warm { background: hsl(22 40% 45% / 0.1); box-shadow: 0 0 40px hsl(22 40% 45% / 0.15); color: var(--secondary); }

a.link-dashed {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  width: 100%; height: 3rem; border-radius: var(--radius);
  border: 1px dashed hsl(112 18% 30% / 0.2);
  font-size: 0.875rem; font-weight: 500; color: var(--muted-fg);
  text-decoration: none; transition: all 0.15s;
}
a.link-dashed:hover { color: var(--primary); border-color: hsl(112 18% 30% / 0.4); background: hsl(112 18% 30% / 0.05); }
