/* Autobuses Córdoba – estilos */

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

:root {
  --hdr:       #3f5a1b;
  --accent:    #d29a25;
  --bg:        #ececec;
  --card:      #f7f7f4;
  --text:      #1c2a05;
  --text2:     #505340;
  --border:    #d8d8d2;
  --stop-ring: #3f5a1b;
  --terminal:  #f2b51e;
  --green:     #2d8a3e;
  --red:       #c42020;
}

html { font-size: 16px; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}

/* ── Skip to content (accesibilidad) ───────────────────── */
.skip-link {
  position: fixed;
  top: -100%;
  left: 1rem;
  background: var(--hdr);
  color: #fff;
  padding: .5rem 1rem;
  border-radius: 0 0 8px 8px;
  font-size: .9rem;
  font-weight: 600;
  z-index: 9999;
  text-decoration: none;
  transition: top .15s;
}
.skip-link:focus { top: 0; }

/* ── Splash screen ──────────────────────────────────────── */
.splash {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 35%, #5a7e2a 0%, #3f5a1b 55%, #2a3d12 100%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  color: #fff;
  overflow: hidden;
  transition: opacity .38s ease;
}
.splash::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 18% 22%, rgba(255,255,255,.10) 0 1px, transparent 2px),
    radial-gradient(circle at 78% 80%, rgba(255,255,255,.08) 0 1px, transparent 2px),
    radial-gradient(circle at 60% 18%, rgba(255,255,255,.06) 0 1px, transparent 2px);
  background-size: 22px 22px, 36px 36px, 28px 28px;
  opacity: .6;
  pointer-events: none;
}
.splash.fade-out {
  opacity: 0;
  pointer-events: none;
}
.splash-bus {
  width: 280px;
  height: auto;
  filter: drop-shadow(0 14px 22px rgba(0,0,0,.4));
  animation: busDrive 1400ms cubic-bezier(.2,.7,.2,1) both;
}
@keyframes busDrive {
  0%   { transform: translateX(-140%) rotate(-1.5deg); opacity: 0; }
  55%  { transform: translateX(6%)    rotate(0.8deg);  opacity: 1; }
  75%  { transform: translateX(-2%)   rotate(-0.4deg); }
  100% { transform: translateX(0)     rotate(0deg);    opacity: 1; }
}
.splash-bus .wheel {
  transform-box: fill-box;
  transform-origin: center;
  animation: wheelSpin 800ms linear infinite;
}
@keyframes wheelSpin { to { transform: rotate(360deg); } }
.splash-title {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: 700;
  font-size: 1.9rem;
  letter-spacing: .03em;
  color: #f6e2a8;
  text-shadow: 0 2px 0 rgba(0,0,0,.25);
  text-align: center;
  margin: 0;
  animation: titleIn 700ms ease 250ms both;
}
.splash-sub {
  font-size: .82rem;
  letter-spacing: .28em;
  color: rgba(255,255,255,.78);
  text-transform: uppercase;
  margin: -20px 0 0;
  animation: titleIn 700ms ease 420ms both;
}
@keyframes titleIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.splash-loader {
  display: flex;
  gap: 8px;
  animation: titleIn 700ms ease 600ms both;
}
.splash-loader span {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #f2b51e;
  animation: loaderBounce 900ms ease-in-out infinite;
}
.splash-loader span:nth-child(2) { animation-delay: 150ms; background: #f6e2a8; }
.splash-loader span:nth-child(3) { animation-delay: 300ms; background: #fff; }
@keyframes loaderBounce {
  0%, 80%, 100% { transform: translateY(0);    opacity: .4; }
  40%           { transform: translateY(-8px); opacity: 1; }
}

/* ── Header ─────────────────────────────────────────────── */
header {
  background: var(--hdr);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: env(safe-area-inset-top);
}
.header-bar {
  position: relative;
  display: flex;
  align-items: center;
  padding: .6rem .75rem;
  min-height: 52px;
}
.hdr-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .3rem .2rem;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
}
.hdr-btn:hover { color: #fff; }
.hdr-center {
  position: absolute;
  left: 0; right: 0;
  top: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
}
.hdr-title {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1;
}
.hdr-sub-inline {
  color: rgba(255,255,255,.6);
  font-size: .82rem;
  font-weight: 400;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.hdr-spacer { flex-shrink: 0; width: 48px; }

/* ── Botón y sección geolocalización ────────────────────── */
.locate-bar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: .5rem .9rem;
}
.locate-btn {
  align-items: center;
  background: none;
  border: 1.5px solid var(--hdr);
  border-radius: 20px;
  color: var(--hdr);
  cursor: pointer;
  display: flex;
  font-size: .82rem;
  font-weight: 600;
  gap: .4rem;
  justify-content: center;
  padding: .38rem .9rem;
  transition: background .1s, color .1s;
  width: 100%;
}
.locate-btn:hover  { background: #edf4ef; }
.locate-btn.active { background: var(--hdr); color: #fff; }
.locate-btn:disabled { opacity: .5; cursor: default; }

.nearby-header {
  align-items: center;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  padding: .5rem .9rem .4rem;
}
.nearby-title {
  color: var(--hdr);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.nearby-close {
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  font-size: 1rem;
  padding: .1rem .3rem;
}
.nearby-close:hover { color: var(--text); }
.nearby-card {
  align-items: center;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  gap: .75rem;
  padding: .7rem .9rem;
  transition: background .1s;
}
.nearby-card:hover { background: #f7f7f7; }
.nearby-dist {
  background: var(--hdr);
  border-radius: 6px;
  color: #fff;
  flex-shrink: 0;
  font-size: .72rem;
  font-weight: 700;
  min-width: 48px;
  padding: 3px 7px;
  text-align: center;
}
.nearby-name {
  color: var(--text);
  flex: 1;
  font-size: .9rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Sección favoritos ──────────────────────────────────── */
.favs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem .9rem .45rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.favs-title {
  color: var(--accent);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.lines-header {
  margin-top: .75rem;
  padding: .55rem .9rem .45rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.lines-title {
  color: var(--text2);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.favs-refresh-btn {
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  font-size: 1rem;
  padding: .1rem .3rem;
}
.favs-refresh-btn:hover { color: var(--text); }

.fav-card {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem .9rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .1s;
}
.fav-card:hover { background: #f7f7f7; }
.fav-card:last-child { border-bottom: 2px solid var(--border); }

.fav-card-body { flex: 1; min-width: 0; }
.fav-card-name {
  color: var(--text);
  font-size: .9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fav-card-buses {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .35rem;
}
.fav-bus-chip {
  display: flex;
  align-items: center;
  gap: .25rem;
  background: var(--bg);
  border-radius: 6px;
  padding: 2px 6px 2px 3px;
}
.fav-bus-num {
  border-radius: 4px;
  color: #fff;
  font-size: .68rem;
  font-weight: 800;
  padding: 2px 5px;
}
.fav-bus-mins {
  color: var(--text);
  font-size: .78rem;
  font-weight: 600;
}
.fav-card-star {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 1.1rem;
  flex-shrink: 0;
  padding: .2rem .3rem;
  opacity: .7;
}
.fav-card-star:hover { opacity: 1; }
.fav-loading { color: var(--text2); font-size: .75rem; }
.fav-no-buses { color: var(--text2); font-size: .75rem; }

/* ── Search bar ─────────────────────────────────────────── */
.search-wrapper {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: .6rem .9rem;
  gap: .55rem;
}
.search-icon { color: var(--text2); font-size: 1.1rem; flex-shrink: 0; }
.search-wrapper input {
  background: none;
  border: none;
  color: var(--text);
  flex: 1;
  font-size: .95rem;
  outline: none;
}
.search-wrapper input::placeholder { color: var(--text2); }

/* ── QR button in search bar ────────────────────────────── */
.qr-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: .2rem;
}
.qr-btn:hover { opacity: .75; }

/* ── QR Scanner overlay ─────────────────────────────────── */
.qr-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: env(safe-area-inset-top);
}
.qr-overlay.hidden { display: none; }
.qr-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: .65rem .75rem;
}
.qr-close {
  background: rgba(255,255,255,.12);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
}
.qr-title { color: #fff; font-size: .95rem; font-weight: 600; }
.qr-viewport {
  position: relative;
  width: min(85vw, 320px);
  aspect-ratio: 1;
  margin: 1.5rem auto;
}
.qr-viewport video {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 12px;
}
.qr-frame {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.55);
  border: 2px solid rgba(255,255,255,.6);
  pointer-events: none;
}
.qr-frame::before, .qr-frame::after,
.qr-frame > span::before, .qr-frame > span::after {
  content: '';
  position: absolute;
  width: 22px; height: 22px;
  border-color: #fff;
  border-style: solid;
}
.qr-hint  { color: rgba(255,255,255,.75); font-size: .9rem; text-align: center; }
.qr-status { color: #fff; font-size: .85rem; font-weight: 600; min-height: 1.2em; text-align: center; }

/* ── Generic item list ──────────────────────────────────── */
.item-list { list-style: none; background: var(--card); }

.item-list li {
  background: linear-gradient(to bottom, #ffffff, #f6f6f6);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: background .1s;
}
.item-list li:last-child { border-bottom: none; }
.item-list li:hover, .item-list li.active { background: #f7f7f7; }

/* ── Line item (accordion) ──────────────────────────────── */
.item-list li.line-item {
  display: block;
  cursor: default;
}

.line-num {
  align-items: center;
  color: #fff;
  display: flex;
  flex-shrink: 0;
  font-size: 1.05rem;
  font-weight: 800;
  justify-content: center;
  min-height: 54px;
  width: 58px;
}
.line-label {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  padding: .8rem .75rem;
  text-transform: uppercase;
  letter-spacing: .02em;
  color: var(--text);
}
.item-chevron {
  color: var(--border);
  font-size: 1.5rem;
  font-weight: 300;
  padding: 0 .75rem;
  line-height: 1;
}

/* Stop item (within a line) */
.stop-circle-wrap {
  position: relative;
  width: 52px;
  flex-shrink: 0;
  align-self: stretch;
  overflow: hidden;
}
.stop-circle-wrap::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0; bottom: 0;
  width: 7px;
  background: var(--stop-ring);
  transform: translateX(-50%);
}
#stopsList li:only-child  .stop-circle-wrap::before { display: none; }
#stopsList li:first-child .stop-circle-wrap::before { top: 50%; }
#stopsList li:last-child  .stop-circle-wrap::before { bottom: 50%; }
.stop-circle {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 5px solid var(--stop-ring);
  background: #fff;
  z-index: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.stop-circle.terminal {
  width: 30px; height: 30px;
  background: var(--terminal);
  border-color: var(--stop-ring);
}
.stop-chevron {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--stop-ring);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  flex-shrink: 0;
  margin-right: .75rem;
}

.stop-info { flex: 1 1 0; overflow: hidden; padding: .75rem .5rem; }
.stop-label {
  color: var(--text);
  font-size: .95rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Separación entre filas — sin gap para no cortar la línea verde */
#stopsList li {
  background: linear-gradient(to right, #eff7ed, #ffffff);
  border-bottom: none;
  overflow: hidden;
}
#stopsList li:last-child { border-bottom: none; }

/* Generic stop badge (search results) */
.stop-num {
  background: var(--accent);
  border-radius: 5px;
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  min-width: 2.6rem;
  padding: 4px 8px;
  text-align: center;
  flex-shrink: 0;
  margin: 0 .75rem;
}
.stop-name { flex: 1; font-size: .97rem; padding: .72rem 0; }

.list-loading {
  color: var(--text2);
  font-size: .88rem;
  padding: 1.2rem 1rem;
  cursor: default !important;
  background: none !important;
}
.hint-text {
  color: var(--text2);
  font-size: .85rem;
  padding: 1.5rem 1rem;
  text-align: center;
}

/* ── Line accordion (lines view) ────────────────────────── */
li.line-item {
  display: block;
  cursor: default;
  padding: 0;
}
li.line-item:hover { background: var(--card); }

.line-row-header {
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: background .1s;
}
.line-row-header:hover { background: #f5f5f5; }
.line-row-header.expanded { background: #f0f0f0; }

.line-toggle {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #3a3a3a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 300;
  flex-shrink: 0;
  margin-right: .85rem;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

.dir-sublist {
  background: linear-gradient(to bottom, #ffffff, #e0e0e0);
}
.dir-subrow {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .85rem .75rem .85rem .75rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  border-left: 4px solid transparent;
  transition: background .1s;
  background: transparent;
}
.dir-subrow:last-child { border-bottom: none; }
.dir-subrow:hover { background: rgba(0,0,0,.05); }
.dir-arrow {
  color: var(--accent);
  flex-shrink: 0;
}
.dir-sub-dest {
  flex: 1;
  color: var(--text);
  font-size: .9rem;
  font-weight: 600;
}
.dir-sub-chevron {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1.5px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aaa;
  font-size: 1rem;
  flex-shrink: 0;
}

/* ── Line banner (stops view) ───────────────────────────── */
.line-banner { display: flex; align-items: center; }
.line-banner-badge {
  align-items: center;
  color: #fff;
  display: flex;
  font-size: 1.05rem;
  font-weight: 800;
  justify-content: center;
  min-height: 52px;
  width: 58px;
  background: rgba(0,0,0,.2);
  flex-shrink: 0;
}
.line-banner-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .22rem;
  padding: .45rem .65rem;
}
.line-banner-name {
  color: #fff;
  font-size: .85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.dir-pill {
  align-self: flex-start;
  background: rgba(255,255,255,.22);
  border: none;
  border-radius: 20px;
  color: #fff;
  cursor: pointer;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .06em;
  padding: .18rem .55rem;
  text-transform: uppercase;
  transition: background .15s;
}
.dir-pill:hover         { background: rgba(255,255,255,.38); }
.dir-pill.no-toggle     { cursor: default; pointer-events: none; }

/* ── Stop banner (times view) ───────────────────────────── */
.stop-banner {
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .65rem .9rem;
  gap: .5rem;
}
.stop-banner-name { color: #fff; font-size: .9rem; font-weight: 700; flex: 1; }
.stop-banner-right { display: flex; align-items: center; gap: .45rem; flex-shrink: 0; }
.icon-btn-dark {
  background: rgba(0,0,0,.18);
  border: none;
  border-radius: 50%;
  color: rgba(255,255,255,.85);
  cursor: pointer;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.icon-btn-dark:hover { background: rgba(0,0,0,.3); }

/* ── Arrivals ───────────────────────────────────────────── */
#timesContent { display: flex; flex-direction: column; gap: 1px; background: var(--border); }
.line-section  { background: var(--card); }

.line-header {
  color: #fff;
  display: flex;
  align-items: stretch;
  min-height: 50px;
}
.line-badge {
  align-items: center;
  background: rgba(0,0,0,.2);
  color: #fff;
  display: flex;
  flex-shrink: 0;
  font-size: 1.05rem;
  font-weight: 800;
  justify-content: center;
  padding: 0 .75rem;
  min-width: 52px;
}
.line-route {
  color: rgba(255,255,255,.9);
  flex: 1;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .04em;
  padding: .65rem .65rem;
  text-transform: uppercase;
  align-self: center;
}
.time-row {
  align-items: center;
  border-left: 4px solid var(--accent);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  padding: .72rem .9rem;
}
.time-row:last-child { border-bottom: none; }
.time-label { color: var(--text2); font-size: .85rem; }
.time-mins  { font-size: 1.05rem; font-weight: 800; }
.time-now   { animation: now-pulse 1s ease-in-out infinite; }
@keyframes now-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .35; }
}

.no-buses { color: var(--text2); font-size: .9rem; padding: 1.5rem; text-align: center; background: var(--card); }
.loading   { color: var(--text2); font-size: .9rem; padding: 1.5rem; text-align: center; background: var(--card); }

/* ── Empty states ───────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  padding: 2.8rem 1.5rem;
  text-align: center;
  background: var(--card);
}
.empty-state-icon { color: var(--border); }
.empty-state-title { color: var(--text2); font-size: .95rem; font-weight: 600; margin: 0; }
.empty-state-sub   { color: var(--text2); font-size: .8rem; opacity: .75; margin: 0; max-width: 22ch; line-height: 1.4; }

/* ── Banner instalar PWA ────────────────────────────────── */
.install-banner {
  position: fixed;
  bottom: calc(64px + env(safe-area-inset-bottom, 0px)); /* encima del ad-slot */
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 456px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .65rem .75rem;
  z-index: 150;
  animation: banner-up .3s ease;
}
@keyframes banner-up {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.ios-banner { bottom: 72px; }
.install-banner-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
}
.install-banner-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.install-banner-text strong {
  font-size: 1rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.install-banner-text span {
  font-size: .85rem;
  color: var(--text2);
}
.install-banner-btn {
  background: var(--hdr);
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 700;
  padding: .5rem .95rem;
  flex-shrink: 0;
  white-space: nowrap;
}
.install-banner-btn:hover { opacity: .88; }
.install-banner-dismiss {
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  font-size: 1rem;
  padding: .2rem;
  flex-shrink: 0;
  line-height: 1;
}
.install-banner-dismiss:hover { color: var(--text); }

/* ── Ad slot (fijo en pie de pantalla) ───────────────────── */
.ad-slot {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(64px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overflow: hidden;
  z-index: 100;
}
.ad-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 320px;
  height: 50px;
  border: 1px dashed #ccc;
  border-radius: 4px;
  background: #f9f9f9;
  gap: 2px;
}
.ad-placeholder-label {
  color: #bbb;
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.ad-placeholder-size {
  color: #ccc;
  font-size: .6rem;
}

.ad-banner {
  display: flex;
  align-items: center;
  gap: .65rem;
  width: 320px;
  height: 50px;
  padding: 0 .75rem 0 .65rem;
  background: linear-gradient(100deg, #6b1010 0%, #9b2a10 60%, #b84010 100%);
  border-radius: 8px;
  text-decoration: none;
  color: #fff;
  overflow: hidden;
  position: relative;
  transition: filter .15s;
}
.ad-banner:hover { filter: brightness(1.1); }
.ad-banner-escudo { font-size: 1.45rem; flex-shrink: 0; line-height: 1; }
.ad-banner-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.ad-banner-title {
  font-size: .8rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
}
.ad-banner-sub {
  font-size: .65rem;
  color: rgba(255,255,255,.72);
  white-space: nowrap;
}
.ad-banner-cta {
  font-size: .72rem;
  font-weight: 700;
  color: #ffd080;
  flex-shrink: 0;
  white-space: nowrap;
}
.ad-banner-label {
  position: absolute;
  top: 3px;
  right: 5px;
  font-size: .48rem;
  color: rgba(255,255,255,.4);
  text-transform: uppercase;
  letter-spacing: .06em;
  pointer-events: none;
}

/* ── Admin ──────────────────────────────────────────────── */
.admin-section {
  background: var(--card);
  border-top: 3px solid var(--hdr);
  margin-top: 1.5rem;
}
.admin-section details > summary {
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  padding: .75rem 1rem;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--hdr);
}
.admin-section details > summary::-webkit-details-marker { display: none; }
.admin-section details[open] > summary { border-bottom: 1px solid var(--border); }
.admin-body { padding: 1rem; display: flex; flex-direction: column; gap: .9rem; }
.admin-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.btn {
  border: none; border-radius: 6px; cursor: pointer;
  font-size: .85rem; font-weight: 600; padding: .45rem .9rem; transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn-primary   { background: var(--hdr); color: #fff; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-success   { background: var(--green); color: #fff; }
.btn-danger    { background: var(--red); color: #fff; font-size: .78rem; padding: 3px 8px; }
.btn-warning   { background: #c88000; color: #fff; font-size: .78rem; padding: 3px 8px; }
.admin-message { border-radius: 6px; font-size: .85rem; padding: .55rem .85rem; }
.admin-message.success { background: #d4f0db; border: 1px solid var(--green); color: #1a5028; }
.admin-message.error   { background: #f8d8d8; border: 1px solid var(--red);   color: #8a1010; }
.add-stop-form { border: 1px solid var(--border); border-radius: 6px; padding: .8rem; }
.add-stop-form legend { color: var(--text2); font-size: .82rem; font-weight: 600; padding: 0 .35rem; }
.form-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; align-items: flex-end; }
.form-row label { display: flex; flex-direction: column; font-size: .75rem; color: var(--text2); gap: 3px; }
.form-row input {
  background: var(--bg); border: 1px solid var(--border); border-radius: 5px;
  color: var(--text); font-size: .85rem; padding: .35rem .65rem; width: 110px; outline: none;
}
.form-row input:focus { border-color: var(--accent); }
.admin-filter {
  background: var(--bg); border: 1px solid var(--border); border-radius: 5px;
  color: var(--text); font-size: .85rem; margin-bottom: .5rem; outline: none;
  padding: .35rem .65rem; width: 100%;
}
#stopsTable { width: 100%; border-collapse: collapse; font-size: .82rem; }
#stopsTable th {
  color: var(--text2); font-size: .72rem; font-weight: 700; letter-spacing: .05em;
  padding: .4rem .55rem; text-align: left; text-transform: uppercase;
  border-bottom: 2px solid var(--border);
}
#stopsTable td { padding: .4rem .55rem; border-bottom: 1px solid var(--border); }
#stopsTable tr.inactive td { color: var(--text2); }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 3px; }
.status-dot.on  { background: var(--green); }
.status-dot.off { background: var(--red); }

/* ── Footer ─────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  color: var(--text2);
  font-size: .72rem;
  margin-top: auto;
  padding: .9rem;
  text-align: center;
}
footer a { color: var(--hdr); text-decoration: none; }
footer a:hover { text-decoration: underline; }
footer p + p { margin-top: .25rem; }

/* ── Modal de contacto ──────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
  animation: fadeIn .15s ease;
}
.modal-box {
  background: var(--card);
  border-radius: 14px;
  padding: 1.5rem;
  width: 100%;
  max-width: 420px;
  position: relative;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
  animation: slideUp .18s ease;
}
.modal-close {
  position: absolute;
  top: .6rem; right: .7rem;
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text2);
  padding: .25rem .4rem;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
}
.contact-form { display: flex; flex-direction: column; gap: .7rem; }
.contact-form label {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text2);
}
.contact-form input,
.contact-form textarea {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: .55rem .7rem;
  font-size: .9rem;
  color: var(--text);
  background: var(--bg);
  font-family: inherit;
  width: 100%;
}
.contact-form input:focus,
.contact-form textarea:focus { outline: none; border-color: var(--accent); }
.contact-form textarea { resize: vertical; min-height: 90px; }
.contact-error { color: #c00; font-size: .8rem; margin-top: -.2rem; }
.modal-submit {
  background: var(--hdr);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: .65rem;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  margin-top: .15rem;
}
.modal-submit:hover { opacity: .88; }
@keyframes fadeIn  { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { transform: translateY(16px); opacity: 0 } to { transform: none; opacity: 1 } }

/* ── Utils ──────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Animaciones de vista (slide) ───────────────────────── */
@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(44px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slide-in-left {
  from { opacity: 0; transform: translateX(-44px); }
  to   { opacity: 1; transform: translateX(0); }
}
.slide-in-right { animation: slide-in-right .23s cubic-bezier(.25,.46,.45,.94) both; }
.slide-in-left  { animation: slide-in-left  .23s cubic-bezier(.25,.46,.45,.94) both; }

/* ── Skeleton shimmer ───────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
    var(--border) 0%, var(--bg) 50%, var(--border) 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: 4px;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Skeleton rows ──────────────────────────────────────── */
.skeleton-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem;
  border-bottom: 1px solid var(--border);
  pointer-events: none;
}
.sk-badge   { width: 46px; height: 46px; border-radius: 6px; flex-shrink: 0; }
.sk-circle  { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.sk-label   { flex: 1; height: 14px; border-radius: 6px; }
.sk-chevron { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; }

/* ── Time urgency ───────────────────────────────────────── */
.time-row--urgent { background: rgba(22,163,74,.06); }

/* ── Toast ──────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.82);
  color: #fff;
  border-radius: 20px;
  padding: .5rem 1.2rem;
  font-size: .85rem;
  z-index: 300;
  white-space: nowrap;
  animation: toast-in .2s ease;
  transition: opacity .3s;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.toast-out { opacity: 0; }

@media (min-width: 481px) { body { box-shadow: 0 0 30px rgba(0,0,0,.1); } }
@media (max-width: 480px) {
  .form-row input { width: 100%; }
  .form-row { flex-direction: column; }
}

/* ── Cookie banner ──────────────────────────────────────────── */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: .75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .75rem;
  z-index: 400;
  box-shadow: 0 -2px 8px rgba(0,0,0,.08);
}
.cookie-banner-text {
  flex: 1;
  font-size: .82rem;
  line-height: 1.5;
  color: var(--text2);
  min-width: 160px;
}
.cookie-banner-text strong { color: var(--text); }
.cookie-banner-text a      { color: var(--hdr); text-decoration: underline; }
.cookie-banner-btns        { display: flex; gap: .5rem; flex-shrink: 0; }
.cookie-btn {
  border: none;
  border-radius: 7px;
  padding: .45rem .9rem;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.cookie-btn-accept { background: var(--hdr); color: #fff; }
.cookie-btn-accept:hover { opacity: .88; }
.cookie-btn-reject { background: var(--border); color: var(--text); }
.cookie-btn-reject:hover { filter: brightness(.92); }

/* ── Dark mode ──────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0f0f0f;
    --card:      #1c1c1c;
    --text:      #e8e8e8;
    --text2:     #9a9a9a;
    --border:    #303030;
    --stop-ring: #5a7a2e;
    --terminal:  #f2b51e;
  }

  /* desktop shadow */
  @media (min-width: 481px) { body { box-shadow: 0 0 30px rgba(0,0,0,.4); } }

  /* list rows */
  .item-list li                 { background: linear-gradient(to bottom, #1e1e1e, #191919); }
  #stopsList li                 { background: linear-gradient(to right, #18221a, #1a1a1a); }

  /* list hover */
  .item-list li:hover,
  .item-list li.active          { background: #252525; }
  .line-row-header:hover        { background: #252525; }
  .line-row-header.expanded     { background: #222222; }

  /* accordion sub-rows */
  .dir-sublist                  { background: linear-gradient(to bottom, #1e1e1e, #111111); }
  .dir-subrow:hover             { background: rgba(255,255,255,.06); }
  .line-toggle                  { background: #e0e0e0; color: #111; }
  .dir-sub-chevron { border-color: #444; color: #555; }
  .stop-chevron { background: var(--stop-ring); }

  /* nearby & fav cards */
  .nearby-card:hover            { background: #252525; }
  .fav-card:hover               { background: #252525; }

  /* locate button hover */
  .locate-btn:hover             { background: #1a2e1f; }

  /* install banner */
  .install-banner               { background: #1c1c1c; border-color: #383838; }

  /* ad placeholder */
  .ad-placeholder               { background: #1c1c1c; border-color: #383838; }
  .ad-placeholder-label         { color: #555; }
  .ad-placeholder-size          { color: #444; }

  /* admin messages */
  .admin-message.success        { background: #0f2e16; border-color: #1a5028; color: #5fcf7f; }
  .admin-message.error          { background: #2e0f0f; border-color: #8a1010; color: #e07070; }

  /* form inputs */
  .form-row input,
  .admin-filter                 { background: #252525; border-color: #383838; }

  /* cookie banner */
  .cookie-banner                { background: #1c1c1c; border-color: #383838; }
  .cookie-banner-text           { color: #ccc; }
  .cookie-banner-text a         { color: #7fcfa0; }
  .cookie-btn-reject            { background: #2a2a2a; color: #ccc; }
  .cookie-btn-reject:hover      { background: #333; }
}
