/* ============================================================
   Bus Company App — estilos compartidos
   Los colores --primary/--accent se sobreescriben en tiempo real
   desde includes/header.php según lo configurado en site_config.
   ============================================================ */
:root {
  --bg:#f4f6fb; --paper:#fff; --ink:#131a2b; --muted:#6b7290; --line:#e7eaf5;
  --primary:#1656c9; --primary-light:#3f8ef0; --primary-dark:#0e3f96; --primary-tint:#eaf1ff;
  --accent:#ff7a33; --accent-dark:#e85f18; --on-accent:#ffffff;
  --danger:#d94f3d; --ok:#1f8a5f; --sold:#dfe2ee;
  --font-display:"Plus Jakarta Sans", sans-serif; --font-body:"Inter", -apple-system, sans-serif;
}
* { box-sizing:border-box; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin:0; background:var(--bg); color:var(--ink); font-family:var(--font-body);
  padding-top:env(safe-area-inset-top,0px); padding-bottom:env(safe-area-inset-bottom,0px);
  line-height:1.5;
}
a { color:inherit; text-decoration:none; }
h1,h2,h3,h4 { font-family:var(--font-display); margin:0; }
img { max-width:100%; display:block; }

/* ---------------- BOTONES ---------------- */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:13px 22px; border-radius:999px; font-weight:800; font-size:14.5px; border:none; cursor:pointer; font-family:var(--font-body); }
.btn-block { display:flex; width:100%; padding:16px; font-size:15px; }
.btn-primary { background:linear-gradient(135deg, var(--accent), var(--accent-dark)); color:var(--on-accent); box-shadow:0 14px 26px -12px rgba(232,95,24,.5); }
.btn-primary:hover { filter:brightness(1.05); }
.btn-primary:disabled { background:var(--sold); color:var(--muted); box-shadow:none; cursor:not-allowed; }
.btn-outline { background:transparent; border:1.5px solid var(--primary); color:var(--primary); }
.btn-ghost { background:transparent; color:var(--muted); font-weight:600; font-size:13.5px; padding:8px 10px; }
.btn-sm { padding:8px 16px; font-size:12.5px; border-radius:8px; }
.btn-danger { background:var(--danger); color:#fff; }

/* ---------------- BARRA PÚBLICA ---------------- */
.public-bar { background:linear-gradient(135deg, var(--primary), var(--primary-light)); color:#fff; }
.public-bar-inner { max-width:1080px; margin:0 auto; padding:14px 20px; display:flex; align-items:center; justify-content:space-between; }
.public-brand { display:flex; align-items:center; gap:10px; font-family:var(--font-display); font-weight:800; font-size:16px; color:#fff; }
.public-brand-mark { width:32px; height:32px; border-radius:10px; background:rgba(255,255,255,.18); border:1px solid rgba(255,255,255,.3); display:flex; align-items:center; justify-content:center; font-size:13px; }
.public-bar .btn-outline { border-color:rgba(255,255,255,.5); color:#fff; }
.site-footer { text-align:center; padding:26px 16px 40px; font-size:12px; color:var(--muted); }

/* ---------------- LAYOUT DE PÁGINA (flujo de compra) ---------------- */
.page-wrap { max-width:480px; margin:0 auto; padding:20px 16px 50px; }
.hero-panel { background:linear-gradient(135deg, var(--primary), var(--primary-light)); color:#fff; border-radius:24px; padding:26px 22px; position:relative; overflow:hidden; margin-bottom:-26px; }
.hero-panel::after { content:""; position:absolute; right:-30px; top:-30px; width:140px; height:140px; border-radius:50%; background:rgba(255,255,255,.08); }
.hero-panel h1 { position:relative; font-size:22px; font-weight:800; max-width:20ch; line-height:1.25; letter-spacing:-.01em; }
.hero-panel p { position:relative; font-size:12px; opacity:.85; margin-top:6px; }

.card { background:var(--paper); border-radius:22px; box-shadow:0 20px 40px -24px rgba(19,26,43,.22); padding:20px; position:relative; z-index:2; }
.card.tight { padding:0; overflow:hidden; }

.field { display:flex; align-items:center; gap:12px; padding:14px 16px; border-bottom:1px solid var(--line); position:relative; }
.field:last-child { border-bottom:none; }
.field-icon { width:34px; height:34px; border-radius:10px; background:var(--primary-tint); color:var(--primary); display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.field-icon svg { width:17px; height:17px; }
.field label { font-size:10.5px; color:var(--muted); display:block; margin-bottom:2px; font-weight:700; text-transform:uppercase; letter-spacing:.02em; }
.field select, .field input { border:none; background:transparent; font:inherit; color:var(--ink); font-size:15px; font-weight:700; width:100%; padding:0; }
.field select:focus, .field input:focus { outline:none; }
.swap-btn { position:absolute; right:14px; top:50%; transform:translateY(-50%); width:32px; height:32px; border-radius:50%; background:linear-gradient(135deg, var(--accent), var(--accent-dark)); display:flex; align-items:center; justify-content:center; cursor:pointer; color:#fff; z-index:1; border:none; }

.quick-routes { display:flex; gap:8px; flex-wrap:wrap; margin:16px 0; }
.chip { border:1px solid var(--line); background:var(--paper); border-radius:999px; padding:8px 14px; font-size:12.5px; font-weight:700; cursor:pointer; color:var(--ink); display:inline-block; }
.chip.active { background:var(--primary-tint); border-color:var(--primary); color:var(--primary); }

.helper-note { font-size:12px; color:var(--muted); text-align:center; margin-top:12px; }

.subnav { display:flex; align-items:center; gap:10px; padding:6px 0 18px; }
.back-btn { width:32px; height:32px; border-radius:50%; border:1px solid var(--line); background:var(--paper); display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.subnav-title { font-weight:800; font-size:16px; font-family:var(--font-display); }
.subnav-sub { font-size:12px; color:var(--muted); }

.trip-card { border:1px solid var(--line); border-radius:20px; padding:15px; display:flex; flex-direction:column; gap:10px; background:var(--paper); margin-bottom:12px; }
.trip-card:hover { border-color:var(--primary); }
.trip-top { display:flex; justify-content:space-between; align-items:baseline; }
.trip-time { font-family:var(--font-display); font-size:21px; font-weight:800; }
.trip-duration { font-size:11.5px; color:var(--muted); }
.trip-meta { display:flex; justify-content:space-between; align-items:center; }
.trip-service { font-size:12.5px; color:var(--muted); font-weight:600; }
.trip-price { font-family:var(--font-display); font-weight:800; font-size:18px; color:var(--primary); }
.seats-left { font-size:11px; padding:4px 10px; border-radius:999px; background:var(--primary-tint); color:var(--primary); font-weight:700; }
.seats-left.low { background:#fce3dd; color:var(--danger); }

.bus-frame { border:1px solid var(--line); border-radius:20px; padding:18px; background:var(--paper); }
.wheel { width:28px; height:28px; border-radius:50%; border:3px solid var(--line); margin:0 auto 14px; }
.seat-grid { display:grid; grid-template-columns:repeat(5,1fr); gap:9px; max-width:260px; margin:0 auto; }
.seat { aspect-ratio:1; border-radius:11px; border:none; cursor:pointer; font-size:11.5px; font-weight:800; display:flex; align-items:center; justify-content:center; background:var(--primary-tint); color:var(--primary); font-family:var(--font-display); }
.seat.aisle { background:transparent; cursor:default; }
.seat.sold, .seat.locked { background:var(--sold); color:var(--muted); cursor:not-allowed; }
.seat.selected { background:linear-gradient(135deg, var(--accent), var(--accent-dark)); color:#fff; }
.seat-check { position:relative; display:block; cursor:pointer; }
.seat-check input { position:absolute; opacity:0; width:100%; height:100%; margin:0; cursor:pointer; }
.legend { display:flex; gap:14px; justify-content:center; margin-top:16px; flex-wrap:wrap; }
.legend-item { display:flex; align-items:center; gap:6px; font-size:11px; color:var(--muted); font-weight:600; }
.legend-dot { width:11px; height:11px; border-radius:4px; }

.summary-bar { margin-top:16px; border-top:1px solid var(--line); padding-top:14px; display:flex; flex-direction:column; gap:11px; }
.summary-row { display:flex; justify-content:space-between; font-size:13.5px; }
.summary-total { font-weight:800; font-family:var(--font-display); font-size:17px; }

.form-group { display:flex; flex-direction:column; gap:6px; margin-bottom:14px; }
.form-group label { font-size:11.5px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.02em; }
.form-group input, .form-group select { border:1.5px solid var(--line); border-radius:13px; padding:13px 14px; font:inherit; font-size:14.5px; background:var(--bg); color:var(--ink); font-weight:600; width:100%; }
.form-group input:focus { outline:none; border-color:var(--primary); background:#fff; }

.pay-option { border:1.5px solid var(--primary); border-radius:14px; padding:14px; display:flex; align-items:center; gap:12px; background:var(--primary-tint); margin-bottom:16px; }
.pay-logo { width:42px; height:28px; border-radius:6px; background:var(--primary); color:#fff; font-size:9px; font-weight:800; display:flex; align-items:center; justify-content:center; font-family:var(--font-display); }

.ticket-card { background:var(--paper); border:1px solid var(--line); border-radius:22px; padding:20px; display:flex; flex-direction:column; gap:13px; align-items:center; text-align:center; margin-bottom:14px; }
.ok-badge { width:48px; height:48px; border-radius:50%; background:linear-gradient(135deg, var(--primary), var(--primary-light)); color:#fff; display:flex; align-items:center; justify-content:center; font-size:22px; }
.qr-box { padding:12px; background:#fff; border-radius:14px; border:1px solid var(--line); }
.ticket-grid { width:100%; display:grid; grid-template-columns:1fr 1fr; gap:11px; text-align:left; font-size:13px; }
.ticket-grid div span { display:block; color:var(--muted); font-size:10.5px; margin-bottom:2px; font-weight:600; text-transform:uppercase; letter-spacing:.02em; }
.ticket-grid div { font-weight:700; }

.error-box { background:#fce3dd; color:var(--danger); border-radius:14px; padding:14px 16px; font-size:13px; font-weight:600; margin-bottom:14px; }
.flash { background:var(--primary-tint); color:var(--primary-dark); border-radius:12px; padding:12px 16px; font-size:13px; margin-bottom:16px; }

/* ============================================================
   PANEL ADMINISTRATIVO
   ============================================================ */
.admin-layout { display:flex; min-height:100vh; }
.admin-sidebar { width:225px; background:linear-gradient(180deg, #0c1638, #122058); color:#fff; flex-shrink:0; display:flex; flex-direction:column; padding:20px 14px; }
.admin-brand { font-family:var(--font-display); font-weight:800; font-size:15px; margin-bottom:4px; color:#fff; }
.admin-role-badge { font-size:10.5px; background:rgba(255,255,255,.1); border:1px solid rgba(255,255,255,.14); display:inline-block; padding:3px 9px; border-radius:999px; margin:14px 0 20px; }
.admin-nav-item { display:block; padding:10px 12px; border-radius:8px; color:#c7cceb; font-size:13.5px; font-weight:600; margin-bottom:2px; }
.admin-nav-item:hover { background:rgba(255,255,255,.07); color:#fff; }
.admin-nav-item.active { background:rgba(255,255,255,.1); color:#fff; box-shadow:inset 2px 0 0 var(--primary-light); }
.admin-logout { margin-top:auto; }
.admin-main { flex:1; padding:30px 36px; overflow-x:auto; }
.admin-topbar { display:flex; justify-content:space-between; align-items:flex-end; margin-bottom:22px; gap:14px; flex-wrap:wrap; }
.admin-topbar h1 { font-size:23px; }
.superadmin-strip { background:linear-gradient(90deg, rgba(63,201,242,.15), rgba(139,107,245,.15)); color:var(--ink); font-size:12px; padding:8px 16px; text-align:center; font-weight:700; border-bottom:1px solid var(--line); }

.stat-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:12px; margin-bottom:24px; }
.stat-card { background:var(--paper); border:1px solid var(--line); border-radius:14px; padding:15px; }
.stat-card .label { font-size:11px; color:var(--muted); font-weight:600; margin-bottom:5px; }
.stat-card .value { font-family:var(--font-display); font-size:22px; font-weight:800; }

.panel-card { background:var(--paper); border:1px solid var(--line); border-radius:14px; padding:18px; margin-bottom:20px; }
.panel-card h3 { font-size:14.5px; margin:0 0 14px; font-weight:700; }

.admin-table { width:100%; border-collapse:collapse; background:var(--paper); border:1px solid var(--line); border-radius:12px; overflow:hidden; }
.admin-table th, .admin-table td { text-align:left; padding:10px 12px; font-size:12.5px; border-bottom:1px solid var(--line); }
.admin-table th { background:#f7f7fb; font-size:10.5px; text-transform:uppercase; color:var(--muted); }
.admin-table tr:last-child td { border-bottom:none; }
.table-responsive { display:block; overflow-x:auto; }

.form-row { display:flex; gap:10px; flex-wrap:wrap; align-items:end; margin-bottom:12px; }
.form-field { display:flex; flex-direction:column; gap:5px; min-width:130px; }
.form-field label { font-size:11px; font-weight:700; color:var(--muted); }
.form-field input, .form-field select { border:1px solid var(--line); border-radius:8px; padding:8px 10px; font:inherit; font-size:12.5px; background:var(--bg); width:auto; }

.pill { display:inline-block; font-size:10.5px; font-weight:700; padding:3px 9px; border-radius:999px; background:var(--primary-tint); color:var(--primary); }
.pill.warn { background:#fce3dd; color:var(--danger); }
.pill.ok { background:#e5f6ee; color:var(--ok); }

.switch { width:38px; height:22px; border-radius:999px; background:var(--line); position:relative; cursor:pointer; flex-shrink:0; display:inline-block; border:none; }
.switch.on { background:linear-gradient(135deg, var(--accent), var(--accent-dark)); }
.switch::after { content:""; position:absolute; top:2px; left:2px; width:18px; height:18px; border-radius:50%; background:#fff; transition:transform .15s; }
.switch.on::after { transform:translateX(16px); }

.empty-note { color:var(--muted); font-size:13px; padding:16px; text-align:center; }
code { background:#eef0f8; padding:1px 5px; border-radius:4px; font-size:12px; }

@media (max-width: 860px) {
  .admin-layout { flex-direction:column; }
  .admin-sidebar { width:100%; flex-direction:row; flex-wrap:wrap; align-items:center; padding:12px; }
  .admin-nav-item { width:auto; }
  .admin-logout { margin-top:0; margin-left:auto; }
  .admin-main { padding:20px; }
}
