/**
 * lines.css — Estilos para as páginas de listagem e detalhe de Linhas do Porto
 */

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

html, body {
  width: 100%;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f2f4f7;
  color: #1a1a2e;
  -webkit-font-smoothing: antialiased;
}

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 680px;
  margin: 0 auto;
  background: #f2f4f7;
  padding-bottom: 60px;
}

/* ── Header (lines.html) ── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 50px;
  background: #fff;
  border-bottom: 1px solid #e5e8ee;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: var(--color-primary);
  font-weight: 600;
  font-size: 13.5px;
  flex-shrink: 0;
}
.header-logo img { height: 24px; width: auto; }
.header-title {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a2e;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}
.header-spacer { width: 80px; flex-shrink: 0; }

/* ── Header (line-detail.html) ── */
.header .back-btn {
  display: flex;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  color: var(--color-primary);
  font-size: 15px;
  font-weight: 500;
  padding: 8px 10px 8px 6px;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .15s;
}
.header .back-btn:hover { background: #eef5fb; }
.header .back-btn svg { width: 20px; height: 20px; flex-shrink: 0; }

/* ── Search ── */
.search-wrap {
  padding: 8px 12px;
  background: #fff;
  border-bottom: 1px solid #e5e8ee;
}
.search-box {
  display: flex;
  align-items: center;
  background: #f2f4f7;
  border: 1.5px solid #e2e5ec;
  border-radius: 9px;
  padding: 0 10px;
  gap: 7px;
  height: 36px;
  transition: border-color .15s, box-shadow .15s;
}
.search-box:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0,114,198,.1);
  background: #fff;
}
.search-icon { width: 15px; height: 15px; color: #9ba4b4; flex-shrink: 0; }
.search-input {
  flex: 1; border: none; background: transparent;
  font-size: 14px; color: #1a1a2e; outline: none; min-width: 0;
}
.search-input::placeholder { color: #9ba4b4; }
.search-clear {
  display: none; align-items: center; justify-content: center;
  width: 22px; height: 22px; border: none; background: none;
  cursor: pointer; color: #9ba4b4; flex-shrink: 0;
  border-radius: 50%; transition: background .15s, color .15s;
}
.search-clear:hover { background: #e5e8ee; color: #333; }
.search-clear svg { width: 12px; height: 12px; }

/* ── Section label ── */
.section-label {
  font-size: 11px;
  font-weight: 600;
  color: #9ba4b4;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 10px 14px 4px;
  background: #f2f4f7;
}

/* ── Lines list ── */
.lines-list { flex: 1; list-style: none; }
.line-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 14px;
  height: 50px;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border-bottom: 1px solid #f0f2f6;
  transition: background .13s;
  cursor: pointer;
}
.line-item:first-child { border-top: 1px solid #f0f2f6; }
.line-item:hover  { background: #f5f8ff; }
.line-item:active { background: #eaf1fb; }
.badge {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 28px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 700;
  padding: 0 7px;
  flex-shrink: 0;
  letter-spacing: .01em;
}
.line-name {
  flex: 1;
  font-size: 14px;
  color: #1a1a2e;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.arrow { width: 14px; height: 14px; color: #c8cdd8; flex-shrink: 0; }
.empty {
  text-align: center;
  padding: 48px 20px;
  color: #9ba4b4;
  font-size: 15px;
  list-style: none;
}

/* ── Spinner ── */
.spinner-wrap {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; padding: 56px 20px;
  color: #9ba4b4; font-size: 14px;
}
.spinner {
  width: 28px; height: 28px;
  border: 3px solid #e5e8ee;
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 20px 16px 14px;
  font-size: 12px;
  color: #9ba4b4;
}
.footer a { color: var(--color-primary); text-decoration: none; font-weight: 500; }
.footer a:hover { text-decoration: underline; }

/* ── Hero (line-detail.html) ── */
.hero {
  background: var(--rc, #187EC2);
  padding: 14px 16px 16px;
}
.hero-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.hero-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  height: 36px;
  background: rgba(255,255,255,.2);
  border: 2px solid rgba(255,255,255,.38);
  border-radius: 10px;
  font-size: 19px;
  font-weight: 800;
  color: #fff;
  padding: 0 10px;
  flex-shrink: 0;
}
.hero-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
  flex: 1;
  min-width: 0;
}
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(255,255,255,.17);
  border: 1.5px solid rgba(255,255,255,.38);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
  font-family: inherit;
}
.hero-btn:hover {
  background: rgba(255,255,255,.3);
  border-color: rgba(255,255,255,.6);
}
.hero-btn svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ── States (loading / error) ── */
.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 56px 20px;
  font-size: 14px;
  color: #9ba4b4;
  text-align: center;
}
.err-icon { width: 34px; height: 34px; color: #e05c5c; }
.err-msg  { color: #c0392b; font-size: 14px; max-width: 280px; }

/* ── Timeline ── */
:root { --tl-w: 48px; }

.stops {
  list-style: none;
  padding: 0;
  background: #fff;
  margin-top: 2px;
}

.stop {
  display: flex;
  align-items: stretch;
  position: relative;
}

.tl {
  position: relative;
  width: var(--tl-w);
  flex-shrink: 0;
  display: flex;
  justify-content: center;
}
.tl::before {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  background: var(--line-color, #187EC2);
  opacity: .3;
  top: 0;
  bottom: 0;
}
.stop-first .tl::before { top: 50%; }
.stop-last  .tl::before { bottom: 50%; }

.dot {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--line-color, #187EC2);
  z-index: 1;
}
.dot-lg { width: 15px; height: 15px; border-width: 2.5px; }

.bus-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--line-color, #187EC2);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.bus-icon svg { width: 15px; height: 15px; color: #fff; display: block; }

.stop-link {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 13px 14px 13px 4px;
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
  margin: 0 8px 0 0;
  transition: background .13s;
  min-width: 0;
  min-height: 50px;
}
.stop-link:hover  { background: #f4f7ff; }
.stop-link:active { background: #e8f0fb; }

.stop-name {
  font-size: 14px;
  font-weight: 500;
  color: #1a1a2e;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stop-first .stop-name,
.stop-last  .stop-name { font-weight: 700; }

.stop-code {
  font-size: 11px;
  font-weight: 600;
  color: #7a8499;
  background: #f0f2f6;
  padding: 2px 6px;
  border-radius: 5px;
  letter-spacing: .03em;
  flex-shrink: 0;
  margin-left: 8px;
}
.stop-zone {
  font-size: 11px;
  color: #b0b8c8;
  flex-shrink: 0;
  margin-left: 6px;
  white-space: nowrap;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .header-title { font-size: 15px; }
  .line-item { padding: 0 12px; gap: 9px; height: 46px; }
  .badge { min-width: 44px; height: 26px; font-size: 13px; }
  .line-name { font-size: 13.5px; }
  .hero { padding: 12px 12px 14px; }
  .hero-badge { font-size: 17px; min-width: 48px; height: 32px; }
  .hero-name { font-size: 14.5px; }
  .stop-name { font-size: 13px; }
  :root { --tl-w: 40px; }
}
