/* ============================================================
   CARNET DE VOYAGE — BCN → Normandie
   carta crema · inchiostro blu notte · mattone · serif Fraunces
   ============================================================ */

:root {
  --paper: #F6F1E6;
  --paper-deep: #EFE7D6;
  --ink: #1E2A38;
  --ink-soft: #4A5462;
  --mer: #2C5F7C;
  --brique: #C24E36;
  --sable: #E2D3B4;
  --line: #D8CCB4;
  --ok: #6B8F5E;
  --shadow: 0 2px 12px rgba(30, 42, 56, .10);
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Karla', 'Helvetica Neue', sans-serif;
}

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

html, body { height: 100%; }

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* grana carta */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.12 0 0 0 0 0.10 0 0 0 0 0.06 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- HEADER ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  background: var(--ink);
  color: var(--paper);
  border-bottom: 3px solid var(--brique);
  flex-wrap: wrap;
  z-index: 1200;
}

.brand-route {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .25em;
  font-weight: 700;
  color: var(--sable);
}
.brand-route .arrow { color: var(--brique); letter-spacing: 0; }

.brand h1 {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 24px;
  line-height: 1.05;
  font-style: italic;
  letter-spacing: .01em;
}

.brand-sub {
  font-size: 11px;
  color: #93A1B3;
  letter-spacing: .08em;
}

.trip-controls {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.tc-group { display: flex; flex-direction: column; gap: 2px; }
.tc-group label {
  font-size: 9px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #93A1B3;
  font-weight: 700;
}
.tc-group input, .tc-group select {
  font-family: var(--sans);
  font-size: 13px;
  padding: 5px 8px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 4px;
  outline: none;
}
.tc-small input, .tc-small select { width: 58px; }

/* ---------- LAYOUT ---------- */
.layout {
  flex: 1;
  display: flex;
  min-height: 0;
}

.panel {
  width: 390px;
  min-width: 330px;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-right: 1px solid var(--line);
  z-index: 1100;
  box-shadow: 4px 0 18px rgba(30,42,56,.06);
}

#map { flex: 1; min-height: 0; background: #CFE0E8; }

/* ---------- TABS ---------- */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--ink);
}
.tab {
  flex: 1;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 12px 4px;
  background: transparent;
  color: var(--ink-soft);
  border: none;
  cursor: pointer;
  position: relative;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brique); }
.tab.active::after {
  content: '';
  position: absolute;
  left: 15%; right: 15%; bottom: -2px;
  height: 3px;
  background: var(--brique);
}
.iti-count {
  display: inline-block;
  min-width: 17px;
  padding: 1px 4px;
  border-radius: 9px;
  background: var(--mer);
  color: var(--paper);
  font-size: 10px;
}

.tab-pane {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  min-height: 0;
}
.tab-pane.active { display: block; }

.pane-intro { font-size: 13px; color: var(--ink-soft); margin-bottom: 12px; line-height: 1.45; }

/* ---------- ESPLORA ---------- */
.search {
  width: 100%;
  font-family: var(--sans);
  font-size: 14px;
  padding: 9px 12px;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: #FFFDF8;
  margin-bottom: 10px;
  outline: none;
}
.search:focus { border-color: var(--mer); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip {
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1.5px solid var(--c, var(--ink));
  color: var(--c, var(--ink));
  background: transparent;
  cursor: pointer;
  transition: all .15s;
}
.chip.on { background: var(--c, var(--ink)); color: var(--paper); }

.toggles { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 12px; }
.toggle { font-size: 12.5px; display: flex; gap: 5px; align-items: center; cursor: pointer; color: var(--ink-soft); font-weight: 500; }
.toggle input { accent-color: var(--brique); }

.cards { display: flex; flex-direction: column; gap: 8px; }

.card {
  background: #FFFDF8;
  border: 1px solid var(--line);
  border-left: 4px solid var(--cc, var(--mer));
  border-radius: 6px;
  padding: 10px 12px;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}
.card:hover { transform: translateX(3px); box-shadow: var(--shadow); }
.card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card h3 { font-family: var(--serif); font-weight: 600; font-size: 15.5px; }
.card .stars { color: var(--brique); font-size: 12px; letter-spacing: .1em; white-space: nowrap; }
.card-meta { font-size: 11.5px; color: var(--ink-soft); margin-top: 3px; }
.card-meta b { color: var(--ink); }
.card .badge-base {
  display: inline-block; font-size: 10px; font-weight: 700;
  background: var(--sable); border-radius: 3px; padding: 1px 6px; margin-left: 6px;
  color: var(--ink);
}

/* ---------- DETAIL SHEET ---------- */
.detail-sheet {
  position: absolute;
  right: 14px; top: 84px;
  width: 360px;
  max-width: calc(100vw - 28px);
  max-height: calc(100% - 120px);
  overflow-y: auto;
  background: #FFFDF8;
  border: 1px solid var(--line);
  border-top: 5px solid var(--cc, var(--mer));
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(30,42,56,.22);
  padding: 16px 18px;
  z-index: 1150;
  display: none;
}
.detail-sheet.open { display: block; animation: slideIn .18s ease-out; }
@keyframes slideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.ds-close {
  position: absolute; top: 8px; right: 10px;
  border: none; background: none; font-size: 20px; cursor: pointer; color: var(--ink-soft);
}
.ds-cat { font-size: 10.5px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; color: var(--cc, var(--mer)); }
.detail-sheet h2 { font-family: var(--serif); font-weight: 900; font-size: 22px; margin: 2px 0 4px; line-height: 1.1; }
.ds-stars { color: var(--brique); margin-bottom: 8px; font-size: 13px; }
.ds-meta { display: flex; flex-wrap: wrap; gap: 5px 14px; font-size: 12px; color: var(--ink-soft); margin-bottom: 10px; }
.ds-meta b { color: var(--ink); }
.detail-sheet p.desc { font-size: 13.5px; line-height: 1.55; margin-bottom: 10px; }
.ds-tip {
  font-size: 12.5px; line-height: 1.5;
  background: var(--paper-deep);
  border-left: 3px solid var(--ok);
  padding: 8px 10px; border-radius: 4px;
  margin-bottom: 10px;
}
.ds-tip b { color: var(--ok); }
.ds-lodge {
  font-size: 12.5px; line-height: 1.5;
  background: #F2EBDB;
  border-left: 3px solid var(--brique);
  padding: 8px 10px; border-radius: 4px;
  margin-bottom: 10px;
}
.ds-nearby { font-size: 12px; color: var(--ink-soft); margin-bottom: 12px; line-height: 1.6; }
.ds-nearby a { color: var(--mer); font-weight: 700; text-decoration: none; cursor: pointer; }
.ds-nearby a:hover { text-decoration: underline; }

.ds-btns { display: flex; flex-wrap: wrap; gap: 7px; }
.btn {
  font-family: var(--sans);
  font-size: 12px; font-weight: 700;
  padding: 8px 12px;
  border-radius: 5px;
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 5px;
  transition: all .13s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn-primary { background: var(--brique); border-color: var(--brique); color: #fff; }
.btn-primary:hover { background: #A53E29; border-color: #A53E29; color: #fff; }
.btn-booking { border-color: var(--mer); color: var(--mer); }
.btn-booking:hover { background: var(--mer); color: #fff; }

/* ---------- ITINERARIO ---------- */
.iti-list { display: flex; flex-direction: column; }

.iti-stop {
  display: flex; align-items: center; gap: 9px;
  background: #FFFDF8;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}
.iti-num {
  width: 24px; height: 24px; flex: none;
  border-radius: 50%;
  background: var(--ink); color: var(--paper);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.iti-stop.is-start .iti-num, .iti-stop.is-end .iti-num { background: var(--brique); }
.iti-name { flex: 1; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.iti-name small { display: block; font-weight: 400; color: var(--ink-soft); font-size: 11px; }
.iti-ctrl { display: flex; gap: 2px; }
.iti-ctrl button {
  border: none; background: var(--paper-deep);
  width: 24px; height: 24px; border-radius: 4px;
  cursor: pointer; font-size: 12px; color: var(--ink);
}
.iti-ctrl button:hover { background: var(--sable); }

.iti-leg {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 0 3px 21px;
  font-size: 11.5px; color: var(--ink-soft);
}
.iti-leg .leg-line {
  width: 2px; height: 26px;
  border-left: 2px dashed var(--brique);
}
.iti-leg b { color: var(--ink); }
.iti-leg .leg-warn {
  color: var(--brique); font-weight: 700;
}

.iti-totals {
  margin-top: 12px;
  font-size: 13px;
  background: var(--ink); color: var(--paper);
  border-radius: 6px; padding: 12px 14px;
  line-height: 1.7;
  display: none;
}
.iti-totals.show { display: block; }
.iti-totals b { color: var(--sable); }
.iti-totals .tot-big { font-family: var(--serif); font-size: 19px; font-weight: 900; color: #fff; }

.iti-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }

.iti-empty { font-size: 13px; color: var(--ink-soft); text-align: center; padding: 30px 10px; line-height: 1.6; }
.iti-empty .big { font-size: 30px; display: block; margin-bottom: 8px; }

/* ---------- PRESET ---------- */
.preset {
  background: #FFFDF8;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.preset h3 { font-family: var(--serif); font-weight: 900; font-size: 18px; }
.preset .p-sub { font-size: 12px; color: var(--brique); font-weight: 700; margin-bottom: 8px; }
.preset .p-desc { font-size: 12.5px; line-height: 1.55; color: var(--ink-soft); margin-bottom: 10px; }

/* ---------- INFO ---------- */
.acc {
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 8px;
  background: #FFFDF8;
  overflow: hidden;
}
.acc-head {
  width: 100%;
  font-family: var(--serif);
  font-weight: 600; font-size: 15px;
  text-align: left;
  padding: 12px 14px;
  background: none; border: none; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  color: var(--ink);
}
.acc-head::after { content: '+'; font-size: 18px; color: var(--brique); }
.acc.open .acc-head::after { content: '–'; }
.acc-body { display: none; padding: 0 14px 14px; font-size: 13px; line-height: 1.6; color: var(--ink-soft); }
.acc.open .acc-body { display: block; }
.acc-body b { color: var(--ink); }
.acc-body a { color: var(--mer); font-weight: 700; }

/* ---------- LEAFLET CUSTOM ---------- */
.poi-marker {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: 50% 50% 50% 4px;
  border: 2px solid #FFFDF8;
  box-shadow: 0 2px 6px rgba(30,42,56,.35);
  font-size: 14px;
  transform: rotate(0deg);
}
.poi-marker.dim { opacity: .25; filter: grayscale(.8); }
.iti-marker {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--brique);
  border: 2.5px solid #FFFDF8;
  color: #fff; font-weight: 700; font-size: 12px;
  font-family: var(--sans);
  box-shadow: 0 2px 8px rgba(30,42,56,.4);
}

.leaflet-popup-content-wrapper {
  background: #FFFDF8;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-family: var(--sans);
}
.leaflet-popup-content { margin: 12px 14px; }
.pp h3 { font-family: var(--serif); font-size: 16px; font-weight: 900; margin-bottom: 2px; }
.pp .pp-meta { font-size: 11px; color: var(--ink-soft); margin-bottom: 7px; }
.pp .stars { color: var(--brique); }
.pp .ds-btns { margin-top: 4px; }
.pp .btn { font-size: 11px; padding: 6px 9px; }

.map-hint {
  position: absolute;
  left: 50%; transform: translateX(-50%);
  bottom: 18px;
  background: rgba(30,42,56,.88);
  color: var(--paper);
  font-size: 12px;
  padding: 7px 16px;
  border-radius: 999px;
  z-index: 1000;
  pointer-events: none;
  transition: opacity .4s;
}

/* ---------- MOBILE ---------- */
@media (max-width: 880px) {
  body { overflow: auto; }
  .topbar { padding: 10px 14px; }
  .brand h1 { font-size: 19px; }
  .layout { flex-direction: column-reverse; }
  .panel {
    width: 100%; min-width: 0;
    height: 48vh;
    border-right: none;
    border-top: 2px solid var(--ink);
  }
  #map { height: 44vh; flex: none; }
  .detail-sheet {
    top: auto; bottom: 0; right: 0; left: 0;
    width: 100%; max-width: 100%;
    border-radius: 14px 14px 0 0;
    max-height: 62vh;
  }
  .trip-controls { gap: 7px; }
}
