/* ── Variables ────────────────────────────────────────────────────────────── */
:root {
  --primary:     #1d4ed8;
  --primary-dk:  #1e3a8a;
  --secondary:   #7c3aed;
  --success:     #059669;
  --warning:     #d97706;
  --danger:      #dc2626;
  --info:        #0284c7;
  --bg:          #f0f4ff;
  --card:        #ffffff;
  --text:        #1e293b;
  --muted:       #64748b;
  --border:      #e2e8f0;
  --radius:      16px;
  --radius-sm:   10px;
  --shadow:      0 2px 16px rgba(0,0,0,.08);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.14);
}

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }

/* ── App Shell ────────────────────────────────────────────────────────────── */
.app-wrap {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
}

.page-content {
  padding: 16px;
  padding-bottom: 88px;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.app-header {
  background: linear-gradient(135deg, var(--primary-dk) 0%, var(--secondary) 100%);
  color: white;
  padding: 16px 20px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-header .header-icon {
  font-size: 1.6rem;
  opacity: .9;
}

.app-header h1  { font-size: 1.15rem; font-weight: 700; }
.app-header p   { font-size: .78rem; opacity: .75; margin-top: 1px; }
.header-right   { margin-left: auto; }

/* ── Bottom Nav ───────────────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: white;
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 200;
  box-shadow: 0 -4px 16px rgba(0,0,0,.07);
}

.bottom-nav a {
  flex: 1;
  text-align: center;
  padding: 8px 4px 6px;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: color .15s;
}

.bottom-nav a i       { font-size: 1.45rem; }
.bottom-nav a.active,
.bottom-nav a:hover   { color: var(--primary); }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
}

.card-head {
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: .95rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.card-head i { color: var(--primary); }

.card-body { padding: 16px 18px; }

/* ── Status Card (gradient) ───────────────────────────────────────────────── */
.status-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  border-radius: var(--radius);
  padding: 22px 20px 20px;
  margin-bottom: 16px;
}

.status-card .label  { font-size: .78rem; opacity: .78; margin-bottom: 3px; }
.status-card .amount { font-size: 2.2rem; font-weight: 800; line-height: 1; }
.status-card .sub    { font-size: .85rem; opacity: .85; margin-top: 4px; }

.progress-wrap {
  background: rgba(255,255,255,.25);
  border-radius: 6px;
  height: 8px;
  margin: 14px 0 8px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: white;
  border-radius: 6px;
  transition: width .6s cubic-bezier(.4,0,.2,1);
}

.status-card .meta-row {
  display: flex;
  justify-content: space-between;
  font-size: .82rem;
  opacity: .85;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 13px 24px;
  border-radius: 50px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s, transform .1s;
  width: 100%;
  margin-bottom: 10px;
}

.btn:active { transform: scale(.97); opacity: .9; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
}

.btn-outline {
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-success { background: var(--success); color: white; }
.btn-danger  { background: var(--danger);  color: white; }
.btn-sm      { padding: 8px 16px; font-size: .82rem; width: auto; margin-bottom: 0; }
.btn-xs      { padding: 5px 12px; font-size: .75rem; width: auto; margin-bottom: 0; border-radius: 6px; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group  { margin-bottom: 14px; }
.form-label  {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 13px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--text);
  background: white;
  transition: border-color .2s;
  -webkit-appearance: none;
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29,78,216,.1);
}

.form-control::placeholder { color: #94a3b8; }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Seat Selector ────────────────────────────────────────────────────────── */
.seat-selector {
  display: flex;
  align-items: center;
  gap: 18px;
  justify-content: center;
  margin: 6px 0 12px;
}

.seat-btn {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: white;
  color: var(--primary);
  font-size: 1.4rem;
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
  -webkit-user-select: none;
}

.seat-btn:active { background: var(--primary); color: white; }
.seat-count      { font-size: 2.2rem; font-weight: 800; color: var(--primary); min-width: 48px; text-align: center; }
.seat-label      { font-size: .82rem; color: var(--muted); text-align: center; }

/* ── Passenger Rows ───────────────────────────────────────────────────────── */
.pasajero-block {
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 12px;
  border-left: 3px solid var(--primary);
}

.pasajero-title {
  font-size: .82rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ── Payments list ────────────────────────────────────────────────────────── */
.pago-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.pago-item:last-child { border-bottom: none; }

.pago-monto {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--success);
}

.pago-monto.rechazado { color: var(--danger); }

.pago-meta   { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.pago-right  { text-align: right; }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .73rem;
  font-weight: 700;
  letter-spacing: .2px;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-danger  { background: #fee2e2; color: #991b1b; }

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: .9rem;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.alert-success { background: #d1fae5; color: #065f46; border-left: 3px solid #059669; }
.alert-error   { background: #fee2e2; color: #991b1b; border-left: 3px solid #dc2626; }
.alert-info    { background: #dbeafe; color: #1e40af; border-left: 3px solid #3b82f6; }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 3px solid #d97706; }

/* ── Upload Area ──────────────────────────────────────────────────────────── */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  position: relative;
  background: #fafafa;
}

.upload-area:hover, .upload-area.active {
  border-color: var(--primary);
  background: #eff6ff;
}

.upload-area input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}

.upload-icon    { font-size: 2.4rem; color: var(--muted); display: block; margin-bottom: 8px; }
.upload-text    { color: var(--muted); font-size: .88rem; }
.upload-preview { margin-top: 10px; font-size: .85rem; color: var(--success); font-weight: 600; }

/* ── Login ────────────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, var(--primary-dk) 0%, var(--secondary) 100%);
}

.login-card {
  background: white;
  border-radius: 24px;
  padding: 32px 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,.3);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.logo-circle {
  width: 76px; height: 76px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  font-size: 2.1rem;
  color: white;
  box-shadow: 0 8px 24px rgba(29,78,216,.35);
}

.login-logo h2 { font-size: 1.5rem; font-weight: 800; color: var(--text); }
.login-logo p  { color: var(--muted); font-size: .88rem; margin-top: 4px; }

.login-divider { text-align: center; margin: 18px 0; font-size: .82rem; color: var(--muted); }

/* ── Admin Layout ─────────────────────────────────────────────────────────── */
.admin-wrap {
  min-height: 100dvh;
  background: var(--bg);
}

.admin-topbar {
  background: linear-gradient(135deg, var(--primary-dk), var(--secondary));
  color: white;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky; top: 0; z-index: 100;
}

.admin-topbar h1 { font-size: 1.05rem; font-weight: 700; }
.admin-topbar .tb-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.admin-nav {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.admin-nav::-webkit-scrollbar { display: none; }

.admin-nav a {
  padding: 12px 16px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  display: flex; align-items: center; gap: 6px;
}

.admin-nav a.active,
.admin-nav a:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.admin-content { padding: 20px; }

/* ── Stats grid ───────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-value { font-size: 1.9rem; font-weight: 800; color: var(--primary); line-height: 1; }
.stat-label { font-size: .73rem; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-top: 5px; }
.stat-sub   { font-size: .78rem; color: var(--muted); margin-top: 2px; }

/* ── Table ────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table.tbl {
  width: 100%; border-collapse: collapse; min-width: 480px;
}

.tbl th {
  background: #f8fafc;
  padding: 9px 12px;
  text-align: left;
  font-size: .73rem;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
  font-weight: 600;
}

.tbl td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  font-size: .88rem;
  vertical-align: middle;
}

.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td      { background: #f8fafc; }

/* ── Pasajero list (admin detail) ─────────────────────────────────────────── */
.pax-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}

.pax-item:last-child { border-bottom: none; }

.pax-avatar {
  width: 38px; height: 38px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: .9rem;
}

.pax-name    { font-weight: 600; font-size: .9rem; }
.pax-dni     { font-size: .78rem; color: var(--muted); }

/* ── Misc utilities ───────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted  { color: var(--muted); font-size: .85rem; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-0  { margin-bottom: 0; }
.flex  { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.justify-between { justify-content: space-between; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }

.divider { height: 1px; background: var(--border); margin: 12px 0; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.empty-state i    { font-size: 2.8rem; display: block; margin-bottom: 12px; opacity: .4; }
.empty-state p    { font-size: .9rem; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: #f1f5f9; color: var(--muted);
  padding: 4px 10px; border-radius: 20px;
  font-size: .78rem; font-weight: 600;
}

.section-title {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  margin-bottom: 10px;
}

/* ── Comprobante thumbnail ────────────────────────────────────────────────── */
.comp-thumb {
  display: inline-flex; align-items: center; gap: 6px;
  background: #eff6ff; color: var(--primary);
  padding: 5px 10px; border-radius: 6px;
  font-size: .8rem; font-weight: 600;
  text-decoration: none;
}

.comp-thumb:hover { background: #dbeafe; }

/* ── Search bar ───────────────────────────────────────────────────────────── */
.search-bar {
  display: flex; gap: 8px; margin-bottom: 14px;
}

.search-bar .form-control { margin: 0; }
.search-bar select { flex-shrink: 0; width: 130px; }

/* ── Floating action ──────────────────────────────────────────────────────── */
.fab {
  position: fixed;
  bottom: 74px; right: calc(50% - 228px);
  width: 54px; height: 54px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 1.5rem;
  box-shadow: 0 4px 20px rgba(29,78,216,.4);
  text-decoration: none; z-index: 150;
  transition: transform .15s;
}

.fab:hover { transform: scale(1.07); }

/* ── Seat Map ─────────────────────────────────────────────────────────────── */
.seat-map-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
}

.seat-map-head {
  padding: 12px 16px 10px;
  font-weight: 600;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

.seat-map-head i { color: var(--primary); }

.seat-map-legend {
  margin-left: auto;
  display: flex;
  gap: 12px;
  font-size: .75rem;
  font-weight: 600;
  align-items: center;
}

.seat-leg {
  display: flex;
  align-items: center;
  gap: 4px;
}

.seat-leg-dot {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  display: inline-block;
  flex-shrink: 0;
}

.seat-leg-dot.taken { background: #ef4444; }
.seat-leg-dot.free  { background: #10b981; }

.seat-map-body { padding: 14px 16px 18px; }

.seat-bus-front {
  text-align: center;
  font-size: .7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 5px 0;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 10px;
}

.seat-bus-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
}

.seat-bus-row {
  display: flex;
  gap: 4px;
  align-items: center;
}

.seat-aisle { width: 18px; flex-shrink: 0; }

.seat-sq {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  flex-shrink: 0;
  cursor: default;
  transition: transform .12s;
}

.seat-sq:hover { transform: scale(1.25); z-index: 1; position: relative; }
.seat-sq.sm { width: 18px; height: 18px; border-radius: 5px; }
.seat-sq.xs { width: 13px; height: 13px; border-radius: 4px; }

.seat-sq.taken { background: #ef4444; box-shadow: 0 1px 3px rgba(239,68,68,.4); }
.seat-sq.free  { background: #10b981; box-shadow: 0 1px 3px rgba(16,185,129,.35); }

.seat-counts {
  display: flex;
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.seat-count-item {
  flex: 1;
  text-align: center;
  padding: 0 8px;
}

.seat-count-item + .seat-count-item { border-left: 1px solid var(--border); }

.seat-count-num {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.seat-count-num.taken { color: #ef4444; }
.seat-count-num.free  { color: #10b981; }
.seat-count-num.total { color: var(--primary); }

.seat-count-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
  margin-top: 3px;
}

/* Compact: global view grid */
.seat-map-mini {
  background: white;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.seat-map-mini-head {
  padding: 10px 14px 8px;
  font-size: .82rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.seat-map-mini-body { padding: 10px 14px 14px; }

.seat-mini-counts {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  justify-content: center;
}

.seat-mini-count {
  text-align: center;
}

.seat-mini-num {
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1;
}

.seat-mini-num.taken { color: #ef4444; }
.seat-mini-num.free  { color: #10b981; }
.seat-mini-label {
  font-size: .68rem;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: .3px;
}

/* ─────────────────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .fab { right: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
