/* Valores por defecto (Modo Claro) */
:root {
  /*Body*/
  --background-image: url('/img/ligth.webp');
  --background-bd: rgb(229, 229, 229);
  /*Modal*/
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 0, 0, 0.1);
  --glass-blur: 10px;
  --glass-saturate: 350%;
  --modal-backdrop: rgba(207, 207, 207, 0.59);
  /* Botón Claro */
  --btn-glass-bg: rgb(255, 255, 255);
  --btn-glass-border: rgb(153, 153, 153);
  --btn-glass-shadow: rgba(0, 0, 0, 0.3);
  --btn-glass-glow: rgba(0, 0, 0, 0.8); /* Reflejo superior */
  --btn-glass-color: #000000;
  --btn-glass-active: rgba(255, 255, 255, 0.5);
  /* Menu */
  --menu-bg: rgb(255, 255, 255);
  --item-bg: rgba(255, 255, 255, 0.9);
  --border-bg: rgba(0, 0, 0, 0.2);
  --subItemText-bg: black;
  --nav-bg: rgba(221, 221, 221, 0.2);
  --shadow-nav: rgba(0, 0, 0, 0.6);
  /* Card PRE */
  --card-bg: rgb(255, 255, 255); /* Fondo de vidrio ultra sutil */
  --shadow-box: rgba(0, 255, 255, 0.1);
  --shadow-cian: rgb(65, 65, 65);
  --shadow-rosa: rgb(0, 0, 0);
  /* Input */
  --input-bg: rgb(255, 255, 255);
  /* Border */
  --border-br: rgb(138, 138, 138);
}

/* Ajustes cuando el tema es Oscuro */
[data-bs-theme="dark"] {
  /*Body*/
  --background-image: url('/img/dark.webp');
  --background-bd: rgb(0, 0, 0);
  /*Modal*/
  --glass-bg: rgba(0, 0, 0, 0);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-blur: 15px;
  --glass-saturate: 250%;
  --modal-backdrop: rgba(0, 0, 0, 0.259);
  /* Botón Oscuro */
  --btn-glass-bg: rgba(255, 255, 255, 0.1);
  --btn-glass-border: rgba(255, 255, 255, 0.2);
  --btn-glass-shadow: rgba(255, 255, 255, 0.1);
  --btn-glass-glow: rgba(255, 255, 255, 0.6);
  --btn-glass-color: #ffffff;
  --btn-glass-active: rgb(0, 64, 255);
  /* Menu */
  --menu-bg: rgba(0, 0, 0, 0);
  --item-bg: rgba(0, 0, 0, 0);
  --border-bg: rgba(255, 255, 255, 0.326);
  --subItemText-bg: white;
  --nav-bg: rgba(0, 0, 0, 0.2);
  --shadow-nav: rgba(221, 221, 221, 0.2);
  /* Card PRE */
  --card-bg: rgb(26, 26, 26); /* Fondo de vidrio ultra sutil */
  --shadow-box: rgba(0, 255, 255, 0.1);
  --shadow-cian: rgba(255, 0, 255, 0.1);
  --shadow-rosa: rgba(255, 255, 255, 0.05);
  /* Input */
  --input-bg: rgba(26, 26, 26, 0.5);
  /* Border */
  --border-br: rgba(64, 64, 64);
}

/* body con imagenes */
/* body {
  background-image: var(--background-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  min-height: 100vh;
  padding-top: 60px;
} */

/* body con solo colores */
body{
  background: var(--background-bd);
  min-height: 100vh;
  padding-top: 60px;
}

.border-topp {
  border-top: 1px solid var(--border-br);
}

.border-rightt {
  border-right: 1px solid var(--border-br);
}

.navbar {
  margin: auto;
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border-bg);
  width: 98vw;
  border-radius: 30px;
  box-shadow: 0 2px 5px var(--shadow-nav);
}

.modal-content {
  border-radius: 20px;
  background: var(--glass-bg) !important;
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--glass-border);
  transition: background 0.3s ease; /* Para que el cambio sea suave */
}

.modal-header,
.modal-footer {
  border: none;
}

.modal-backdrop {
  --bs-backdrop-bg: var(--modal-backdrop);
  --bs-backdrop-opacity: 1; 
}
.modal-backdrop.show {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.btn-glass {
  color: var(--btn-glass-color);
  backdrop-filter: blur(8px) saturate(var(--glass-saturate)); /* Reutilizamos saturate */
  -webkit-backdrop-filter: blur(8px) saturate(var(--glass-saturate));
  border-radius: 100px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Efecto Liquid: Sombra externa + Brillo interno */
  box-shadow:
    0 4px 5px var(--btn-glass-shadow),
    inset 0 3px 6px var(--btn-glass-glow);
}

.btn-glass:hover {
  transform: translateY(-2px);
  box-shadow:
    0 6px 10px var(--btn-glass-shadow),
    inset 0 1px 4px var(--btn-glass-glow);
  filter: brightness(1.1);
}

.btn-glass:active {
  transform: translateY(0);
  box-shadow: 0 2px 5px var(--btn-glass-shadow);
  border: 1px solid var(--btn-glass-active);
}

.btn-glass-success {
  background: var(--btn-glass-bg);
  border: 1px solid var(--btn-glass-border);
}

.btn-glass-danger {
  background: rgba(255, 0, 0, 0.6);
  border: 1px solid var(--btn-glass-border);
}

.btn-glass-danger:hover {
  background: rgba(255, 0, 0, 0.6);
}

.btn-glass-warning {
  background: rgba(255, 230, 0, 0.3);
  border: 1px solid var(--btn-glass-border);
}

.btn-glass-warning:hover {
  background: rgba(255, 230, 0, 0.6);
}

.btn-glass-menu {
  background: rgba(0, 0, 255, 0.3);
  border: 1px solid var(--btn-glass-border);
}

.btn-glass-menu:hover {
  background: rgba(0, 0, 255, 0.6);
}

.btn-glass-circle {
  display: inline-flex; /* Fundamental para centrado perfecto */
  align-items: center; /* Centrado vertical */
  justify-content: center; /* Centrado horizontal */
  border-radius: 50% !important; /* Fuerza la redondez */
  padding: 0 !important; /* Eliminamos padding para que width=height sea real */
}

/* PEQUEÑO (Small) */
.btn-sm-circle {
  width: 32px;
  height: 32px;
  font-size: 0.85rem; /* Ajusta el tamaño del icono de Bootstrap */
}

/* MEDIANO (Medium) - El tamaño por defecto */
.btn-md-circle {
  width: 42px;
  height: 42px;
  font-size: 1.1rem;
}

/* GRANDE (Large) */
.btn-lg-circle {
  width: 56px;
  height: 56px;
  font-size: 1.5rem;
}

/* Formularios compactos */
.form-control,
.form-control-sm {
  border-radius: 50px;
  box-shadow: 0 3px 5px var(--btn-glass-shadow);
}

.form-select {
  border-radius: 50px;
  box-shadow: 0 3px 5px var(--btn-glass-shadow);
}

.glass-input {
  background: var(--input-bg);
  backdrop-filter: blur(5px);
}

.glass-input:focus {
  outline: none;
  border: 1px solid rgb(0, 255, 200);
}

/* Estilo general del sidebar */
.custom-glass-sidebar {
  backdrop-filter: blur(15px) saturate(150%); /* El desenfoque clave */
  border-right: 1px solid rgba(0, 0, 0, 0.1) !important;
  border-radius: 25px;
}

.custom-glass-sidebar {
  background: var(--menu-bg);
}

#menuAccordion {
  --bs-accordion-btn-focus-box-shadow: none;
}

.accordion-item {
  background: transparent !important;
  border: none !important;
  position: relative;
}

.accordion-item::after {
  content: "";
  position: absolute;
  left: 40px; /* Espacio sin pintar al inicio */
  right: 40px; /* Espacio sin pintar al final */
  height: 1px;
  background-color: var(--border-bg); /* Color sutil */
}

.accordion-item:last-child::after {
  display: none;
}

.accordion-item:hover {
  border-radius: 25px;
  box-shadow:
    0 6px 15px var(--btn-glass-shadow),
    inset 0 1px 4px var(--btn-glass-glow);
  filter: brightness(1.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.offcanvas-header {
  padding: 0.5rem;
}

.menu-item,
.submenu-item {
  display: flex;
  align-items: center;
  padding: 0.7rem 1.2rem;
  text-decoration: none;
}

.accordion-button {
  background: rgba(0, 0, 0, 0);
}

.accordion-button:not(.collapsed) {
  background-color: transparent !important;
  box-shadow: none !important;
}

.submenu-item {
  padding-left: 2.5rem;
  font-size: 0.9rem;
}

.submenu-item:hover {
  border-radius: 25px;
  box-shadow:
    0 6px 15px var(--btn-glass-shadow),
    inset 0 1px 4px var(--btn-glass-glow);
  filter: brightness(1.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--subItemText-bg);
}

/* CARDS PRE */
.card-premium {
  background: var(--card-bg);
  border: 0px solid var(--btn-glass-border);
  border-radius: 25px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Resultados flotantes para búsqueda de productos/clientes */
.suggestion-item {
  padding: 10px 15px;
  cursor: pointer;
  border-bottom: 1px solid var(--glass-border);
}

.suggestion-item:hover {
  background: rgba(13, 110, 253, 0.1);
}

/* Cantidad en el carrito */
.qty-input {
  width: 60px;
  text-align: center;
  border: none;
  background: transparent;
  font-weight: bold;
}

#customerSuggestions {
  background: var(--card-bg, #ffffff);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  max-height: 200px;
  overflow-y: auto;
}

#customerSuggestions .list-group-item {
  background: transparent;
  color: inherit;
  transition: all 0.2s;
}

#customerSuggestions .list-group-item:hover {
  background: rgba(13, 110, 253, 0.1);
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999; /* Por encima de todo */
  color: white;
  backdrop-filter: blur(4px);
}

.table-container-glass {
  border-radius: 15px; /* Aquí controlas qué tan redondo lo quieres */
  overflow: hidden; /* ¡CRUCIAL! Esto recorta las esquinas de la tabla */
  border: 0px solid rgba(255, 255, 255, 0.298);
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(15px);
}

/* Ajustes para que la tabla interna se vea perfecta */
.table-container-glass .table {
  margin-bottom: 0;
  background: transparent !important;
}

/* Quitar el borde de la última fila para que no choque con el redondeo */
.table-container-glass .table tr:last-child td {
  border-bottom: 0;
}

/* Estilo para las celdas */
.table-container-glass td {
  background: transparent !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}
/* Estilo para el switch de modo oscuro */
.custom-switch {
  cursor: pointer;
  width: 2.5em !important;
  height: 1.25em !important;
}

.dropdown-item:active {
  background-color: var(--btn-glass-active) !important;
}

/* ==========================================================================
   Módulo Asistente IA (Voice/Text-to-SQL)
   ========================================================================== */
:root {
  --ia-primary: #6366f1;
  --ia-secondary: #8b5cf6;
  --ia-accent: #6366f1;
  --ia-glow: rgba(99, 102, 241, 0.2);
  --ia-success: #10b981;
  --ia-danger: #ef4444;
}

[data-bs-theme="dark"] {
  --ia-accent: #a78bfa;
  --ia-glow: rgba(139, 92, 246, 0.35);
}

.ia-wrapper {
  min-height: calc(100vh - 60px);
  padding: 2rem 1.5rem 4rem;
  background: radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, .06) 0%, transparent 65%),
              radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, .05) 0%, transparent 65%);
}

.ia-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.ia-header .ia-badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: linear-gradient(135deg, var(--ia-primary), var(--ia-secondary));
  color: #fff;
  padding: .35rem 1.1rem;
  border-radius: 2rem;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: .85rem;
  box-shadow: 0 0 15px var(--ia-glow);
}

.ia-header h1 {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--ia-primary), var(--ia-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: .5rem;
}

.ia-header p {
  color: var(--bs-secondary-color);
  font-size: .95rem;
  max-width: 520px;
  margin: 0 auto;
}

/* ── Tarjeta IA Reutilizable ── */
.ia-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 1.25rem;
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  box-shadow: 0 8px 32px rgba(0, 0, 0, .08);
  padding: 1.75rem;
  transition: box-shadow .3s, border-color .3s;
}

.ia-card:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, .12), 0 0 20px var(--ia-glow);
}

/* ── Micrófono - Estado Escuchando (Pulsación) ── */
.mic-btn.listening {
  background: linear-gradient(135deg, #ef4444, #dc2626) !important;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, .6) !important;
  animation: mic-pulse 1.2s infinite;
}

@keyframes mic-pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .6); }
  70% { box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* ── Status del Habla ── */
.ia-status {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .8rem;
  min-height: 20px;
  color: var(--bs-secondary-color);
}

.ia-status.listening { color: var(--ia-danger); }
.ia-status.processing { color: var(--ia-primary); }
.ia-status.success { color: var(--ia-success); }
.ia-status.error { color: var(--ia-danger); }

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.ia-status.listening .status-dot,
.ia-status.processing .status-dot {
  animation: blink-dot 0.8s infinite alternate;
}

@keyframes blink-dot {
  from { opacity: 1; }
  to { opacity: .2; }
}

/* ── Hover Chips / Tags ── */
.ia-chip {
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s, color 0.2s;
}

.ia-chip:hover {
  transform: translateY(-2px);
  background-color: var(--ia-primary) !important;
  color: #fff !important;
}

/* ── Spinner ── */
.ia-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, .3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Tabla de Resultados ── */
.ia-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.ia-results-title {
  font-weight: 700;
  font-size: 1.1rem;
}

.ia-badge-count {
  background: linear-gradient(135deg, var(--ia-primary), var(--ia-secondary));
  color: #fff;
  padding: .2rem .75rem;
  border-radius: 1rem;
  font-size: .75rem;
  font-weight: 700;
}

.ia-table-wrap {
  overflow-x: auto;
  border-radius: .75rem;
  border: 1px solid var(--glass-border);
}

.ia-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}

.ia-table thead tr {
  background: linear-gradient(135deg, rgba(99, 102, 241, .15), rgba(139, 92, 246, .1));
}

.ia-table th {
  padding: .8rem 1rem;
  text-align: left;
  font-weight: 700;
  color: var(--ia-accent);
  border-bottom: 1px solid var(--glass-border);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.ia-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--glass-border);
  vertical-align: middle;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ia-table tbody tr:hover {
  background: rgba(99, 102, 241, .04);
}

.ia-table tbody tr:last-child td {
  border-bottom: none;
}

/* ── Estados vacíos/carga ── */
.ia-empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--bs-secondary-color);
}

.ia-empty-state i {
  font-size: 2.75rem;
  margin-bottom: 1rem;
  opacity: .35;
  color: var(--ia-primary);
}

.ia-empty-state p {
  font-size: .95rem;
}
