/* ============================================================
   POS RESELLER - ESTILOS PRINCIPALES
   Sistema de variables CSS para Marca Blanca
   ============================================================ */

/* ── IMPORTAR FUENTES ──────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Poppins:wght@600;700;800&display=swap');

/* ── VARIABLES CSS (Marca Blanca - se sobreescriben por JS) ── */
:root {
  --pos-primario:    #2563eb;
  --pos-secundario:  #1e40af;
  --pos-acento:      #f59e0b;
  --pos-texto:       #1f2937;
  --pos-fondo:       #f8fafc;
  --pos-blanco:      #ffffff;
  --pos-sidebar-bg: var(--pos-primario);
  --pos-sidebar-txt: #ffffff;
  --pos-header-bg:  #ffffff;
  --pos-card-bg:    #ffffff;
  --pos-border:     #e5e7eb;
  --pos-sombra:     0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --pos-sombra-md:  0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --pos-sombra-lg:  0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --pos-radio:      0.75rem;
  --pos-radio-sm:   0.5rem;
  --pos-radio-lg:   1rem;
  --pos-trans:      all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --pos-font:       'Inter', sans-serif;
  --sidebar-width:  260px;
  --header-height:  64px;
}

/* ── RESET & BASE ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--pos-font);
  background: var(--pos-fondo);
  color: var(--pos-texto);
  font-size: 0.9375rem;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── SCROLLBAR CUSTOM ──────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--pos-fondo); }
::-webkit-scrollbar-thumb { background: var(--pos-primario); border-radius: 3px; }

/* ── LAYOUT PRINCIPAL ──────────────────────────────────────── */
.pos-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── SIDEBAR ───────────────────────────────────────────────── */
.pos-sidebar {
  width: var(--sidebar-width);
  background: var(--pos-sidebar-bg);
  min-height: 100vh;
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  z-index: 1000;
  transition: var(--pos-trans);
  box-shadow: 4px 0 15px rgba(0,0,0,.15);
  display: flex;
  flex-direction: column;
  overflow: hidden; /* el contenedor general no se desplaza, solo .sidebar-nav internamente */
}

.sidebar-brand {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.15);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--header-height);
  text-decoration: none;
}

.sidebar-brand img {
  width: 40px; height: 40px;
  border-radius: var(--pos-radio-sm);
  object-fit: contain;
  background: rgba(255,255,255,.15);
  padding: 4px;
}

.sidebar-brand-icon {
  width: 40px; height: 40px;
  background: rgba(255,255,255,.2);
  border-radius: var(--pos-radio-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-brand-text {
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  overflow: hidden;
}

.sidebar-brand-text small {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  opacity: .7;
  font-family: var(--pos-font);
}

.sidebar-nav {
  flex: 1;
  min-height: 0; /* crítico: permite que el hijo flex se encoja y active el scroll interno */
  padding: 1rem 0;
  overflow-y: auto;
  overflow-x: hidden;

  /* Scrollbar invisible pero funcional */
  scrollbar-width: none;       /* Firefox */
  -ms-overflow-style: none;    /* IE / Edge legacy */
}

.sidebar-nav::-webkit-scrollbar {
  width: 0;
  background: transparent;     /* Chrome, Safari, Edge moderno */
}

.sidebar-section {
  padding: 0.5rem 1.5rem 0.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.5);
  margin-top: 0.75rem;
}

.sidebar-item {
  margin: 2px 0.75rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.875rem;
  color: rgba(255,255,255,.8);
  text-decoration: none;
  border-radius: var(--pos-radio-sm);
  transition: var(--pos-trans);
  font-size: 0.9rem;
  font-weight: 500;
  position: relative;
}

.sidebar-link i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-link:hover,
.sidebar-link.active {
  background: rgba(255,255,255,.15);
  color: #fff;
  transform: translateX(3px);
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%;
  background: var(--pos-acento);
  border-radius: 0 2px 2px 0;
}

.sidebar-badge {
  margin-left: auto;
  background: var(--pos-acento);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,.15);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: rgba(255,255,255,.9);
  font-size: 0.85rem;
}

.sidebar-avatar {
  width: 36px; height: 36px;
  background: rgba(255,255,255,.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  flex-shrink: 0;
}

/* ── HEADER ────────────────────────────────────────────────── */
.pos-header {
  height: var(--header-height);
  background: var(--pos-header-bg);
  border-bottom: 1px solid var(--pos-border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  position: fixed;
  top: 0; right: 0;
  left: var(--sidebar-width);
  z-index: 999;
  box-shadow: var(--pos-sombra);
  transition: var(--pos-trans);
  gap: 1rem;
}

.header-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--pos-texto);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--pos-radio-sm);
}

.header-toggle:hover { background: var(--pos-fondo); }

.header-search {
  flex: 1;
  max-width: 400px;
  position: relative;
}

.header-search input {
  width: 100%;
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  border: 1px solid var(--pos-border);
  border-radius: 50px;
  background: var(--pos-fondo);
  font-size: 0.875rem;
  transition: var(--pos-trans);
  outline: none;
}

.header-search input:focus {
  border-color: var(--pos-primario);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.header-search i {
  position: absolute;
  left: 0.875rem; top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 0.875rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.header-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--pos-fondo);
  border: 1px solid var(--pos-border);
  color: var(--pos-texto);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--pos-trans);
  text-decoration: none;
  position: relative;
}

.header-btn:hover {
  background: var(--pos-primario);
  color: #fff;
  border-color: var(--pos-primario);
}

.header-notif-badge {
  position: absolute;
  top: 0; right: 0;
  width: 16px; height: 16px;
  background: #ef4444;
  border-radius: 50%;
  font-size: 0.6rem;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  border: 2px solid #fff;
}

/* ── CONTENIDO PRINCIPAL ───────────────────────────────────── */
.pos-main {
  margin-left: var(--sidebar-width);
  padding-top: var(--header-height);
  min-height: 100vh;
  transition: var(--pos-trans);
}

.pos-content {
  padding: 1.75rem;
}

/* ── CARDS ─────────────────────────────────────────────────── */
.pos-card {
  background: var(--pos-card-bg);
  border-radius: var(--pos-radio);
  box-shadow: var(--pos-sombra);
  border: 1px solid var(--pos-border);
  overflow: hidden;
  transition: var(--pos-trans);
}

.pos-card:hover { box-shadow: var(--pos-sombra-md); }

.pos-card-header {
  padding: 1.125rem 1.5rem;
  border-bottom: 1px solid var(--pos-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.pos-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--pos-texto);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.pos-card-title i {
  color: var(--pos-primario);
}

.pos-card-body {
  padding: 1.5rem;
}

/* ── STAT CARDS (Dashboard) ────────────────────────────────── */
.stat-card {
  background: var(--pos-card-bg);
  border-radius: var(--pos-radio);
  padding: 1.5rem;
  border: 1px solid var(--pos-border);
  box-shadow: var(--pos-sombra);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--pos-trans);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--stat-color, var(--pos-primario));
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--pos-sombra-lg);
}

.stat-icon {
  width: 56px; height: 56px;
  border-radius: var(--pos-radio);
  background: var(--stat-color, var(--pos-primario));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  color: #fff;
  flex-shrink: 0;
  opacity: 0.9;
}

.stat-body { flex: 1; min-width: 0; }

.stat-value {
  font-size: 1.625rem;
  font-weight: 800;
  font-family: 'Poppins', sans-serif;
  color: var(--pos-texto);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.8rem;
  color: #6b7280;
  font-weight: 500;
}

.stat-trend {
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 0.35rem;
}

.stat-trend.up   { color: #10b981; }
.stat-trend.down { color: #ef4444; }

/* ── BOTONES PERSONALIZADOS ────────────────────────────────── */
.btn-pos {
  background: var(--pos-primario);
  color: #fff;
  border: none;
  padding: 0.625rem 1.25rem;
  border-radius: var(--pos-radio-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--pos-trans);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  white-space: nowrap;
}

.btn-pos:hover {
  background: var(--pos-secundario);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37,99,235,.3);
}

.btn-pos-outline {
  background: transparent;
  color: var(--pos-primario);
  border: 2px solid var(--pos-primario);
  padding: 0.5rem 1.25rem;
  border-radius: var(--pos-radio-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--pos-trans);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.btn-pos-outline:hover {
  background: var(--pos-primario);
  color: #fff;
}

.btn-acento {
  background: var(--pos-acento);
  color: #fff;
  border: none;
  padding: 0.625rem 1.25rem;
  border-radius: var(--pos-radio-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--pos-trans);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.btn-acento:hover {
  filter: brightness(0.9);
  transform: translateY(-1px);
  color: #fff;
}

/* ── FORMULARIOS ───────────────────────────────────────────── */
.form-control:focus,
.form-select:focus {
  border-color: var(--pos-primario);
  box-shadow: 0 0 0 0.2rem rgba(37,99,235,.15);
}

.form-label { font-weight: 600; font-size: 0.875rem; color: var(--pos-texto); }

.input-group-text {
  background: var(--pos-fondo);
  border-color: var(--pos-border);
  color: #6b7280;
}

/* ── ALERTAS ───────────────────────────────────────────────── */
.pos-alert {
  border-radius: var(--pos-radio-sm);
  padding: 0.875rem 1.125rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
  animation: slideInDown 0.3s ease;
}

.pos-alert i { margin-top: 2px; flex-shrink: 0; }

/* ── TABLA ─────────────────────────────────────────────────── */
.pos-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.pos-table th {
  padding: 0.75rem 1rem;
  background: var(--pos-fondo);
  color: #6b7280;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--pos-border);
  white-space: nowrap;
}

.pos-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #f3f4f6;
  color: var(--pos-texto);
  vertical-align: middle;
}

.pos-table tr:hover td { background: #f9fafb; }
.pos-table tr:last-child td { border-bottom: none; }

/* ── MODALES ───────────────────────────────────────────────── */
.modal-content {
  border: none;
  border-radius: var(--pos-radio);
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.25);
}

.modal-header {
  background: var(--pos-primario);
  color: #fff;
  border-radius: var(--pos-radio) var(--pos-radio) 0 0;
  padding: 1.125rem 1.5rem;
  border-bottom: none;
}

.modal-header .btn-close {
  filter: brightness(0) invert(1);
  opacity: .8;
}

.modal-title {
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--pos-border); }

/* ── BADGE ESTADOS ─────────────────────────────────────────── */
.badge-estado {
  padding: 0.35rem 0.75rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ── PÁGINA DE LOGIN ───────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--pos-primario) 0%, var(--pos-secundario) 50%, #0f172a 100%);
  padding: 1rem;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: rgba(255,255,255,.03);
  border-radius: 50%;
  top: -200px; right: -200px;
  animation: float 8s ease-in-out infinite;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: rgba(255,255,255,.03);
  border-radius: 50%;
  bottom: -150px; left: -100px;
  animation: float 10s ease-in-out infinite reverse;
}

.login-card {
  background: #fff;
  border-radius: 1.25rem;
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.4);
  position: relative;
  z-index: 1;
  animation: fadeInUp 0.5s ease;
}

.login-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-logo img {
  max-height: 70px;
  max-width: 200px;
  object-fit: contain;
}

.login-logo-icon {
  width: 70px; height: 70px;
  background: linear-gradient(135deg, var(--pos-primario), var(--pos-secundario));
  border-radius: 1rem;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 2rem;
  color: #fff;
  margin-bottom: 0.75rem;
  box-shadow: 0 8px 20px rgba(37,99,235,.3);
}

.login-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--pos-texto);
  text-align: center;
  margin-bottom: 0.25rem;
}

.login-subtitle {
  text-align: center;
  color: #6b7280;
  font-size: 0.875rem;
  margin-bottom: 1.75rem;
}

/* ── PÁGINA SUSCRIPCIÓN VENCIDA ────────────────────────────── */
.pago-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--pos-fondo);
  padding: 2rem;
}

.pago-card {
  background: #fff;
  border-radius: var(--pos-radio-lg);
  padding: 2.5rem;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--pos-sombra-lg);
  text-align: center;
  animation: fadeInUp 0.4s ease;
}

/* ── ANIMACIONES ───────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideInDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-20px) rotate(5deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .5; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.anim-fade-in     { animation: fadeIn 0.4s ease; }
.anim-fade-in-up  { animation: fadeInUp 0.4s ease; }
.anim-slide-left  { animation: slideInLeft 0.4s ease; }

/* Stagger animation para listas */
.anim-stagger > * { animation: fadeInUp 0.3s ease both; }
.anim-stagger > *:nth-child(1) { animation-delay: 0.05s; }
.anim-stagger > *:nth-child(2) { animation-delay: 0.10s; }
.anim-stagger > *:nth-child(3) { animation-delay: 0.15s; }
.anim-stagger > *:nth-child(4) { animation-delay: 0.20s; }
.anim-stagger > *:nth-child(5) { animation-delay: 0.25s; }
.anim-stagger > *:nth-child(6) { animation-delay: 0.30s; }

/* ── LOADER ────────────────────────────────────────────────── */
.pos-loader {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.pos-loader-dark {
  border-color: rgba(37,99,235,.2);
  border-top-color: var(--pos-primario);
}

/* ── COLORES ESTADO ────────────────────────────────────────── */
.text-pos    { color: var(--pos-primario) !important; }
.bg-pos      { background: var(--pos-primario) !important; }
.text-acento { color: var(--pos-acento) !important; }
.bg-acento   { background: var(--pos-acento) !important; }
.border-pos  { border-color: var(--pos-primario) !important; }

/* ── ALERTA STOCK BAJO ─────────────────────────────────────── */
.stock-bajo {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #dc2626;
  font-weight: 600;
  font-size: 0.8rem;
}

/* ── TRIAL BANNER ──────────────────────────────────────────── */
.trial-banner {
  background: linear-gradient(135deg, var(--pos-acento), #d97706);
  color: #fff;
  padding: 0.625rem 1rem;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  animation: slideInDown 0.3s ease;
}

.trial-banner a { color: #fff; text-decoration: underline; font-weight: 700; }

/* ── TICKET POS ────────────────────────────────────────────── */
.ticket-preview {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  background: #fff;
  padding: 20px;
  max-width: 300px;
  margin: 0 auto;
  border: 1px dashed #ccc;
  line-height: 1.5;
}

.ticket-preview .ticket-sep {
  border-top: 1px dashed #999;
  margin: 6px 0;
}

/* ── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .pos-sidebar {
    transform: translateX(-100%);
  }
  .pos-sidebar.open {
    transform: translateX(0);
  }
  .pos-main {
    margin-left: 0;
  }
  .pos-header {
    left: 0;
  }
  .header-toggle {
    display: flex;
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 999;
    backdrop-filter: blur(2px);
  }
  .sidebar-overlay.show { display: block; }
}

@media (max-width: 575.98px) {
  .pos-content { padding: 1rem; }
  .stat-value  { font-size: 1.3rem; }
  .login-card  { padding: 1.75rem 1.25rem; }
}

/* ── UTILIDADES EXTRA ──────────────────────────────────────── */
.cursor-pointer { cursor: pointer; }
.no-select { user-select: none; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.fw-800 { font-weight: 800 !important; }

/* Toast personalizado */
.toast-container { z-index: 9999; }
.pos-toast {
  min-width: 280px;
  border-radius: var(--pos-radio-sm);
  border: none;
  box-shadow: var(--pos-sombra-lg);
  animation: slideInDown 0.3s ease;
}

/* Color de acento en inputs al editar */
.edit-mode {
  background: #fffbeb !important;
  border-color: var(--pos-acento) !important;
}

/* ── PÁGINA 404 / ERROR ────────────────────────────────────── */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 2rem;
}

.error-code {
  font-size: 6rem;
  font-weight: 800;
  font-family: 'Poppins', sans-serif;
  color: var(--pos-primario);
  opacity: .2;
  line-height: 1;
}