/* css/app.css — AutoCheck PE · Mobile-first */

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

:root {
  --navy:      #0a1628;
  --navy-mid:  #112240;
  --navy-lite: #1a2f50;
  --accent:    #1d9e75;
  --accent-bg: #e1f5ee;
  --accent-dk: #085041;
  --amber:     #EF9F27;
  --amber-bg:  #FAEEDA;
  --amber-dk:  #633806;
  --red:       #E24B4A;
  --red-bg:    #FCEBEB;
  --red-dk:    #791F1F;
  --blue:      #378ADD;
  --blue-bg:   #E6F1FB;
  --blue-dk:   #0C447C;
  --text:      #1a1a2e;
  --text-dim:  #64748b;
  --border:    rgba(0,0,0,0.09);
  --surface:   #ffffff;
  --bg:        #f4f6fa;
  --radius:    12px;
  --radius-sm: 8px;
}

html { font-size: 16px; }
body {
  font-family: 'Sora', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

/* ── APP WRAPPER ── */
.app { max-width: 430px; margin: 0 auto; padding-bottom: 40px; }

/* ── HEADER ── */
.header {
  background: var(--navy);
  padding: 20px 20px 36px;
  position: relative;
  overflow: hidden;
}
.header::before {
  content: '';
  position: absolute;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(29,158,117,.2) 0%, transparent 70%);
  top: -60px; right: -60px;
  pointer-events: none;
}
.logo { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.logo-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-name { font-size: 16px; font-weight: 600; color: white; line-height: 1; }
.logo-name span { color: var(--accent); }
.logo-sub { font-size: 11px; color: rgba(255,255,255,.45); margin-top: 2px; }
.header h1 { font-size: 22px; font-weight: 600; color: white; margin-bottom: 4px; line-height: 1.2; }
.header-desc { font-size: 13px; color: rgba(255,255,255,.5); }

/* ── SEARCH ── */
.search-wrapper { padding: 0 14px; margin-top: -22px; margin-bottom: 8px; }
.search-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0,0,0,.12);
  display: flex; align-items: center;
  overflow: hidden;
}
.plate-flag {
  display: flex; flex-direction: column;
  height: 58px; width: 28px; flex-shrink: 0;
}
.peru-band { flex: 1; display: flex; align-items: center; justify-content: center; }
.peru-band.red   { background: #D91023; }
.peru-band.white { background: white; }
.peru-band.white span { font-size: 8px; font-weight: 700; color: #D91023; letter-spacing: .5px; }
.plate-input {
  flex: 1;
  border: none; outline: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px; font-weight: 500;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--text);
  padding: 0 8px;
  height: 58px;
  background: white;
}
.plate-input::placeholder { font-size: 16px; letter-spacing: 2px; color: #b0b8c8; font-weight: 400; }
.btn-search {
  background: var(--accent);
  color: white;
  border: none;
  height: 58px;
  padding: 0 18px;
  display: flex; align-items: center; gap: 6px;
  font-family: 'Sora', sans-serif;
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.btn-search:active { opacity: .85; transform: scale(.97); }
.search-hint { text-align: center; font-size: 12px; color: var(--text-dim); margin-top: 8px; }
.search-hint strong { color: var(--text); }

/* ── LOADING ── */
.loading-state { padding: 32px 20px; text-align: center; }
.loading-spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(29,158,117,.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-title { font-size: 15px; font-weight: 500; margin-bottom: 20px; color: var(--text); }
.loading-steps { max-width: 280px; margin: 0 auto; text-align: left; }
.lstep {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.lstep:last-child { border-bottom: none; }
.lstep-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #d1d5db; flex-shrink: 0;
  transition: background .3s;
}
.lstep.active .lstep-dot   { background: var(--amber); animation: pulse .8s infinite; }
.lstep.done   .lstep-dot   { background: var(--accent); }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.3); } }
.lstep-info { flex: 1; }
.lstep-name { font-size: 13px; font-weight: 500; display: block; }
.lstep-url  { font-size: 11px; color: var(--text-dim); }
.lstep-badge { font-size: 11px; color: var(--text-dim); }
.lstep.active .lstep-badge { color: var(--amber); }
.lstep.done   .lstep-badge { color: var(--accent); }

/* ── EMPTY STATE ── */
.empty-state { padding: 40px 24px; text-align: center; }
.empty-icon { margin-bottom: 12px; }
.empty-state p { font-size: 14px; color: var(--text-dim); line-height: 1.5; }
.feature-pills { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 16px; }
.fpill { font-size: 12px; background: var(--surface); color: var(--text-dim);
  padding: 5px 12px; border-radius: 20px; border: 1px solid var(--border); }

/* ── ERROR STATE ── */
.error-state { padding: 32px 20px; text-align: center; }
.error-icon { font-size: 36px; margin-bottom: 10px; }
.error-state p { font-size: 14px; color: var(--text-dim); margin-bottom: 16px; }
.btn-retry {
  background: var(--surface); border: 1px solid var(--border);
  padding: 10px 24px; border-radius: var(--radius-sm);
  font-family: 'Sora', sans-serif; font-size: 14px; cursor: pointer;
}

/* ── VEHICLE CARD ── */
.veh-card {
  margin: 12px 14px 0;
  background: var(--navy);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.veh-card::after {
  content: '';
  position: absolute;
  bottom: -30px; right: -20px;
  width: 100px; height: 100px;
  background: rgba(255,255,255,.03);
  border-radius: 50%;
}
.veh-semaforo {
  position: absolute; top: 16px; right: 16px;
  width: 10px; height: 10px; border-radius: 50%;
}
.veh-semaforo.verde   { background: #1d9e75; box-shadow: 0 0 8px rgba(29,158,117,.6); }
.veh-semaforo.amarillo{ background: var(--amber); box-shadow: 0 0 8px rgba(239,159,39,.6); }
.veh-semaforo.rojo    { background: var(--red); box-shadow: 0 0 8px rgba(226,75,74,.6); }
.plate-tag {
  display: inline-block;
  background: #FAC775; color: #633806;
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px; font-weight: 500;
  letter-spacing: 3px;
  padding: 4px 12px; border-radius: 6px;
  margin-bottom: 10px;
}
.veh-nombre { font-size: 22px; font-weight: 600; color: white; }
.veh-detalle { font-size: 13px; color: rgba(255,255,255,.5); margin: 3px 0 12px; }
.veh-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.vtag { font-size: 11px; font-weight: 500; padding: 4px 10px; border-radius: 20px; }
.vtag-green  { background: rgba(29,158,117,.25); color: #5DCAA5; }
.vtag-amber  { background: rgba(239,159,39,.2);  color: #FAC775; }
.vtag-red    { background: rgba(226,75,74,.2);   color: #F09595; }
.vtag-blue   { background: rgba(55,138,221,.2);  color: #85B7EB; }

/* ── SEMAFORO BOX ── */
.semaforo-resumen {
  margin: 10px 14px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
}
.semaforo-resumen.verde   { background: var(--accent-bg); color: var(--accent-dk); }
.semaforo-resumen.amarillo{ background: var(--amber-bg);  color: var(--amber-dk); }
.semaforo-resumen.rojo    { background: var(--red-bg);    color: var(--red-dk); }

/* ── TABS ── */
.tabs-nav {
  display: flex; margin: 10px 14px 0;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 4px; gap: 3px;
}
.tnav {
  flex: 1; text-align: center;
  padding: 8px 4px; font-size: 12px; font-weight: 500;
  color: var(--text-dim); border: none; background: transparent;
  border-radius: 6px; cursor: pointer;
  font-family: 'Sora', sans-serif;
  transition: all .15s;
}
.tnav.active { background: var(--navy); color: white; }

.tab-panel { display: none; padding: 12px 14px 0; }
.tab-panel.active { display: block; }

/* ── INFO GRID (stats) ── */
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-bottom: 12px; }
.istat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.istat-label { font-size: 11px; color: var(--text-dim); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 5px; }
.istat-value { font-size: 18px; font-weight: 600; color: var(--text); }
.istat-value.ok   { color: var(--accent); }
.istat-value.warn { color: var(--amber);  }
.istat-value.bad  { color: var(--red);    }

/* ── INFO LIST ── */
.info-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden; margin-bottom: 12px;
}
.irow {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.irow:last-child { border-bottom: none; }
.irow-key { color: var(--text-dim); }
.irow-val { font-weight: 500; text-align: right; color: var(--text); }

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 20px; }
.badge-ok   { background: var(--accent-bg); color: var(--accent-dk); }
.badge-warn { background: var(--amber-bg);  color: var(--amber-dk); }
.badge-bad  { background: var(--red-bg);    color: var(--red-dk); }

/* ── TIMELINE ── */
.timeline-wrap { padding-bottom: 8px; }
.tl-item { display: flex; gap: 12px; padding: 0 0 20px; }
.tl-left { display: flex; flex-direction: column; align-items: center; }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); flex-shrink: 0; margin-top: 3px; border: 2px solid white; box-shadow: 0 0 0 2px var(--accent); }
.tl-dot.past { background: #d1d5db; box-shadow: 0 0 0 2px #d1d5db; }
.tl-line { flex: 1; width: 1px; background: var(--border); margin-top: 4px; }
.tl-item:last-child .tl-line { display: none; }
.tl-body { flex: 1; }
.tl-name { font-size: 14px; font-weight: 500; color: var(--text); }
.tl-sub  { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.tl-date { font-size: 11px; color: var(--text-dim); margin-top: 3px; }

/* ── PAPELETAS ── */
.papeleta-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px;
}
.papeleta-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.papeleta-num { font-size: 12px; font-family: 'JetBrains Mono', monospace; color: var(--text-dim); }
.papeleta-desc { font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.papeleta-meta { display: flex; gap: 12px; font-size: 12px; color: var(--text-dim); }
.papeleta-monto { font-size: 15px; font-weight: 600; color: var(--red); }

/* ── FUENTES BAR ── */
.fuentes-bar {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 14px 6px;
}
.fuente-chip {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px 10px; border-radius: 20px;
}
.fchip-dot { width: 5px; height: 5px; border-radius: 50%; }
.fchip-dot.ok   { background: var(--accent); }
.fchip-dot.err  { background: var(--red); }
.fchip-dot.skip { background: #d1d5db; }

/* ── DISCLAIMER ── */
.disclaimer { font-size: 11px; color: var(--text-dim); text-align: center; padding: 6px 20px 20px; line-height: 1.5; }

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