/* ═══════════════════════════════════════
   ORVEXIS PREVENTA — GLOBAL STYLES
═══════════════════════════════════════ */
:root {
  --primary: #1a2744;
  --primary-light: #2d4a8a;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #0284c7;
  --gray: #6b7280;
  --gray-light: #f0f4f8;
  --white: #ffffff;
  --border: #e5e7eb;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-lg: 20px;
  --nav-height: 60px;
  --bottom-height: 65px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-light);
  color: var(--primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── TIPOGRAFÍA ── */
h1 { font-size: 22px; font-weight: 800; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p  { font-size: 14px; line-height: 1.5; }

/* ── LAYOUT ── */
.page {
  display: none;
  min-height: calc(100vh - var(--nav-height) - var(--bottom-height));
  padding: 16px;
  padding-bottom: calc(var(--bottom-height) + 16px);
  animation: fadeIn 0.2s ease;
}
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ── TOP NAV ── */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: var(--shadow);
}
.top-nav-title { font-size: 16px; font-weight: 700; }
.top-nav-sub { font-size: 11px; opacity: 0.75; margin-top: 1px; }
.top-nav-actions { display: flex; align-items: center; gap: 8px; }

/* ── BOTTOM NAV ── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-height);
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--gray);
  font-size: 10px;
  font-weight: 600;
  transition: color 0.2s;
  position: relative;
  padding-bottom: 4px;
}
.bottom-nav-item .icon { font-size: 22px; line-height: 1; }
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item.active::after {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 4px 4px;
}
.nav-badge {
  position: absolute;
  top: 4px; right: calc(50% - 18px);
  background: var(--danger);
  color: white;
  border-radius: 50%;
  width: 16px; height: 16px;
  font-size: 9px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}

/* ── CARDS ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-title { font-size: 14px; font-weight: 700; color: var(--primary); }
.card-sub { font-size: 12px; color: var(--gray); margin-top: 2px; }

/* ── BOTONES ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { opacity: 0.85; transform: scale(0.98); }
.btn-block { width: 100%; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-danger  { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-gray    { background: var(--gray-light); color: var(--primary); }
.btn-outline { background: white; border: 2px solid var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 16px 24px; font-size: 16px; border-radius: 12px; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: 50%; }

/* ── INPUTS ── */
.input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--primary);
  background: white;
  outline: none;
  transition: border-color 0.2s;
}
.input:focus { border-color: var(--primary-light); }
.input-group { position: relative; }
.input-group .input { padding-left: 40px; }
.input-group .input-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 16px; color: var(--gray); }
.label { display: block; font-size: 12px; font-weight: 700; color: var(--gray); margin-bottom: 5px; }
.form-group { margin-bottom: 14px; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='2' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.badge-primary   { background: #e0e7ff; color: var(--primary-light); }
.badge-success   { background: #dcfce7; color: var(--success); }
.badge-danger    { background: #fee2e2; color: var(--danger); }
.badge-warning   { background: #fef3c7; color: var(--warning); }
.badge-gray      { background: #f3f4f6; color: var(--gray); }
.badge-pendiente { background: #fef3c7; color: var(--warning); }
.badge-aprobado  { background: #dcfce7; color: var(--success); }
.badge-facturado { background: #e0e7ff; color: var(--primary-light); }
.badge-rechazado { background: #fee2e2; color: var(--danger); }

/* ── LISTAS ── */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: white;
  border-radius: var(--radius);
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border: 2px solid transparent;
}
.list-item:active { transform: scale(0.99); border-color: var(--primary-light); }
.list-item-avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800;
  flex-shrink: 0;
}
.list-item-body { flex: 1; min-width: 0; }
.list-item-title { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item-sub { font-size: 12px; color: var(--gray); margin-top: 2px; }
.list-item-right { text-align: right; flex-shrink: 0; }

/* ── MODALES ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 200;
  align-items: flex-end;
}
.modal-overlay.show { display: flex; }
.modal-overlay.center { align-items: center; padding: 16px; }
.modal {
  background: white;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  padding: 20px;
  animation: slideUp 0.25s ease;
}
.modal-overlay.center .modal { border-radius: var(--radius-lg); max-width: 480px; margin: auto; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-handle { width: 40px; height: 4px; background: var(--border); border-radius: 2px; margin: 0 auto 16px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-title { font-size: 17px; font-weight: 800; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--gray); padding: 4px; }

/* ── STATS ── */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.stats-grid-4 { grid-template-columns: repeat(4, 1fr); }
.stat-card { background: white; border-radius: var(--radius); padding: 14px 10px; text-align: center; box-shadow: var(--shadow); }
.stat-num { font-size: 26px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 10px; color: var(--gray); margin-top: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

/* ── SEARCH ── */
.search-bar { position: relative; margin-bottom: 14px; }
.search-bar input { padding-left: 42px; border-radius: 12px; background: white; }
.search-bar::before { content: '🔍'; position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-size: 16px; z-index: 1; }

/* ── DIVIDER ── */
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.section-title { font-size: 12px; font-weight: 700; color: var(--gray); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 10px; margin-top: 4px; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--gray); }
.empty-state .empty-icon { font-size: 52px; margin-bottom: 12px; }
.empty-state h3 { color: var(--primary); margin-bottom: 6px; }

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: calc(var(--bottom-height) + 12px);
  left: 16px; right: 16px;
  padding: 13px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  z-index: 500;
  text-align: center;
  animation: toastIn 0.3s ease;
  box-shadow: var(--shadow-lg);
}
.toast-success { background: #166534; color: white; }
.toast-error   { background: #991b1b; color: white; }
.toast-info    { background: var(--primary); color: white; }
.toast-warning { background: #92400e; color: white; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ── LOGIN ── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, var(--primary) 0%, var(--primary-light) 100%);
}
.login-card {
  background: white;
  border-radius: 24px;
  padding: 36px 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon { font-size: 56px; }
.login-logo h1 { font-size: 22px; color: var(--primary); margin-top: 8px; }
.login-logo p { font-size: 13px; color: var(--gray); margin-top: 4px; }

/* ── PRODUCTO CARD ── */
.producto-card {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s;
}
.producto-card:active { transform: scale(0.98); }
.producto-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--gray-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
}
.producto-body { padding: 10px; }
.producto-nombre { font-size: 12px; font-weight: 700; line-height: 1.3; margin-bottom: 4px; }
.producto-precio { font-size: 13px; font-weight: 800; color: var(--primary-light); }
.producto-stock { font-size: 10px; color: var(--gray); }

/* ── CARRITO BTN FLOTANTE ── */
.fab-carrito {
  position: fixed;
  bottom: calc(var(--bottom-height) + 16px);
  right: 16px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--success);
  color: white;
  border: none;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(22,163,74,0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 90;
  transition: transform 0.2s;
}
.fab-carrito:active { transform: scale(0.92); }
.fab-carrito .fab-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--danger);
  color: white;
  border-radius: 50%;
  width: 20px; height: 20px;
  font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid white;
}

/* ── COBRO ── */
.cobro-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.cobro-monto { font-size: 16px; font-weight: 800; color: var(--danger); }

/* ── MISC ── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-gray { color: var(--gray); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 10px; }
.font-bold { font-weight: 700; }
.font-black { font-weight: 800; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ── RESPONSIVE ── */
@media (min-width: 480px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}
