/* --- BaitFlow Estilos Core y Variables --- */
:root {
  /* Paleta de Colores Marino Premium */
  --bg-primary: #0a1128;
  --bg-secondary: #101f42;
  --bg-panel: rgba(16, 31, 66, 0.65);
  --border-glass: rgba(0, 242, 254, 0.12);
  --border-glass-hover: rgba(0, 242, 254, 0.3);
  
  --text-main: #f4f6fc;
  --text-muted: #8d9bb5;
  --text-inverse: #0a1128;
  
  /* Colores de Acento */
  --accent-cyan: #00f2fe;
  --accent-blue: #4facfe;
  --accent-orange: #ff7b54;
  --accent-red: #ff4a5a;
  --accent-green: #00e676;
  
  /* Fuentes */
  --font-family-title: 'Outfit', sans-serif;
  --font-family-body: 'Plus Jakarta Sans', sans-serif;
  
  /* Transiciones y Sombras */
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --shadow-neon: 0 0 15px rgba(0, 242, 254, 0.2);
  
  --sidebar-width: 260px;
}

/* --- Reseteo y Base --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family-body);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
  height: 100vh;
  display: flex;
}

body.dark-theme {
  background-image: 
    radial-gradient(at 0% 0%, rgba(16, 31, 66, 0.5) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(10, 17, 40, 0.8) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(0, 242, 254, 0.03) 0px, transparent 50%);
  background-attachment: fixed;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-title);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* --- Layout Principal --- */
.app-container {
  display: flex;
  width: 100%;
  height: 100vh;
  position: relative;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  padding: 24px 32px 32px 32px;
  position: relative;
}

/* --- Cabecera --- */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 16px;
}

.top-header h1 {
  font-size: 2rem;
  background: linear-gradient(135deg, #fff 0%, var(--accent-blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-muted {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* --- Sidebar (PC) --- */
.sidebar {
  width: var(--sidebar-width);
  background-color: rgba(10, 17, 40, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  padding: 24px;
  z-index: 10;
  transition: var(--transition-smooth);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
  padding-left: 8px;
}

.logo-icon {
  font-size: 1.8rem;
  background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.4));
}

.brand-text {
  font-family: var(--font-family-title);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.03em;
}

.brand-text span {
  color: var(--accent-cyan);
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 12px;
  transition: var(--transition-smooth);
  border: 1px solid transparent;
  position: relative;
}

.menu-item i {
  font-size: 1.2rem;
  transition: var(--transition-smooth);
}

.menu-item:hover {
  color: var(--text-main);
  background-color: rgba(0, 242, 254, 0.05);
  border-color: rgba(0, 242, 254, 0.1);
}

.menu-item.active {
  color: var(--text-inverse);
  background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-blue) 100%);
  font-weight: 600;
  border-color: var(--accent-cyan);
  box-shadow: var(--shadow-neon);
}

.menu-item.active i {
  color: var(--text-inverse);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
}

/* --- Botones --- */
.btn {
  font-family: var(--font-family-title);
  font-weight: 600;
  border-radius: 12px;
  padding: 12px 20px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.95rem;
  transition: var(--transition-smooth);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-blue) 100%);
  color: var(--text-inverse);
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.2);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 242, 254, 0.35);
}

.btn-secondary {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-color: var(--border-glass);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: var(--border-glass-hover);
}

.btn-danger {
  background: linear-gradient(135deg, var(--accent-red) 0%, #d32f2f 100%);
  color: var(--text-main);
}

.btn-danger:hover {
  box-shadow: 0 4px 15px rgba(255, 74, 90, 0.3);
  transform: translateY(-2px);
}

.btn-success {
  background: linear-gradient(135deg, var(--accent-green) 0%, #00c853 100%);
  color: var(--text-inverse);
  font-weight: 700;
}

.btn-success:hover {
  box-shadow: 0 4px 15px rgba(0, 230, 118, 0.3);
  transform: translateY(-2px);
}

.btn-outline {
  background-color: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-glass-hover);
}

.btn-outline:hover {
  background-color: rgba(0, 242, 254, 0.05);
  border-color: var(--accent-cyan);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
  border-radius: 8px;
}

.btn-xs {
  padding: 6px 12px;
  font-size: 0.75rem;
  border-radius: 6px;
}

.btn-icon-badge {
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: var(--transition-smooth);
}

.btn-icon-badge:hover {
  background-color: rgba(0, 242, 254, 0.05);
  border-color: var(--accent-cyan);
}

/* Badges */
.badge {
  border-radius: 20px;
  padding: 2px 6px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

.badge-alert-count {
  background-color: var(--accent-red);
  color: white;
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
}

#header-alert-badge {
  background-color: var(--accent-red);
  color: white;
  position: absolute;
  top: -4px;
  right: -4px;
}

/* --- Bottom Nav (Mobile) --- */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 64px;
  background-color: rgba(10, 17, 40, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-glass);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
  padding: 8px 0;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 600;
  position: relative;
  flex: 1;
  transition: var(--transition-smooth);
}

.bottom-nav-item i {
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.bottom-nav-item.active {
  color: var(--accent-cyan);
}

.badge-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-red);
  border-radius: 50%;
  position: absolute;
  top: 0;
  right: 32%;
}

/* --- Vistas / Secciones --- */
.content-section {
  display: none;
  animation: fadeIn 0.4s ease-out forwards;
}

.content-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Panel de Cristal (Glassmorphism) --- */
.glass-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 24px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-premium);
  transition: var(--transition-smooth);
}

.glass-panel:hover {
  border-color: var(--border-glass-hover);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 12px;
}

.panel-header h3 {
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Colores de Iconos en Paneles */
.icon-blue { color: var(--accent-blue); }
.icon-red { color: var(--accent-red); }
.icon-cyan { color: var(--accent-cyan); }
.icon-orange { color: var(--accent-orange); }

/* --- KPIs Grid --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-premium);
  transition: var(--transition-smooth);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent-blue);
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-glass-hover);
}

.kpi-card.card-alert-kpi::before {
  background: var(--accent-green);
}

.kpi-card.card-alert-kpi.active-alerts::before {
  background: var(--accent-red);
  animation: pulse-border 1.5s infinite;
}

@keyframes pulse-border {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

.kpi-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.icon-revenue { background-color: rgba(79, 172, 254, 0.1); color: var(--accent-blue); }
.icon-machines { background-color: rgba(0, 242, 254, 0.1); color: var(--accent-cyan); }
.icon-stock { background-color: rgba(255, 123, 84, 0.1); color: var(--accent-orange); }
.icon-alerts { background-color: rgba(0, 230, 118, 0.1); color: var(--accent-green); }

.card-alert-kpi.active-alerts .icon-alerts {
  background-color: rgba(255, 74, 90, 0.1);
  color: var(--accent-red);
  animation: shake 0.5s ease-in-out infinite;
}

@keyframes shake {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-5deg); }
  75% { transform: rotate(5deg); }
}

.kpi-info {
  flex: 1;
}

.kpi-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
}

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

.kpi-trend {
  font-size: 0.75rem;
  font-weight: 700;
}

.trend-up { color: var(--accent-green); }
.trend-down { color: var(--accent-red); }

.kpi-subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}

.progress-bar-container {
  height: 6px;
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  margin-top: 6px;
  overflow: hidden;
  width: 100%;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-orange) 0%, #ff5252 100%);
  border-radius: 3px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Grillas Dashboard --- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 28px;
  margin-bottom: 28px;
}

.chart-panel {
  min-height: 320px;
}

.chart-container {
  position: relative;
  height: 260px;
  width: 100%;
}

.chart-container.donut {
  height: 240px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* --- Alertas Recientes --- */
.alerts-list-container {
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.01);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 242, 254, 0.2);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 2.2rem;
}

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

.alert-item {
  display: flex;
  gap: 14px;
  padding: 14px;
  border-radius: 12px;
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  margin-bottom: 10px;
  align-items: flex-start;
  transition: var(--transition-smooth);
}

.alert-item:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

.alert-item.alert-danger { border-left: 4px solid var(--accent-red); }
.alert-item.alert-warning { border-left: 4px solid var(--accent-orange); }
.alert-item.alert-info { border-left: 4px solid var(--accent-blue); }

.alert-icon-wrap {
  font-size: 1.1rem;
  margin-top: 2px;
}

.alert-item.alert-danger .alert-icon-wrap { color: var(--accent-red); }
.alert-item.alert-warning .alert-icon-wrap { color: var(--accent-orange); }
.alert-item.alert-info .alert-icon-wrap { color: var(--accent-blue); }

.alert-content {
  flex: 1;
}

.alert-item h5 {
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.alert-msg {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.alert-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.alert-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* --- Stock Alert list --- */
.stock-list-container {
  max-height: 240px;
  overflow-y: auto;
}

.low-stock-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.low-stock-item:last-child {
  border-bottom: none;
}

.low-stock-info h5 {
  font-size: 0.9rem;
}

.low-stock-info span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.low-stock-badge-col {
  text-align: right;
}

.text-danger { color: var(--accent-red); }
.text-warning { color: var(--accent-orange); }
.text-success { color: var(--accent-green); }

/* --- Vista de Maquinas --- */
.section-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 400px;
}

.search-box i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-box input {
  width: 100%;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 12px 16px 12px 48px;
  border-radius: 12px;
  font-size: 0.9rem;
  transition: var(--transition-smooth);
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.15);
}

.machines-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 40px;
}

/* Tarjeta de Máquina */
.machine-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-premium);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: var(--transition-smooth);
}

.machine-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-glass-hover);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}

.machine-card.status-alert { border-color: rgba(255, 74, 90, 0.3); }
.machine-card.status-offline { border-color: rgba(255, 255, 255, 0.05); opacity: 0.85; }

.mc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.mc-number {
  font-family: var(--font-family-title);
  font-size: 0.8rem;
  background-color: rgba(255, 255, 255, 0.05);
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text-muted);
}

.mc-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px currentColor;
}

.status-active .mc-status-dot { color: var(--accent-green); background-color: var(--accent-green); }
.status-alert .mc-status-dot { color: var(--accent-orange); background-color: var(--accent-orange); }
.status-offline .mc-status-dot { color: var(--text-muted); background-color: var(--text-muted); box-shadow: none; }

.mc-title {
  margin-bottom: 4px;
  font-size: 1.15rem;
}

.mc-location {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mc-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.03);
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 20px;
}

.mc-stat-item {
  display: flex;
  flex-direction: column;
}

.mc-stat-item .label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.mc-stat-item .val {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-family-title);
}

/* Termómetros de color dinámico */
.temp-ok { color: var(--accent-green); }
.temp-warning { color: var(--accent-orange); }
.temp-danger { color: var(--accent-red); }

.mc-stock-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.mc-stock-progress-wrap {
  margin-bottom: 24px;
}

.mc-stock-progress-wrap .progress-bar {
  background: linear-gradient(90deg, var(--accent-blue) 0%, var(--accent-cyan) 100%);
}

.mc-footer {
  margin-top: auto;
}

/* --- Vista Catálogo e Tablas --- */
.overflow-x {
  overflow-x: auto;
  width: 100%;
}

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

.data-table th {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-family: var(--font-family-title);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
}

.data-table td {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 0.9rem;
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.01);
}

.tbl-prod-name {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}

.prod-icon-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: rgba(0, 242, 254, 0.08);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
}

.prod-icon-circle.type-artificial { background-color: rgba(79, 172, 254, 0.08); color: var(--accent-blue); }
.prod-icon-circle.type-accessory { background-color: rgba(255, 123, 84, 0.08); color: var(--accent-orange); }

.text-right { text-align: right; }
.actions-cell {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* --- Filtros en Ventas --- */
.filter-bar {
  background: var(--bg-panel);
  padding: 16px 24px;
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  margin-bottom: 20px;
  justify-content: flex-start;
  gap: 24px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-group label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.filter-group select {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: 8px;
  outline: none;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.filter-group select:focus {
  border-color: var(--accent-cyan);
}

.sales-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.sales-stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: var(--shadow-premium);
}

.sales-stat-card .label {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: block;
}

.sales-stat-card h4 {
  font-size: 1.5rem;
  margin-top: 4px;
}

/* --- Modales --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(6, 10, 24, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 16px;
}

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

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass-hover);
  border-radius: 20px;
  box-shadow: var(--shadow-premium);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  transform: translateY(20px);
  transition: transform 0.3s ease;
  overflow: hidden;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-lg { width: 100%; max-width: 900px; }
.modal-md { width: 100%; max-width: 500px; }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 1.4rem;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition-smooth);
}

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

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

/* Formularios en Modales */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 12px 16px;
  border-radius: 10px;
  outline: none;
  font-family: var(--font-family-body);
  font-size: 0.9rem;
  transition: var(--transition-smooth);
}

.form-control:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(0, 242, 254, 0.1);
}

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

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.form-help-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-buttons-row {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

/* Telemetry Strip en Detalle Máquina */
.telemetry-strip {
  display: flex;
  background-color: rgba(10, 17, 40, 0.5);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
  align-items: center;
  justify-content: space-between;
}

.tel-item {
  display: flex;
  flex-direction: column;
}

.tel-item .label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.tel-item .value {
  font-size: 1.2rem;
  font-weight: 700;
  font-family: var(--font-family-title);
}

/* Espirales Dispenser Layout */
.spirals-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.coil-drawer-card {
  background-color: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  gap: 16px;
  align-items: center;
  position: relative;
  transition: var(--transition-smooth);
}

.coil-drawer-card:hover {
  background-color: rgba(255, 255, 255, 0.03);
  border-color: var(--border-glass-hover);
}

.coil-drawer-card.coil-empty {
  border-color: rgba(255, 74, 90, 0.2);
}

.coil-drawer-card.coil-empty::before {
  content: 'SIN STOCK';
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 0.65rem;
  background-color: rgba(255, 74, 90, 0.15);
  color: var(--accent-red);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.coil-number-badge {
  font-family: var(--font-family-title);
  width: 32px;
  height: 32px;
  background-color: rgba(0, 242, 254, 0.1);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: 700;
}

.coil-details-col {
  flex: 1;
}

.coil-details-col h4 {
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.coil-details-col .coil-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.coil-details-col .progress-bar-container {
  margin-top: 6px;
  height: 5px;
}

.coil-details-col .progress-bar {
  background: var(--accent-cyan);
}

.coil-drawer-card.coil-empty .progress-bar {
  width: 0% !important;
}

.coil-actions-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* --- Panel del Simulador Flotante (Deslizable) --- */
.simulator-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 350px;
  height: 100vh;
  background-color: #0b142c;
  border-left: 1px solid var(--border-glass-hover);
  z-index: 150;
  display: flex;
  flex-direction: column;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -10px 0 40px rgba(0,0,0,0.6);
}

.simulator-panel.collapsed {
  transform: translateX(100%);
}

.simulator-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.simulator-header h3 {
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.simulator-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.simulator-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.simulator-control-group {
  margin-bottom: 8px;
}

.simulator-control-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.sim-action-card {
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 16px;
}

.sim-action-card h4 {
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.sim-action-card p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.4;
}

.sim-buttons {
  display: flex;
  gap: 10px;
}

.temp-control-slider-group {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
}

.temp-val-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.temp-val-label span {
  font-family: var(--font-family-title);
  color: var(--accent-cyan);
  font-size: 1.1rem;
}

.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.1);
  outline: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.5);
  transition: transform 0.1s;
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.sim-action-card.reset-card {
  border-color: rgba(255, 74, 90, 0.15);
  margin-top: 10px;
}

/* --- Media Queries (MÓVIL Y TABLET RESPONSIVIDAD) --- */

.mobile-only {
  display: none;
}

/* --- Tablet Mode --- */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 80px;
  }
  
  .sidebar {
    padding: 24px 12px;
  }
  
  .brand-text, 
  .sidebar-menu a span,
  .sidebar-footer button span {
    display: none;
  }
  
  .sidebar-brand {
    justify-content: center;
    padding-left: 0;
  }
  
  .menu-item {
    justify-content: center;
    padding: 14px;
  }
  
  .menu-item i {
    font-size: 1.4rem;
  }
  
  .badge-alert-count {
    right: 6px;
    top: 6px;
    transform: none;
  }
  
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .machines-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .dashboard-grid.second-row {
    grid-template-columns: 1fr;
  }
}

/* --- Mobile Mode --- */
@media (max-width: 768px) {
  body {
    flex-direction: column;
  }
  
  .sidebar {
    display: none; /* Oculta sidebar en móvil */
  }
  
  .bottom-nav {
    display: flex; /* Muestra bottom nav inferior */
  }
  
  .main-content {
    padding: 16px 16px 80px 16px; /* Deja espacio abajo para bottom nav */
    height: calc(100vh - 64px);
  }
  
  .top-header h1 {
    font-size: 1.6rem;
  }
  
  .mobile-only {
    display: inline-flex;
  }
  
  .kpi-grid {
    grid-template-columns: 1fr; /* Una columna en móvil */
    gap: 12px;
  }
  
  .kpi-card {
    padding: 16px;
  }
  
  .machines-grid {
    grid-template-columns: 1fr; /* Una columna para las 13 máquinas */
    gap: 16px;
  }
  
  .spirals-grid {
    grid-template-columns: 1fr; /* Espirales una debajo de otra en móvil */
  }
  
  .section-actions-bar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-box {
    max-width: 100%;
  }
  
  .sales-stats-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  
  .filter-group {
    justify-content: space-between;
  }
  
  .filter-group select {
    flex: 1;
    max-width: 70%;
  }
  
  .simulator-panel {
    width: 100%; /* El simulador ocupa pantalla completa en móvil */
  }
  
  .modal-content {
    max-height: 95vh;
    border-radius: 16px 16px 0 0;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
  }
  
  .modal-overlay {
    align-items: flex-end; /* En móvil, sube como hoja desde abajo */
    padding: 0;
  }
}
