/* ══════════════════════════════════════════════
   app.css — Mobile-first · Viaje Buenos Aires
   ══════════════════════════════════════════════ */

/* ─── VARIABLES ─────────────────────────────── */
:root {
  --bg:        #0f172a;
  --bg-card:   #1e293b;
  --bg-input:  #253045;
  --border:    rgba(255,255,255,0.08);
  --text:      #f1f5f9;
  --text-2:    #94a3b8;
  --text-3:    #64748b;
  --accent:    #3b82f6;
  --accent-dk: #1d4ed8;
  --green:     #22c55e;
  --red:       #ef4444;
  --amber:     #f59e0b;
  --nav-h:     64px;
  --header-h:  64px;
  --safe-b:    env(safe-area-inset-bottom, 0px);
  --radius:    14px;
  --radius-sm: 8px;
}

/* ─── RESET ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

/* ─── HEADER ─────────────────────────────────── */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 50;
  padding-top: env(safe-area-inset-top, 0);
}
.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: var(--header-h);
}
.header-left { display: flex; align-items: center; gap: 10px; }
.trip-icon { font-size: 22px; }
.trip-title { font-size: 17px; font-weight: 600; letter-spacing: -0.3px; }
.trip-sub { font-size: 11px; color: var(--text-2); margin-top: 1px; }
.header-badge {
  font-size: 11px;
  background: var(--accent);
  color: #fff;
  padding: 4px 10px;
  border-radius: 99px;
  font-weight: 500;
  white-space: nowrap;
}

/* ─── MAIN / PANTALLAS ───────────────────────── */
.app-main {
  padding-top: var(--header-h);
  padding-bottom: calc(var(--nav-h) + var(--safe-b));
  min-height: 100dvh;
}
.screen { display: none; }
.screen.active { display: block; }
.screen-inner { padding: 16px 16px 24px; }

/* ─── NAV INFERIOR ───────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--nav-h) + var(--safe-b));
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 50;
  padding-bottom: var(--safe-b);
}
.nav-btn {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  padding: 8px 4px;
  transition: color 0.15s;
  min-height: 44px;
}
.nav-btn.active { color: var(--accent); }
.nav-icon { font-size: 20px; }
.nav-label { font-size: 10px; font-weight: 500; }

/* ─── CARDS GENÉRICAS ────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}
.card-sm { padding: 10px 14px; }

/* ─── ITINERARIO ─────────────────────────────── */
.day-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}
.day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  cursor: pointer;
  min-height: 56px;
  user-select: none;
  -webkit-user-select: none;
}
.day-header:active { background: rgba(255,255,255,0.04); }
.day-left { display: flex; align-items: center; gap: 10px; }
.day-emoji { font-size: 18px; }
.day-title { font-size: 14px; font-weight: 600; }
.day-count { font-size: 12px; color: var(--text-2); margin-top: 1px; }
.day-badge {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 99px;
  background: rgba(59,130,246,0.15);
  color: #60a5fa;
  font-weight: 500;
}
.day-chevron {
  color: var(--text-3);
  font-size: 18px;
  transition: transform 0.2s;
}
.day-block.open .day-chevron { transform: rotate(180deg); }
.day-body { display: none; border-top: 1px solid var(--border); }
.day-block.open .day-body { display: block; }

.evento-list { padding: 6px 0; }
.evento-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.evento-row:last-child { border-bottom: none; }
.evento-hora { font-size: 11px; color: var(--text-2); min-width: 38px; padding-top: 2px; flex-shrink: 0; }
.evento-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; }
.evento-info { flex: 1; min-width: 0; }
.evento-nombre { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.evento-notas { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.btn-delete-evento {
  background: none; border: none; cursor: pointer;
  color: var(--text-3); font-size: 16px; padding: 4px;
  min-width: 28px; min-height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}
.btn-delete-evento:active { background: rgba(239,68,68,0.15); color: var(--red); }

.btn-add-evento {
  display: flex; align-items: center; gap: 6px;
  width: calc(100% - 28px);
  margin: 8px 14px 10px;
  padding: 9px 12px;
  background: rgba(59,130,246,0.1);
  color: #60a5fa;
  border: 1px dashed rgba(59,130,246,0.3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
}
.btn-add-evento:active { background: rgba(59,130,246,0.2); }

/* ─── GASTOS ─────────────────────────────────── */
.resumen-gastos {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.resumen-label { font-size: 11px; color: var(--text-2); display: block; margin-bottom: 4px; }
.resumen-monto { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; color: var(--text); }
.split-grid { display: grid; grid-template-columns: 1fr 1px 1fr; gap: 12px; margin-top: 14px; }
.split-divider { background: var(--border); }
.split-item { display: flex; flex-direction: column; gap: 2px; }
.split-nombre { font-size: 11px; color: var(--text-2); }
.split-monto { font-size: 18px; font-weight: 600; }
.split-estado { font-size: 11px; }
.debe { color: var(--red); }
.cobrar { color: var(--green); }

.gasto-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.gasto-item:first-child { border-top: 1px solid var(--border); margin-top: 8px; }
.gasto-cat-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.gasto-info { flex: 1; min-width: 0; }
.gasto-nombre { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gasto-meta { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.gasto-derecha { text-align: right; flex-shrink: 0; }
.gasto-monto { font-size: 14px; font-weight: 600; display: block; }
.btn-del-gasto {
  background: none; border: none; cursor: pointer; color: var(--text-3);
  font-size: 14px; padding: 2px; margin-top: 2px; display: block; margin-left: auto;
}

/* ─── LUGARES ────────────────────────────────── */
.filter-chips {
  display: flex; gap: 6px;
  overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px;
  scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 12px; font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  min-height: 32px;
}
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip:active { opacity: 0.8; }

.lugar-card {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.lugar-emoji {
  width: 42px; height: 42px;
  background: var(--bg-input);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.lugar-info { flex: 1; min-width: 0; }
.lugar-nombre { font-size: 14px; font-weight: 600; }
.lugar-tipo { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.lugar-notas { font-size: 12px; color: var(--text-2); margin-top: 4px; line-height: 1.4; }
.lugar-acciones { display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0; }
.btn-star { background: none; border: none; cursor: pointer; font-size: 20px; padding: 2px; min-height: 32px; }
.btn-del-lugar { background: none; border: none; cursor: pointer; color: var(--text-3); font-size: 16px; padding: 2px; }

/* ─── CLIMA ──────────────────────────────────── */
.clima-hero {
  background: linear-gradient(135deg, #1e3a5f 0%, #1e293b 100%);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--radius);
  padding: 20px 18px;
  margin-bottom: 16px;
  text-align: center;
}
.clima-ciudad { font-size: 12px; color: #60a5fa; font-weight: 500; text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 6px; }
.clima-rango { font-size: 36px; font-weight: 700; letter-spacing: -1px; }
.clima-descripcion { font-size: 13px; color: var(--text-2); margin-top: 6px; }

.forecast-strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: none; }
.forecast-strip::-webkit-scrollbar { display: none; }
.forecast-day {
  flex-shrink: 0; min-width: 52px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 6px;
  text-align: center; display: flex; flex-direction: column; gap: 4px;
}
.fd-name { font-size: 10px; color: var(--text-2); }
.fd-icon { font-size: 18px; }
.fd-temp { font-size: 12px; font-weight: 600; }

.clima-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 14px;
}
.cs-item {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 6px;
  text-align: center;
}
.cs-val { display: block; font-size: 14px; font-weight: 700; }
.cs-label { display: block; font-size: 10px; color: var(--text-2); margin-top: 2px; }

.rec-block {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 8px;
}
.rec-lluvia { border-left: 3px solid #3b82f6; }
.rec-sol { border-left: 3px solid var(--amber); }
.rec-eyebrow { font-size: 11px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.rec-text { font-size: 13px; line-height: 1.6; color: var(--text); }

/* ─── SECCIÓN TITLES ─────────────────────────── */
.section-title-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.section-title { font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.5px; }
.btn-agregar {
  font-size: 12px; font-weight: 600;
  color: var(--accent);
  background: rgba(59,130,246,0.1);
  border: none; border-radius: 99px;
  padding: 5px 12px; cursor: pointer; min-height: 30px;
}
.btn-agregar:active { background: rgba(59,130,246,0.2); }

/* ─── MODALES ────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: flex-end;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }
.modal-sheet {
  width: 100%;
  background: var(--bg-card);
  border-radius: 20px 20px 0 0;
  padding: 16px 20px calc(24px + var(--safe-b));
  max-height: 90dvh;
  overflow-y: auto;
}
.modal-handle {
  width: 36px; height: 4px;
  background: var(--text-3);
  border-radius: 99px;
  margin: 0 auto 16px;
}
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 18px; }
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.form-input, .form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  padding: 11px 13px;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  font-family: inherit;
  min-height: 44px;
}
.form-input:focus, .form-select:focus { border-color: var(--accent); }
.form-input-lg { font-size: 20px; font-weight: 700; padding: 12px 13px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.form-row-2 .form-group { margin-bottom: 0; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.btn-cancel {
  padding: 13px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.06);
  border: none; color: var(--text); cursor: pointer;
  font-size: 15px; font-weight: 500; min-height: 48px;
}
.btn-confirm {
  padding: 13px; border-radius: var(--radius-sm);
  background: var(--accent);
  border: none; color: #fff; cursor: pointer;
  font-size: 15px; font-weight: 700; min-height: 48px;
}
.btn-confirm:active { background: var(--accent-dk); }
.btn-primary {
  display: block; margin: 12px auto 0;
  padding: 12px 24px;
  background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
  min-height: 44px;
}

/* ─── ESTADOS VACÍOS / LOADING ───────────────── */
.loading-state, .empty-state {
  text-align: center; padding: 40px 20px;
  color: var(--text-2); font-size: 14px;
}
.empty-icon { font-size: 36px; display: block; margin-bottom: 10px; }
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* ─── TOAST ──────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-b) + 12px);
  left: 50%; transform: translateX(-50%);
  background: #1e293b;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px; font-weight: 500;
  padding: 10px 18px;
  border-radius: 99px;
  white-space: nowrap;
  z-index: 300;
  animation: fadeUp 0.25s ease;
}
@keyframes fadeUp { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ─── RESPONSIVE (tablet / desktop) ─────────── */
@media (min-width: 600px) {
  .app-header, .bottom-nav { max-width: 480px; left: 50%; transform: translateX(-50%); }
  .app-main { max-width: 480px; margin: 0 auto; }
  .toast { bottom: calc(var(--nav-h) + 20px); }
}

/* ─── SCROLLBAR OSCURO ───────────────────────── */
.modal-sheet::-webkit-scrollbar { width: 4px; }
.modal-sheet::-webkit-scrollbar-track { background: transparent; }
.modal-sheet::-webkit-scrollbar-thumb { background: var(--text-3); border-radius: 2px; }
