/* styles.css
   Eleodoro El Grande Distribuidora - Premium Design System (Material Design 3 + Glassmorphism)
   Corporate Colors: Black, Corporate Red (#E50914), Fuchsia (#FF007F), Electric Blue (#0070F3)
*/

/* -------------------------------------------------------------
   1. VARIABLES DE TEMA & CONFIGURACIÓN BASE
   ------------------------------------------------------------- */
:root {
  /* Fuentes */
  --font-family: 'Outfit', sans-serif;
  
  /* Colores Corporativos Coherentes */
  --color-primary: #E50914;      /* Rojo Corporativo */
  --color-secondary: #FF007F;    /* Fucsia */
  --color-accent: #0070F3;       /* Azul Eléctrico */
  --color-gold: #FFD700;
  
  /* Sombras y Transiciones */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.25);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius-sm: 8px;
  --border-radius-md: 16px;
  --border-radius-lg: 24px;
}

/* Modo Oscuro (Predeterminado) */
:root[data-theme="dark"] {
  --bg-app: #0A0A0C;
  --bg-surface: #141417;
  --bg-surface-elevated: #1E1E22;
  --bg-glass: rgba(20, 20, 23, 0.7);
  --bg-sidebar: #0C0C0E;
  
  --text-primary: #F3F3F5;
  --text-secondary: #A0A0AB;
  --text-muted: #6E6E77;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: var(--color-primary);
  
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: rgba(0, 0, 0, 0.4);
}

/* Modo Claro */
:root[data-theme="light"] {
  --bg-app: #F4F6F9;
  --bg-surface: #FFFFFF;
  --bg-surface-elevated: #F9FAFB;
  --bg-glass: rgba(255, 255, 255, 0.75);
  --bg-sidebar: #0F172A;
  
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  
  --border-color: rgba(0, 0, 0, 0.08);
  --border-focus: var(--color-primary);
  
  --glass-border: rgba(0, 0, 0, 0.05);
  --glass-shadow: rgba(0, 0, 0, 0.06);
}

/* Reset de Estilos */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Scrollbar Custom */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-secondary);
}

/* -------------------------------------------------------------
   2. PANTALLA DE LOGIN (GLASSMORPHISM)
   ------------------------------------------------------------- */
#login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100vh;
  background: linear-gradient(135deg, #0A0A0C 0%, #1A0D15 50%, #0D1624 100%);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  transition: transform 0.5s cubic-bezier(0.77, 0, 0.175, 1);
}

#login-container.login-view-hidden {
  transform: translateY(-100vh);
}

.login-card {
  width: 100%;
  max-width: 440px;
  padding: 40px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 24px 64px var(--glass-shadow);
  text-align: center;
  animation: fadeIn 0.8s ease-out;
}

.login-logo-area {
  margin-bottom: 24px;
}

.login-logo-area svg {
  filter: drop-shadow(0 4px 12px rgba(229, 9, 20, 0.4));
}

.login-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.input-group {
  position: relative;
  margin-bottom: 24px;
  width: 100%;
}

.input-group input {
  width: 100%;
  padding: 16px 16px 16px 48px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-size: 16px;
  outline: none;
  transition: var(--transition);
}

.input-group input:focus {
  border-color: var(--border-focus);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 12px rgba(229, 9, 20, 0.25);
}

.input-group label {
  position: absolute;
  left: 48px;
  top: 18px;
  color: var(--text-muted);
  pointer-events: none;
  font-size: 14px;
  transition: var(--transition);
}

.input-group input:focus ~ label,
.input-group input:not(:placeholder-shown) ~ label {
  top: -8px;
  left: 12px;
  font-size: 11px;
  color: var(--color-primary);
  background: var(--bg-surface-elevated);
  padding: 0 6px;
  border-radius: 4px;
}

.input-icon {
  position: absolute;
  left: 16px;
  top: 17px;
  color: var(--text-muted);
  font-size: 20px;
}

.login-error-msg {
  color: var(--color-primary);
  font-size: 13px;
  margin-top: -12px;
  margin-bottom: 20px;
  text-align: left;
  display: none;
}

.btn-login {
  width: 100%;
  padding: 16px;
  background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  color: white;
  border: none;
  border-radius: var(--border-radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(229, 9, 20, 0.3);
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(229, 9, 20, 0.45);
}

.btn-login:active {
  transform: translateY(0);
}

/* -------------------------------------------------------------
   3. ESTRUCTURA APP PRINCIPAL (LAYOUT GENERAL)
   ------------------------------------------------------------- */
#app-container {
  display: grid;
  grid-template-columns: 260px 1fr;
  width: 100%;
  height: 100vh;
  transition: var(--transition);
}

#app-container.sidebar-collapsed {
  grid-template-columns: 72px 1fr;
}

#app-container.app-view-hidden {
  display: none;
}

/* BARRA LATERAL (SIDEBAR) */
.sidebar {
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  transition: var(--transition);
}

.sidebar-brand {
  padding: 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-brand svg {
  transition: var(--transition);
}

.sidebar-collapsed .sidebar-brand svg {
  opacity: 0;
  width: 0;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 8px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 16px 12px 8px 12px;
  letter-spacing: 0.8px;
  transition: var(--transition);
}

.sidebar-collapsed .nav-section-title {
  opacity: 0;
  margin: 0;
  height: 0;
  overflow: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--border-radius-sm);
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(229, 9, 20, 0.15) 0%, rgba(255, 0, 127, 0.05) 100%);
  color: var(--color-secondary);
  font-weight: 600;
  border-left: 4px solid var(--color-primary);
}

.nav-icon {
  font-size: 22px;
}

.sidebar-collapsed .nav-label {
  display: none;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.user-profile-widget {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  transition: var(--transition);
}

.sidebar-collapsed .user-profile-widget {
  display: none;
}

.user-profile-widget .avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  font-size: 14px;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* ÁREA DE CONTENIDO Y NAVBAR SUPERIOR */
.main-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.top-navbar {
  height: 70px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-surface);
  z-index: 10;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.navbar-title {
  font-size: 20px;
  font-weight: 700;
}

.db-status-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(0, 112, 243, 0.15);
  color: var(--color-accent);
  border: 1px solid rgba(0, 112, 243, 0.3);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.notification-bell-wrapper {
  position: relative;
  cursor: pointer;
}

.online-status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.green {
  background-color: #22C55E;
  box-shadow: 0 0 8px #22C55E;
}

.status-dot.orange {
  background-color: #F97316;
  box-shadow: 0 0 8px #F97316;
}

/* CONTENEDOR DE VISTAS */
.views-wrapper {
  flex: 1;
  overflow: hidden;
  position: relative;
  padding: 24px;
}

.app-view {
  position: absolute;
  top: 24px;
  left: 24px;
  right: 24px;
  bottom: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  overflow-y: auto;
}

.app-view.active-view {
  opacity: 1;
  pointer-events: all;
}

/* -------------------------------------------------------------
   4. MÓDULO 1: CAJA REGISTRADORA (POS UI)
   ------------------------------------------------------------- */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  height: 100%;
  gap: 24px;
  overflow: hidden;
}

.pos-main-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.search-bar-pos {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 16px;
  margin-bottom: 16px;
}

.input-search-wrapper, .scanner-mock-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-search-wrapper span, .scanner-mock-wrapper span {
  position: absolute;
  left: 16px;
  color: var(--text-muted);
}

.input-search-wrapper input, .scanner-mock-wrapper input {
  width: 100%;
  padding: 12px 12px 12px 48px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  outline: none;
  font-size: 14px;
}

.input-search-wrapper input:focus, .scanner-mock-wrapper input:focus {
  border-color: var(--color-secondary);
  box-shadow: 0 0 8px rgba(255, 0, 127, 0.2);
}

.quick-category-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.chip {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
}

.chip:hover, .chip.active {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

/* Grid de Productos */
.pos-products-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  overflow-y: auto;
  padding-bottom: 20px;
}

/* Cards de Producto */
.product-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-secondary);
}

.product-image-container {
  height: 110px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--bg-surface-elevated);
  border-radius: var(--border-radius-sm);
  margin-bottom: 12px;
  position: relative;
}

.product-image-container img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

.product-image-container .no-image-placeholder {
  font-size: 32px;
  color: var(--text-muted);
}

.product-brand-badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.product-name-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  height: 38px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.product-footer-price {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.product-price-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-secondary);
}

.product-stock-pill {
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
}

.product-stock-pill.in-stock {
  background-color: rgba(34, 197, 94, 0.15);
  color: #22C55E;
}

.product-stock-pill.low-stock {
  background-color: rgba(249, 115, 22, 0.15);
  color: #F97316;
}

.product-stock-pill.out-of-stock {
  background-color: rgba(229, 9, 20, 0.15);
  color: var(--color-primary);
}

/* Sidebar del Carrito */
.pos-sidebar-panel {
  background-color: var(--bg-surface);
  border-left: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0; /* Soluciona desbordamiento en flexbox */
  overflow-y: auto; /* Scrollbar en toda la barra lateral si la pantalla es muy pequeña */
  box-shadow: var(--shadow-sm);
}

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.cart-items-container {
  flex: 1;
  overflow-y: auto;
  min-height: 120px; /* Asegura espacio mínimo para items */
  margin-bottom: 16px;
}

.empty-cart-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  gap: 12px;
}

.empty-cart-msg span {
  font-size: 48px;
}

/* Elementos del Carrito */
.cart-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.cart-item-info h5 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.cart-item-info .item-unit-price {
  font-size: 11px;
  color: var(--text-muted);
}

.cart-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-control {
  display: flex;
  align-items: center;
  background-color: var(--bg-surface-elevated);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.qty-control button {
  border: none;
  background: none;
  width: 24px;
  height: 24px;
  cursor: pointer;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qty-control span.qty-num {
  font-size: 12px;
  font-weight: 600;
  width: 28px;
  text-align: center;
}

.cart-item-total {
  font-weight: 700;
  font-size: 13px;
  min-width: 60px;
  text-align: right;
}

/* Selectores de Cliente y Totales */
.cart-client-selector {
  margin-bottom: 16px;
}

.cart-client-selector label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

.flex-row {
  display: flex;
  gap: 8px;
}

.flex-row select {
  flex: 1;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  outline: none;
}

.cart-totals {
  background-color: var(--bg-surface-elevated);
  border-radius: var(--border-radius-sm);
  padding: 16px;
  margin-bottom: 16px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.total-row.discount input {
  width: 80px;
  text-align: right;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  padding: 2px 6px;
  border-radius: 4px;
  outline: none;
}

.total-row.main-total {
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
  margin-top: 4px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
}

.total-row.main-total span:last-child {
  color: var(--color-primary);
}

.cart-observacion input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 0;
  outline: none;
  font-size: 12px;
  margin-bottom: 16px;
}

.cart-actions-grid {
  display: flex;
  gap: 8px;
}

.cart-actions-grid button {
  flex: 1;
  padding: 14px;
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  font-weight: 600;
}

/* -------------------------------------------------------------
   5. MÓDULO 2: BUSINESS INTELLIGENCE & REPORTING
   ------------------------------------------------------------- */
.bi-dashboard-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.bi-filters-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  background-color: var(--bg-surface);
  padding: 16px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}

.filter-group select {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: var(--border-radius-sm);
  outline: none;
}

/* Tarjetas KPI */
.kpi-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.kpi-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-icon span {
  font-size: 24px;
}

.kpi-icon.blue { background-color: rgba(0, 112, 243, 0.15); color: var(--color-accent); }
.kpi-icon.green { background-color: rgba(34, 197, 94, 0.15); color: #22C55E; }
.kpi-icon.fuchsia { background-color: rgba(255, 0, 127, 0.15); color: var(--color-secondary); }
.kpi-icon.red { background-color: rgba(229, 9, 20, 0.15); color: var(--color-primary); }

.kpi-data {
  display: flex;
  flex-direction: column;
}

.kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.kpi-value {
  font-size: 20px;
  font-weight: 700;
  margin: 2px 0;
}

.kpi-trending {
  font-size: 11px;
  font-weight: 600;
}

.kpi-trending.green { color: #22C55E; }
.kpi-trending.red { color: var(--color-primary); }

/* Gráficos Grid */
.bi-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.chart-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.chart-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.chart-wrapper {
  position: relative;
  height: 220px;
  width: 100%;
}

/* Listas Rankings */
.bi-tops-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.top-list-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 20px;
}

.top-list {
  list-style: none;
  margin-top: 12px;
}

.top-list li {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}

.top-list li:last-child {
  border-bottom: none;
}

/* -------------------------------------------------------------
   6. MÓDULO 3: ERP INVENTARIO / TABLAS Y FORMULARIOS
   ------------------------------------------------------------- */
.erp-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--bg-surface);
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  padding: 20px;
  overflow: hidden;
}

.table-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.buttons-row {
  display: flex;
  gap: 8px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box span {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
}

.search-box input {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 12px 10px 38px;
  border-radius: var(--border-radius-sm);
  outline: none;
  font-size: 13px;
  width: 240px;
}

/* Tablas Corporativas */
.table-responsive {
  flex: 1;
  overflow-y: auto;
}

.erp-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.erp-table th {
  background-color: var(--bg-surface-elevated);
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-color);
}

.erp-table td {
  padding: 14px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.erp-table tr:hover td {
  background-color: rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
}

.actions-cell {
  display: flex;
  gap: 8px;
}

/* -------------------------------------------------------------
   7. PANEL ADMINISTRADOR
   ------------------------------------------------------------- */
.admin-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
}

.admin-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
}

.tab-btn {
  background: none;
  border: none;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 2px solid transparent;
}

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.admin-tab-content {
  flex: 1;
  overflow: hidden;
}

.tab-pane {
  display: none;
  height: 100%;
  flex-direction: column;
}

.tab-pane.active-pane {
  display: flex;
}

/* -------------------------------------------------------------
   8. COMPONENTES GLOBALES (BOTONES, TOASTS, MODALES)
   ------------------------------------------------------------- */
/* Botones Estilo Material Design 3 */
button {
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background-color: var(--color-primary);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
}

.btn-primary:hover {
  background-color: #b3070f;
  box-shadow: 0 4px 12px rgba(229, 9, 20, 0.25);
}

.btn-secondary {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.btn-icon-secondary {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px;
  border-radius: var(--border-radius-sm);
}

.btn-icon-secondary:hover {
  color: var(--color-primary);
  background-color: rgba(255, 255, 255, 0.05);
}

.btn-text-error {
  background: none;
  border: none;
  color: var(--color-primary);
  font-weight: 600;
  font-size: 13px;
}

.btn-text-error:hover {
  text-decoration: underline;
}

/* Modales Material Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1100;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  width: 100%;
  max-width: 500px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.9);
  transition: var(--transition);
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

.modal-card.modal-large {
  max-width: 850px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
}

.modal-close-btn:hover {
  color: var(--color-primary);
}

/* Formularios de Modal */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--border-radius-sm);
  outline: none;
}

.form-control:focus {
  border-color: var(--color-secondary);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}

/* Toast Notifications Area */
.toast-area {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}

.toast {
  padding: 14px 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-left: 5px solid var(--color-primary);
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 500;
  animation: slideInRight 0.3s ease-out;
}

.toast.success { border-left-color: #22C55E; }
.toast.warning { border-left-color: #F97316; }
.toast.error { border-left-color: var(--color-primary); }

/* -------------------------------------------------------------
   9. TICKET TÉRMICO / IMPRESIÓN / COMISIONES
   ------------------------------------------------------------- */
.thermal-ticket-container {
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  color: #000000;
  background-color: #FFFFFF;
  padding: 20px;
  border: 1px solid #CCCCCC;
  border-radius: 4px;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.ticket-header {
  text-align: center;
  border-bottom: 1px dashed #000000;
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.ticket-header h4 { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.ticket-header p { font-size: 11px; margin-bottom: 2px; }

.ticket-meta {
  border-bottom: 1px dashed #000000;
  padding-bottom: 8px;
  margin-bottom: 8px;
  font-size: 11px;
}

.ticket-table {
  width: 100%;
  border-bottom: 1px dashed #000000;
  margin-bottom: 10px;
}

.ticket-table th { font-weight: 700; font-size: 11px; padding: 4px 0; border-bottom: 1px solid #000000; }
.ticket-table td { padding: 4px 0; font-size: 11px; vertical-align: top; }

.ticket-totals-section {
  border-bottom: 1px dashed #000000;
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.ticket-total-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}

.ticket-total-row.big {
  font-weight: 700;
  font-size: 14px;
}

.ticket-footer {
  text-align: center;
  font-size: 11px;
  padding-top: 8px;
}

/* -------------------------------------------------------------
   10. ANIMACIONES Y TRANSICIONES
   ------------------------------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Utilidades de Visualización */
.hide { display: none !important; }
.show { display: block !important; }

/* -------------------------------------------------------------
   11. DISEÑO RESPONSIVE Y MOBILE FIRST
   ------------------------------------------------------------- */
@media (max-width: 1024px) {
  #app-container {
    grid-template-columns: 72px 1fr;
  }
  .sidebar-brand svg {
    opacity: 0;
    width: 0;
  }
  .nav-label {
    display: none;
  }
  .nav-section-title {
    display: none;
  }
  .user-profile-widget {
    display: none;
  }
  .bi-charts-grid {
    grid-template-columns: 1fr;
  }
  .pos-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  #app-container {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    z-index: 1000;
    width: 260px;
    height: 100vh;
  }
  #app-container.sidebar-open .sidebar {
    left: 0;
  }
  .nav-label {
    display: block;
  }
  .user-profile-widget {
    display: flex;
  }
  .top-navbar {
    padding: 0 16px;
  }
  .pos-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  .search-bar-pos {
    grid-template-columns: 1fr;
  }
  .kpi-cards-grid {
    grid-template-columns: 1fr 1fr;
  }
  .bi-tops-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .kpi-cards-grid {
    grid-template-columns: 1fr;
  }
}

/* -------------------------------------------------------------
   12. ESTILOS DE IMPRESIÓN PARA TICKET TÉRMICO
   ------------------------------------------------------------- */
@media print {
  body * {
    visibility: hidden;
  }
  #modal-ticket, #modal-ticket *, .thermal-ticket-container, .thermal-ticket-container * {
    visibility: visible;
  }
  #modal-ticket {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: auto;
    background: none;
    backdrop-filter: none;
  }
  .modal-card {
    border: none;
    box-shadow: none;
    padding: 0;
  }
  .modal-header, .modal-actions-ticket {
    display: none !important;
  }
  .thermal-ticket-container {
    border: none;
    box-shadow: none;
    margin: 0;
    padding: 0;
    width: 100%;
  }
}

/* -------------------------------------------------------------
   13. ESTILOS DASHBOARD GENERADOR DE GUÍAS EXCEL (RPA)
   ------------------------------------------------------------- */
.btn-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.btn-tab.active {
  color: #ffffff;
  background: var(--color-primary);
  box-shadow: 0 4px 14px rgba(229, 9, 20, 0.3);
}

.excel-dropzone:hover {
  border-color: var(--color-primary) !important;
  background: rgba(229, 9, 20, 0.1) !important;
  transform: translateY(-2px);
}

.radio-mode-card {
  transition: all 0.2s ease;
}

.radio-mode-card:hover {
  border-color: var(--color-primary) !important;
  background: rgba(229, 9, 20, 0.05) !important;
}

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

.rotate {
  animation: spin-rotate 1s linear infinite;
}

