/* ============================================================
   PARKSYS — SHARED STYLES
============================================================ */
:root {
  --bg:       #0d0f14;
  --surface:  #161920;
  --card:     #1e2230;
  --border:   #2a2f3d;
  --accent:   #f0a500;
  --green:    #1fcc74;
  --red:      #e03c3c;
  --blue:     #3c8fe0;
  --purple:   #8b5cf6;
  --text:     #f0f2f7;
  --muted:    #6b7280;
  --radius:   14px;
  --fh:       'Barlow Condensed', sans-serif;
  --fb:       'Barlow', sans-serif; 
  color-scheme: dark;
}

/* ── TEMA CLARO ──────────────────────────────────────────
   Se activa con data-theme="light" en <html> (lo pone shared.js).
   Solo redefine colores → todo el módulo hereda el cambio.
──────────────────────────────────────────────────────── */
:root[data-theme="light"] {  
  --bg:       #eef1f7; 
  --surface:  #ffffff;
  --card:     #ffffff; 
  --border:   #d5dbe6;
  --accent:   #d98c00;   /* naranja un poco más oscuro para leerse sobre blanco */
  --green:    #12a259;
  --red:      #d32f2f; 
  --blue:     #2f77c8;
  --purple:   #7c48e0; 
  --text:     #1a1f2b; 
  --muted:    #64748b;  
  color-scheme: light;
}
:root[data-theme="light"] body { background: var(--bg); }
/* Transición suave al cambiar de tema */
body, #topbar, .card, .reg-card, .tab-bar, .cfg-section { transition: background .25s, color .25s, border-color .25s; }

/* Botón de tema en la topbar */
.theme-toggle { padding: 6px 11px !important; font-size: 15px; line-height: 1; }

/* ── Pie de versión + botón de actualizar (PWA) ── */
#ps-footer {
  text-align: center; padding: 18px 12px 26px; margin-top: 8px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
#ps-version { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .3px; }
#ps-update-btn {
  background: var(--green); color: #000; border-radius: 20px;
  padding: 10px 22px; font-family: var(--fh); font-size: 15px; font-weight: 800;
  letter-spacing: .5px; box-shadow: 0 4px 14px #1fcc7455;
}
#ps-update-btn.ready { animation: ps-pulse 1.6s ease-in-out infinite; }
@keyframes ps-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* Botón "Instalar app" (pie) */
#ps-install-btn {
  background: var(--blue); color: #fff; border-radius: 20px;
  padding: 11px 24px; font-family: var(--fh); font-size: 16px; font-weight: 800;
  letter-spacing: .5px; box-shadow: 0 4px 14px #3c8fe055;
}

/* Botón "Instalar app" (barra superior) */
#ps-install-top { border-color: var(--blue); color: var(--blue); }
#ps-install-top:hover { background: var(--blue); border-color: var(--blue); color: #fff; }

/* Instrucciones de instalación en iPhone */
#ps-ios-help {
  position: fixed; inset: 0; background: #00000099; z-index: 1000;
  display: flex; align-items: flex-end; justify-content: center; padding: 16px;
}
#ps-ios-help .ps-ios-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; max-width: 420px; width: 100%; color: var(--text);
}
#ps-ios-help .ps-ios-title { font-family: var(--fh); font-size: 20px; font-weight: 800; margin-bottom: 12px; }
#ps-ios-help .ps-ios-steps { margin: 0 0 14px 18px; font-size: 14px; line-height: 1.6; }
#ps-ios-help .ps-ios-close {
  background: var(--accent); color: #000; border-radius: 10px;
  padding: 12px; width: 100%; font-family: var(--fh); font-size: 16px; font-weight: 800;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--fb); min-height: 100vh; overflow-x: hidden; }
button { cursor: pointer; border: none; outline: none; font-family: var(--fb); }
input, select { font-family: var(--fb); outline: none; }
a { text-decoration: none; }

/* UTILITY */
.hide { display: none !important; }
.flex { display: flex; }
.col  { flex-direction: column; }
.center { align-items: center; justify-content: center; } 
.gap4  { gap: 4px; }  .gap8  { gap: 8px; }
.gap12 { gap: 12px; } .gap16 { gap: 16px; }
.fw { width: 100%; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; letter-spacing: .5px; }
.tag-green  { background: #1fcc7422; color: var(--green);  border: 1px solid #1fcc7444; }
.tag-red    { background: #e03c3c22; color: var(--red);    border: 1px solid #e03c3c44; }
.tag-blue   { background: #3c8fe022; color: var(--blue);   border: 1px solid #3c8fe044; }
.tag-orange { background: #f0a50022; color: var(--accent);  border: 1px solid #f0a50044; }
.tag-purple { background: #8b5cf622; color: var(--purple); border: 1px solid #8b5cf644; }

/* TOPBAR */
#topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 10px 16px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}
#topbar .logo { font-family: var(--fh); font-size: 22px; font-weight: 800; letter-spacing: 1px; }
#topbar .logo span { color: var(--accent); }
#topbar .clock { font-family: var(--fh); font-size: 18px; font-weight: 600; color: var(--muted); }
#topbar .topbar-right { display: flex; align-items: center; gap: 10px; }
.user-badge { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 5px 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
.user-badge span { color: var(--accent); }
.nav-btn { background: transparent; border: 1px solid var(--border); color: var(--muted); padding: 6px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; font-family: var(--fh); letter-spacing: .5px; transition: .2s; }
.nav-btn:hover { background: var(--accent); border-color: var(--accent); color: #000; }

/* PAGE WRAPPER */
.page { padding: 16px 16px 100px 16px; max-width: 1200px; margin: 0 auto; }
@media(min-width:768px) { .page { padding: 16px; } }

/* SECTION TITLE */
.screen-title { font-family: var(--fh); font-size: 26px; font-weight: 800; letter-spacing: 1px; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.back-btn { background: var(--card); border: 1px solid var(--border); color: var(--text); padding: 6px 14px; border-radius: 8px; font-size: 14px; font-weight: 600; font-family: var(--fh); letter-spacing: .5px; }
.back-btn:hover { background: var(--border); }

/* TABS */
.tab-bar { display: flex; gap: 6px; margin-bottom: 16px; background: var(--surface); padding: 4px; border-radius: 10px; width: fit-content; }
.tab { background: transparent; color: var(--muted); padding: 8px 20px; border-radius: 8px; font-family: var(--fh); font-size: 16px; font-weight: 700; letter-spacing: .5px; transition: .2s; }
.tab.active { background: var(--accent); color: #000; }

/* INPUT STYLES */
.placa-input {
  background: var(--card); border: 2px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-family: var(--fh); font-size: 32px; font-weight: 800;
  letter-spacing: 4px; text-transform: uppercase; text-align: center;
  padding: 16px; width: 100%; transition: .2s;
}
.placa-input:focus { border-color: var(--accent); }
.placa-input::placeholder { color: var(--muted); letter-spacing: 1px; font-size: 22px; }

.search-bar {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: 18px; padding: 12px 16px; width: 100%; margin-bottom: 12px;
}
.search-bar:focus { border-color: var(--accent); }
.search-bar::placeholder { color: var(--muted); }

.field-label { font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }

/* TIPO VEHICLE GRID */
.tipo-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
@media(max-width:600px) { .tipo-grid { grid-template-columns: repeat(3, 1fr); } }
@media(max-width:400px) { .tipo-grid { grid-template-columns: repeat(2, 1fr); } }
.tipo-btn {
  background: var(--card); border: 2px solid var(--border); border-radius: var(--radius);
  padding: 14px 8px; text-align: center; cursor: pointer; transition: .2s;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.tipo-btn:hover { border-color: var(--accent); }
.tipo-btn.selected { border-color: var(--accent); background: #f0a50018; }
.tipo-btn .t-icon { font-size: 30px; line-height: 1; }
.tipo-btn .t-name { font-family: var(--fh); font-size: 12px; font-weight: 700; letter-spacing: .2px; color: var(--text); line-height: 1.2; }
.tipo-btn .t-tarifa { font-size: 13px; color: var(--accent); font-weight: 700; }

/* TOGGLE */
.toggle-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.toggle-row label { font-size: 14px; font-weight: 600; color: var(--text); }
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: var(--border); border-radius: 20px; transition: .3s; }
.slider:before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .3s; }
input:checked + .slider { background: var(--accent); }
input:checked + .slider:before { transform: translateX(20px); }

/* ACTION BUTTONS */
.action-btn {
  border-radius: var(--radius); padding: 16px; font-family: var(--fh);
  font-size: 20px; font-weight: 800; letter-spacing: 1px; transition: .2s;
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
}
#btn-registrar-ingreso, #btn-confirmar-salida {
  position: fixed; bottom: 20px; left: 16px; right: 16px; width: auto; max-width: 480px;
  margin-left: auto; margin-right: auto; z-index: 50;
}
@media(min-width:768px) {
  #btn-registrar-ingreso, #btn-confirmar-salida {
    position: static; bottom: auto; left: auto; right: auto; max-width: none; margin: 0;
  }
}
.btn-green  { background: var(--green);  color: #000; }
.btn-green:hover  { background: #1aad62; }
.btn-red    { background: var(--red);    color: #fff; }
.btn-red:hover    { background: #c02e2e; }
.btn-orange { background: var(--accent); color: #000; }
.btn-orange:hover { background: #d49000; }
.btn-blue   { background: var(--blue);   color: #fff; }
.btn-blue:hover   { background: #2d7acc; }
.btn-purple { background: var(--purple); color: #fff; }
.btn-purple:hover { background: #7c3aed; }
.btn-muted  { background: var(--card);   border: 1px solid var(--border); color: var(--text); }
.btn-muted:hover  { background: var(--border); }
.action-btn:disabled { opacity: .4; cursor: not-allowed; }

/* COBRO RESULT BOX */
.cobro-box {
  background: var(--card); border: 2px solid var(--green); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px;
}
.cobro-box .cb-label { font-size: 13px; color: var(--muted); text-align: center; margin-bottom: 4px; }
.cobro-box .cb-total { font-family: var(--fh); font-size: 48px; font-weight: 800; color: var(--green); text-align: center; }
.cr-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.cr-item { background: var(--surface); border-radius: 8px; padding: 10px; }
.cr-item .k { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.cr-item .v { font-size: 15px; font-weight: 700; font-family: var(--fh); }

/* REG CARD LIST */
.reg-list { display: flex; flex-direction: column; gap: 8px; }
.reg-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; display: flex; align-items: center; gap: 14px; cursor: pointer; transition: .2s;
}
.reg-card:hover { border-color: var(--accent); }
.reg-card .rc-placa { font-family: var(--fh); font-size: 20px; font-weight: 800; letter-spacing: 2px; background: var(--surface); border-radius: 8px; padding: 6px 12px; min-width: 100px; text-align: center; }
.reg-card .rc-info { flex: 1; }
.reg-card .rc-info .ri-tipo { font-size: 13px; color: var(--muted); font-weight: 600; }
.reg-card .rc-info .ri-time { font-size: 15px; font-weight: 700; }
.reg-card .rc-monto { font-family: var(--fh); font-size: 22px; font-weight: 800; color: var(--accent); white-space: nowrap; }

/* STAT BOXES */
.stats-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px; }
@media(max-width:600px) { .stats-strip { grid-template-columns: repeat(2, 1fr); } }
.stat-box { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px; text-align: center; }
.stat-box .val { font-family: var(--fh); font-size: 28px; font-weight: 800; color: var(--accent); }
.stat-box .lbl { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }

/* CONFIG */
.cfg-section { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.cfg-section h3 { font-family: var(--fh); font-size: 18px; font-weight: 800; margin-bottom: 12px; color: var(--accent); }
.cfg-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.cfg-row:last-child { border-bottom: none; }
.cfg-row label { font-size: 14px; font-weight: 600; }
.cfg-input { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 16px; font-weight: 700; padding: 6px 12px; width: 90px; text-align: right; }
.cfg-input:focus { border-color: var(--accent); }

/* MODAL */
#modal-overlay { display: none; position: fixed; inset: 0; background: #00000090; z-index: 500; align-items: center; justify-content: center; padding: 16px; }
#modal-overlay.show { display: flex; }
#modal-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; max-width: 480px; width: 100%; position: relative; max-height: 90vh; overflow-y: auto; }
#modal-box h2 { font-family: var(--fh); font-size: 24px; font-weight: 800; margin-bottom: 16px; }
.modal-close { position: absolute; top: 14px; right: 14px; background: var(--card); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: 4px 10px; font-size: 18px; line-height: 1; }

/* TICKET */
.ticket { background: #fff; color: #000; border-radius: 10px; padding: 20px; text-align: center; margin-bottom: 16px; }
.ticket .t-local { font-size: 12px; color: #888; }
.ticket .t-title { font-weight: 800; font-size: 15px; margin-bottom: 4px; }
.ticket .t-placa { font-family: var(--fh); font-size: 36px; font-weight: 800; letter-spacing: 4px; margin: 8px 0; }
.ticket .t-hora { font-size: 13px; color: #555; }
#ticket-qr { display: flex; justify-content: center; margin: 12px 0; }

/* TOAST */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--green); color: #000; padding: 12px 24px; border-radius: 20px;
  font-weight: 700; font-size: 15px; opacity: 0; transition: .3s; z-index: 999; pointer-events: none;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--red); color: #fff; }

/* LOADING SPINNER */
.spinner { display: inline-block; width: 20px; height: 20px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 32px; color: var(--muted); font-weight: 600; }

/* EMPTY STATE */
.empty-state { color: var(--muted); text-align: center; padding: 32px; font-size: 14px; }

/* QR AREA */
.qr-area { background: var(--card); border: 2px dashed var(--border); border-radius: var(--radius); padding: 20px; text-align: center; margin-bottom: 16px; }
#qr-video { width: 100%; max-width: 300px; border-radius: 10px; }
.qr-hint { color: var(--muted); font-size: 13px; margin-top: 8px; }

/* EXONERADOS */
.exo-item { display: flex; align-items: center; justify-content: space-between; background: var(--surface); border-radius: 8px; padding: 10px 14px; margin-bottom: 6px; }
.exo-placa { font-family: var(--fh); font-size: 17px; font-weight: 800; letter-spacing: 2px; }
.exo-del { background: var(--red); color: #fff; border-radius: 6px; padding: 4px 10px; font-size: 12px; font-weight: 700; }

/* PERNOCTADOS */
.pern-filter { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.pf-btn { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 6px 16px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; transition: .2s; }
.pf-btn.active { background: var(--purple); border-color: var(--purple); color: #fff; }

/* ALERT BOX */
.alert { border-radius: 10px; padding: 12px 16px; font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.alert-warn { background: #f0a50018; border: 1px solid #f0a50055; color: var(--accent); }
.alert-info { background: #3c8fe018; border: 1px solid #3c8fe055; color: var(--blue); }

@media(max-width:480px) {
  .action-btn { font-size: 17px; padding: 14px; }
  .cobro-box .cb-total { font-size: 36px; }
}

/* Botón editar registro (usado en parking y balanza) */
.edit-placa-btn { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 15px; line-height: 1; color: var(--text); flex-shrink: 0; cursor: pointer; }
.edit-placa-btn:hover { border-color: var(--accent); }

/* ── Reporte de Cierre de Caja / Arqueo (parking y balanza) ── */
.arqueo-wrap #reporte_cierre_ps { color: var(--text); }
.arqueo-wrap h2 { text-align: center; font-family: var(--fh); font-size: 18px; margin: 6px 0; }
.arqueo-wrap h3 { font-family: var(--fh); font-size: 15px; margin: 16px 0 6px; color: var(--accent); }
.arqueo-wrap h3.sub { text-align: center; color: var(--muted); font-size: 14px; margin-top: 0; }
.arqueo-wrap table { width: 100%; border-collapse: collapse; margin: 4px 0 8px; font-size: 13px; }
.arqueo-wrap th, .arqueo-wrap td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; }
.arqueo-wrap th { background: var(--surface); font-weight: 700; }
.arqueo-wrap td small { color: var(--muted); }
.arqueo-wrap table.meta, .arqueo-wrap table.meta td { border: none; padding: 2px 4px; font-size: 13px; }
.arqueo-wrap table.cuadre td { border: none; padding: 4px 6px; }
.arqueo-wrap table.cuadre tr.tot td { border-top: 2px solid var(--accent); font-size: 15px; padding-top: 8px; }
