/* =========================================================================
   VentaMax POS — tema visual inspirado en la app de Visoor
   Paleta navy + cian, tarjetas redondeadas con sombra suave, sidebar fijo.
   ========================================================================= */

:root {
  /* Tinta casi-negra: titulos y botones solidos (el boton "Agregar venta"
     de Visoor es negro/carbon, no azul marino). */
  --v-navy-900: #14151c;
  --v-navy-800: #1f212b;
  --v-navy-700: #2a2c38;
  /* Azul indigo del topbar y de los acentos "activos" (nav, focus, links). */
  --v-indigo-600: #4562d9;
  --v-indigo-500: #5878e0;
  --v-indigo-100: #eef1fd;
  /* Cian de marca (logo "V"). */
  --v-cyan-500: #10b7d6;
  --v-cyan-400: #2dd4ee;
  --v-cyan-100: #e3fbff;
  --v-green-500: #22b573;
  /* Colores de los pills de Status que usa Visoor en sus tablas. */
  --v-status-pendiente-bg: #ececef;
  --v-status-pendiente-text: #6b7280;
  --v-status-solicitud-bg: #2d6cf6;
  --v-status-facturado-bg: #1fc9ac;
  --v-bg: #f2f4fa;
  --v-card: #ffffff;
  --v-border: #e5e9f3;
  --v-text: #1c2340;
  --v-text-muted: #7c86a3;
  --v-radius-lg: 14px;
  --v-radius: 12px;
  --v-radius-sm: 8px;
  --v-shadow: 0 8px 24px rgba(20, 21, 28, 0.06);
  --v-shadow-sm: 0 2px 10px rgba(20, 21, 28, 0.05);
  --sidebar-w: 260px;

  /* Reasigna las variables de Bootstrap 5.3 al tema de Visoor */
  --bs-body-bg: var(--v-bg);
  --bs-body-color: var(--v-text);
  --bs-body-font-family: 'Roboto', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --bs-border-color: var(--v-border);
  --bs-border-radius: var(--v-radius-sm);
  --bs-border-radius-lg: var(--v-radius);
  --bs-border-radius-sm: 8px;
  --bs-primary: var(--v-navy-900);
  --bs-primary-rgb: 20, 21, 28;
  --bs-link-color: var(--v-indigo-500);
  --bs-link-color-rgb: 88, 120, 224;
  --bs-link-hover-color: var(--v-indigo-600);
  --bs-link-hover-color-rgb: 69, 98, 217;
}

* {
  box-sizing: border-box;
}

body {
  color: var(--v-text);
}

h1,
h2,
h3,
h4,
h5,
h6,
.fw-bold {
  font-family: 'Roboto', sans-serif;
  font-weight: 700;
  color: var(--v-navy-900);
}

a {
  text-decoration: none;
}

/* --- Botones ------------------------------------------------------------ */
.btn {
  border-radius: var(--v-radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
  padding-block: 0.55rem;
}

.btn-primary {
  --bs-btn-bg: var(--v-navy-900);
  --bs-btn-border-color: var(--v-navy-900);
  --bs-btn-hover-bg: var(--v-navy-800);
  --bs-btn-hover-border-color: var(--v-navy-800);
  --bs-btn-active-bg: var(--v-navy-800);
  --bs-btn-active-border-color: var(--v-navy-800);
}

.btn-success {
  --bs-btn-bg: var(--v-cyan-500);
  --bs-btn-border-color: var(--v-cyan-500);
  --bs-btn-hover-bg: var(--v-cyan-400);
  --bs-btn-hover-border-color: var(--v-cyan-400);
  --bs-btn-active-bg: var(--v-cyan-400);
  --bs-btn-active-border-color: var(--v-cyan-400);
  --bs-btn-color: #012;
  --bs-btn-hover-color: #012;
}

.btn-outline-primary {
  --bs-btn-color: var(--v-navy-900);
  --bs-btn-border-color: var(--v-border);
  --bs-btn-hover-bg: var(--v-navy-900);
  --bs-btn-hover-border-color: var(--v-navy-900);
}

.btn-outline-secondary {
  --bs-btn-color: var(--v-text-muted);
  --bs-btn-border-color: var(--v-border);
  --bs-btn-hover-bg: var(--v-text-muted);
  --bs-btn-hover-border-color: var(--v-text-muted);
}

.btn-check:checked + .btn-outline-primary {
  background-color: var(--v-navy-900);
  border-color: var(--v-navy-900);
}

/* --- Tarjetas, tablas, formularios --------------------------------------- */
.card {
  background: var(--v-card);
  border: 1px solid var(--v-border);
  border-radius: var(--v-radius-lg);
  box-shadow: var(--v-shadow-sm);
}

.card-header {
  border-radius: var(--v-radius-lg) var(--v-radius-lg) 0 0 !important;
  border-bottom: 1px solid var(--v-border);
  font-family: 'Roboto', sans-serif;
  font-weight: 500;
}

.table {
  --bs-table-bg: transparent;
}

/* Visoor no usa mayusculas ni zebra-striping en sus tablas: encabezados en
   minusculas normales y filas planas separadas solo por un borde delgado. */
.table thead th {
  color: var(--v-text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  border-bottom-width: 1px;
  border-color: var(--v-border);
}

.table td,
.table th {
  border-color: var(--v-border);
  vertical-align: middle;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-accent-bg: transparent;
}

.table-hover > tbody > tr:hover > *,
.table > tbody > tr:hover > * {
  --bs-table-accent-bg: #f8f9fd;
}

.form-control,
.form-select {
  border-radius: var(--v-radius-sm);
  border-color: var(--v-border);
  padding-block: 0.55rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--v-indigo-500);
  box-shadow: 0 0 0 0.2rem rgba(88, 120, 224, 0.15);
}

.form-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--v-navy-900);
}

.form-text {
  color: var(--v-text-muted);
}

/* --- Badges y alertas ----------------------------------------------------- */
.badge {
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.72rem;
  padding: 0.4em 0.85em;
}

.badge.bg-primary {
  background-color: var(--v-indigo-500) !important;
}

.badge.bg-success {
  background-color: var(--v-status-facturado-bg) !important;
}

.badge.bg-secondary {
  background-color: var(--v-status-pendiente-bg) !important;
  color: var(--v-status-pendiente-text) !important;
}

.badge.bg-info {
  background-color: var(--v-status-solicitud-bg) !important;
  color: #fff !important;
}

.alert {
  border-radius: var(--v-radius);
  border: 1px solid transparent;
}

/* --- Status pill: el componente de "Status" de las tablas de Visoor ------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 5.5rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  border: none;
}

.status-pill-muted {
  background: var(--v-bg);
  color: var(--v-text-muted);
}

.status-pill-pendiente {
  background: var(--v-status-pendiente-bg);
  color: var(--v-status-pendiente-text);
}

.status-pill-solicitud {
  background: var(--v-status-solicitud-bg);
  color: #fff;
}

.status-pill-facturado {
  background: var(--v-status-facturado-bg);
  color: #fff;
}

.status-pill-error {
  background: #fdecc8;
  color: #94650c;
}

button.status-pill {
  cursor: pointer;
}

button.status-pill:disabled {
  opacity: 0.7;
  cursor: default;
}

/* --- App shell: sidebar + topbar ------------------------------------------ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--v-card);
  border-right: 1px solid var(--v-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1030;
  transition: transform 0.2s ease;
}

.app-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 1.25rem 1rem;
}

.app-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--v-cyan-400), var(--v-cyan-500));
  color: #fff;
  font-family: 'Roboto', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  box-shadow: 0 6px 16px rgba(16, 183, 214, 0.35);
}

.app-sidebar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.app-sidebar-brand-text strong {
  font-family: 'Roboto', sans-serif;
  font-weight: 700;
  color: var(--v-navy-900);
  font-size: 1.05rem;
}

.app-sidebar-brand-text span {
  color: var(--v-text-muted);
  font-size: 0.72rem;
}

.app-sidebar-tenant {
  margin: 0 1.25rem 1rem;
  padding: 0.5rem 0.75rem;
  background: var(--v-bg);
  border-radius: var(--v-radius-sm);
  color: var(--v-text-muted);
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
}

.app-sidebar-tenant span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.app-sidebar-label {
  margin: 1rem 0.5rem 0.35rem;
  color: var(--v-text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.app-sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--v-radius-sm);
  color: var(--v-text);
  font-weight: 500;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
}

.app-sidebar-link i {
  font-size: 1.05rem;
  color: var(--v-text-muted);
  width: 20px;
  text-align: center;
}

.app-sidebar-link:hover {
  background: var(--v-bg);
  color: var(--v-navy-900);
}

.app-sidebar-link.active {
  background: var(--v-indigo-100);
  color: var(--v-indigo-500);
  border-left-color: var(--v-indigo-500);
  font-weight: 600;
}

.app-sidebar-link.active i {
  color: var(--v-indigo-500);
}

.app-sidebar-user {
  padding: 0.9rem 1.1rem;
  border-top: 1px solid var(--v-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.app-sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.app-sidebar-user-info div {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.app-sidebar-user-info strong {
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-sidebar-user-info span {
  font-size: 0.72rem;
  color: var(--v-text-muted);
}

.app-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--v-navy-900);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.app-sidebar-logout {
  border: none;
  background: transparent;
  color: var(--v-text-muted);
  font-size: 1.1rem;
  padding: 0.35rem;
  border-radius: var(--v-radius-sm);
}

.app-sidebar-logout:hover {
  background: var(--v-bg);
  color: #d64550;
}

.app-sidebar-toggle {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1031;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--v-border);
  background: var(--v-card);
  box-shadow: var(--v-shadow-sm);
  display: none;
  align-items: center;
  justify-content: center;
}

.app-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 20, 40, 0.4);
  z-index: 1025;
}

.app-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  background: linear-gradient(120deg, var(--v-indigo-500), var(--v-indigo-600));
  color: #fff;
  padding: 1.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.app-topbar-title {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.app-topbar-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--v-radius-sm);
  background: rgba(255, 255, 255, 0.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.app-topbar-title h1 {
  color: #fff;
  font-size: 1.35rem;
  margin: 0;
}

.app-topbar-title p {
  margin: 0.15rem 0 0;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.85rem;
}

.app-topbar-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.app-content {
  padding: 1.75rem 2rem 3rem;
  flex: 1;
}

@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
  }

  body.sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .app-sidebar-backdrop {
    display: block;
  }

  .app-sidebar-toggle {
    display: inline-flex;
  }

  .app-main {
    margin-left: 0;
  }

  .app-topbar {
    padding-left: 4.5rem;
  }
}

/* --- Paginas de autenticacion (login / registro) -------------------------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 15% 15%, rgba(45, 212, 238, 0.25), transparent 40%),
    linear-gradient(150deg, var(--v-navy-900), var(--v-navy-700));
  padding: 2rem 1rem;
}

.auth-card {
  background: var(--v-card);
  border-radius: var(--v-radius-lg);
  box-shadow: var(--v-shadow);
  padding: 2.5rem;
  width: 100%;
}

.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

/* --- Utilidades ya existentes ---------------------------------------------- */
.product-card {
  cursor: pointer;
  transition: transform 0.1s ease-in-out, box-shadow 0.1s ease-in-out;
  border-radius: var(--v-radius);
  overflow: hidden;
}

.product-card:hover {
  transform: translateY(-2px);
  border-color: var(--v-cyan-500);
  box-shadow: var(--v-shadow);
}

.icono-girando {
  display: inline-block;
  animation: girar 0.8s linear infinite;
}

@keyframes girar {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@media print {
  .app-sidebar,
  .app-topbar,
  .app-sidebar-toggle,
  .no-print {
    display: none !important;
  }

  .app-main {
    margin-left: 0 !important;
  }

  .app-content {
    padding: 0 !important;
  }

  /* Ticket de venta pensado para impresora termica de 80 mm (rollo
     continuo): pagina sin margenes del ancho del rollo, y se anulan los
     anchos/paddings de Bootstrap (container/row/col) pensados para pantalla,
     que de otro modo dejarian el ticket angosto y descentrado. */
  @page {
    size: 80mm auto;
    margin: 0;
  }

  html,
  body {
    width: 80mm;
    background: #fff;
  }

  .container,
  .row,
  [class*='col-'] {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #ticket {
    width: 100%;
    max-width: 76mm;
    margin: 0 auto !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }

  #ticket .card-body {
    padding: 2mm !important;
  }

  #ticket,
  #ticket * {
    color: #000 !important;
    font-size: 11px;
    line-height: 1.35;
  }

  #ticket h4 {
    font-size: 14px;
  }

  #ticket table {
    width: 100%;
  }

  #ticket table th,
  #ticket table td {
    padding: 1mm 0.5mm !important;
    font-size: 10px;
  }

  #ticket hr {
    border: none;
    border-top: 1px dashed #000;
    margin: 2mm 0;
  }
}

/* --- Dashboard de ventas --------------------------------------------------- */
/* Paleta categorica validada (slots 1 y 2): efectivo = azul, tarjeta = naranja. */
.viz-root {
  --viz-1: #2a78d6;
  --viz-2: #eb6834;
  --viz-grid: #e5e9f3;
  --viz-up: #0f7b4f;
  --viz-down: #b42318;
}

.dash-kpi {
  background: var(--v-card);
  border: 1px solid var(--v-border);
  border-radius: var(--v-radius-lg);
  box-shadow: var(--v-shadow-sm);
  padding: 1rem 1.1rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.dash-kpi-label {
  font-size: 0.78rem;
  color: var(--v-text-muted);
  font-weight: 500;
}

.dash-kpi-valor {
  font-size: 1.65rem;
  line-height: 1.2;
  color: var(--v-text);
  font-variant-numeric: tabular-nums;
}

.dash-delta {
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.15rem;
}

.dash-delta-up { color: var(--viz-up); font-weight: 600; }
.dash-delta-down { color: var(--viz-down); font-weight: 600; }
.dash-delta i { font-size: 1.1rem; margin-left: -0.2rem; }

.dash-chart { position: relative; }

.dash-split {
  display: flex;
  gap: 2px;
  height: 14px;
}
.dash-split span { border-radius: 4px; min-width: 4px; }
.dash-split-1 { background: var(--viz-1); }
.dash-split-2 { background: var(--viz-2); }

.dash-leyenda > div { display: flex; align-items: center; gap: 0.5rem; padding: 0.2rem 0; }
.dash-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dash-dot-1 { background: var(--viz-1); }
.dash-dot-2 { background: var(--viz-2); }

.dash-top-fila { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto; gap: 0.75rem; align-items: center; padding: 0.35rem 0; }
.dash-top-pos { color: var(--v-text-muted); font-size: 0.8rem; text-align: right; }
.dash-top-nombre { font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-top-barra { height: 8px; background: var(--v-bg); border-radius: 4px; margin-top: 4px; }
.dash-top-barra span { display: block; height: 100%; background: var(--viz-1); border-radius: 4px; }
.dash-top-valor { font-size: 0.85rem; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.dash-top-valor small { display: block; color: var(--v-text-muted); }

/* POS: productos */
.product-card .product-img { height: 100px; object-fit: contain; background: #f8f9fa; }
@media (max-width: 575.98px) {
  .product-card { flex-direction: row; align-items: stretch; }
  .product-card .product-img { width: 84px; min-width: 84px; height: auto; min-height: 84px; border-radius: var(--bs-card-inner-border-radius) 0 0 var(--bs-card-inner-border-radius); }
  .product-card .card-body { padding: 0.5rem 0.75rem; min-width: 0; }
  .product-card .card-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .product-card .card-body p { margin-bottom: 0.25rem !important; }
}
