/* Estilos específicos para la interfaz del POS */
.card {
  width: 100%;
  max-width: 900px;
  margin: auto;
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  min-height: calc(100vh - 5rem);
}
#login {
  min-height: auto !important; /* Tarjeta de login compacta y pequeña */
}
.tab {
  min-height: calc(100vh - 15rem);
}
.tab-btn {
  flex: 1 1 0;
  background-color: #f3f4f6;
  color: #4b5563;
  font-weight: 600;
  min-width: 0;
  white-space: normal;
  text-align: center;
  transition: all 0.2s;
}
.tab-btn.active {
  background-color: #2563eb;
  color: white;
}
.producto-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  background-color: #f9fafb;
  border: 1px solid #f3f4f6;
  transition: all 0.2s;
}
.producto-row:hover {
  background-color: #f3f4f6;
}
.producto-controls {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  flex-wrap: nowrap;
}
.producto-controls button {
  min-width: 0;
  min-height: 46px;
  font-size: 1rem;
  transition: all 0.15s;
}
.producto-controls button:nth-child(1),
.producto-controls button:nth-child(2) {
  flex: 0 0 42%;
}
.producto-controls button:nth-child(3) {
  flex: 0 0 16%;
}
.producto-controls button i {
  display: inline-block;
  width: 1em;
  height: 1em;
  text-align: center;
  line-height: 1em;
  pointer-events: none;
}
.producto-info {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto auto;
  gap: 0.75rem;
  align-items: center;
}
.producto-info span:first-child {
  font-weight: 700;
  color: #1f2937;
  min-width: 0;
}
.producto-info span:nth-child(2) {
  text-align: right;
  white-space: nowrap;
  font-size: 0.95rem;
  color: #4b5563;
}
.producto-info .producto-cantidad {
  font-size: 1.1rem;
  font-weight: 800;
  color: #2563eb;
  text-align: right;
  white-space: nowrap;
}
.app-actions,
.button-row {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-start;
}
.app-actions {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.25rem;
  scrollbar-width: none;
}
.app-actions::-webkit-scrollbar {
  display: none;
}
.app-actions button,
.button-row button {
  min-width: 110px;
  flex: 0 0 auto;
  white-space: nowrap;
}
body {
  background: #f3f4f6;
  color: #111827;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Dark Mode */
body.dark {
  background: #0f172a;
  color: #f8fafc;
}
body.dark .card {
  background: #1e293b;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.45);
}
body.dark .tab-btn {
  background-color: #334155;
  color: #cbd5e1;
}
body.dark .tab-btn.active {
  background-color: #2563eb;
  color: white;
}
body.dark .producto-row {
  background: #334155;
  border-color: #475569;
}
body.dark .producto-row:hover {
  background: #475569;
}
body.dark .producto-info span:first-child {
  color: #f8fafc;
}
body.dark .producto-info span:nth-child(2) {
  color: #94a3b8;
}
body.dark .producto-info .producto-cantidad {
  color: #3b82f6;
}
/* Ajuste de color para los textos de los labels y p dentro de config en modo oscuro */
body.dark .text-gray-600,
body.dark .text-gray-700,
body.dark .text-gray-800,
body.dark .text-gray-500,
body.dark #config label,
body.dark #config p {
  color: #f8fafc !important; /* Asegurar que los textos sean claros */
}
body.dark .border {
  border-color: #475569 !important;
}
body.dark input,
body.dark textarea,
body.dark select {
  background: #1e293b !important;
  color: #f8fafc !important;
  border-color: #475569 !important;
}
body.dark #logVentas li {
  background: #334155 !important;
  color: #f8fafc !important;
  border: 1px solid #475569;
}
body.dark #payment-section {
  background-color: #334155 !important;
  border-color: #475569 !important;
}
body.dark label {
  color: #f8fafc !important; /* Reafirmar que los labels siempre sean claros */
}

body.dark .text-gray-500,
body.dark #config p,
body.dark #config p.text-sm.text-gray-500 {
  color: #cbd5e1 !important;
}
body.dark #config label,
body.dark #config label.flex.items-center,
body.dark #config label.flex.items-center.font-medium.text-gray-800 {
  color: #f8fafc !important;
}

/* Color amarillo brillante para el sol en modo claro */
#icon-sun,
#icon-sun i {
  color: #fbbf24 !important;
}

/* Estilos personalizados para las cajas de configuración (Preferencias) */
.config-box {
  background-color: #f9fafb;
  border-color: #e5e7eb;
}
.config-label {
  color: #1f2937;
}
.config-desc {
  color: #4b5563;
}

/* Override para Modo Oscuro en Preferencias con máxima especificidad */
body.dark .config-box {
  background-color: #334155 !important;
  border-color: #475569 !important;
}
body.dark .config-label {
  color: #f8fafc !important;
}
body.dark .config-desc {
  color: #cbd5e1 !important;
}

/* .app-actions #theme-toggle, #theme-toggle removidos */
.selector-obsoleto-removido {
  /* removido */
  /* removido */
  /* removido */
  /* removido */
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}
#nombreImpresora {
  word-break: break-word;
  white-space: normal;
}
h2.text-xl {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
  line-height: 1.3;
}
h2.text-xl b {
  display: inline-block;
  min-width: 0;
}
h2.text-xl.header-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex-wrap: nowrap;
  gap: 0.5rem;
  padding-bottom: 0.25rem;
  scrollbar-width: none;
}
h2.text-xl.header-scroll::-webkit-scrollbar {
  display: none;
}
h2.text-xl.header-scroll .header-item {
  flex: 0 0 auto;
  white-space: nowrap;
}
h2.text-xl.header-scroll b {
  margin-right: 0.15rem;
}

@media (max-width: 768px) {
  h2.text-xl {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
    gap: 0.35rem;
  }
  h2.text-xl b,
  h2.text-xl span {
    white-space: nowrap;
  }
  .card {
    max-width: 95%;
    padding: 16px;
  }
  .producto-row {
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
    align-items: center;
  }
  .producto-info {
    grid-template-columns: minmax(120px, 1fr) auto auto;
  }
  .producto-controls {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }
  .producto-controls button:nth-child(1),
  .producto-controls button:nth-child(2) {
    flex: 0 0 45%;
  }
  .producto-controls button:nth-child(3) {
    flex: 0 0 100%;
  }
  .tab-btn {
    min-width: 0;
    flex: 1 1 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
  }
  .button-row {
    flex-direction: column;
  }
  .app-actions {
    justify-content: flex-start;
  }
  .app-actions button {
    width: auto;
    min-width: 90px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
  }
  .button-row button {
    width: 100%;
    min-width: 0;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
  }
  h2.text-xl.header-scroll {
    gap: 0.35rem;
    font-size: 0.9rem;
  }
  h2.text-xl.header-scroll b,
  h2.text-xl.header-scroll span {
    white-space: nowrap;
  }
  #totalSeleccionado {
    text-align: left;
  }
}

/* Tarea F.5: Estilos de Transición e Interacciones para Gestos Swipe Táctiles (Sumar / Restar) */
.producto-row {
  touch-action: pan-y; /* Permite el scroll vertical normal pero indica interacción táctil */
  position: relative;
  will-change: transform, background-color, border-color;
  transition: transform 0.15s ease-out, background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.15s ease;
}

/* Estado deslizar a la derecha (Sumar - Verde) */
.producto-row.swipe-sumar {
  background-color: #ecfdf5 !important; /* bg-green-50 */
  border-color: #10b981 !important; /* border-green-500 */
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15) !important;
}
body.dark .producto-row.swipe-sumar {
  background-color: rgba(16, 185, 129, 0.15) !important; /* Verde traslúcido en modo oscuro */
  border-color: #10b981 !important;
}

/* Estado deslizar a la izquierda (Restar - Amarillo/Naranja) */
.producto-row.swipe-restar {
  background-color: #fffbeb !important; /* bg-yellow-50 */
  border-color: #f59e0b !important; /* border-yellow-500 */
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15) !important;
}
body.dark .producto-row.swipe-restar {
  background-color: rgba(245, 158, 11, 0.15) !important; /* Amarillo traslúcido en modo oscuro */
  border-color: #f59e0b !important;
}

/* Tarea G.3 / H.3: Forzar el contraste perfecto en la pantalla de actualización */
#updating-screen {
  background-color: #ffffff !important;
}
#updating-screen p,
#updating-screen span {
  color: #111827 !important; /* Texto gris muy oscuro/negro en fondo blanco */
}
#updating-screen .bg-gray-100 {
  background-color: #f3f4f6 !important; /* Fondo del loader claro */
  border-color: #e5e7eb !important;
}

/* Ajustes específicos para Modo Oscuro en la pantalla de actualización */
body.dark #updating-screen {
  background-color: #0f172a !important; /* Fondo oscuro idéntico al body */
}
body.dark #updating-screen p,
body.dark #updating-screen span {
  color: #f8fafc !important; /* Texto blanco puro en modo oscuro */
}
body.dark #updating-screen .bg-gray-100 {
  background-color: #1e293b !important; /* Fondo del loader en modo oscuro */
  border-color: #334155 !important;
}

/* Quitar scroll de pantalla completa en login o actualización de forma hermética */
body:has(#login:not(.hidden)),
body:has(#updating-screen:not(.hidden)) {
  overflow: hidden !important;
  height: 100vh !important;
}