/* ============================================================
   OHAUS Monitor - DOMINGO 7PM "Industrial Premium"
   Acero Cepillado + Azul Eléctrico + Flash System
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@500;700&family=Outfit:wght@400;600;700;800&display=swap');

:root {
  --bg-primary:    #020617;
  --bg-base:       #020617;
  --bg-card:       rgba(15,23,42,0.85);
  --bg-input:      #1e293b;
  --bg-panel:      #0f172a;
  --bg-hover:      rgba(14, 165, 233, 0.05);
  
  --color-emerald: #10b981;
  --color-cyan:    #06b6d4;
  --color-amber:   #f59e0b;
  --color-purple:  #6366f1;
  --color-red:     #ef4444;
  --color-blue:    #3b82f6;
  --color-green:   #10b981;
  --color-blue-electric: #0ea5e9;
  
  --text-primary:   #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;
  
  --border:         rgba(100,130,180,0.12);
  --radius:         12px;
  --radius-md:      10px;
  --radius-lg:      14px;
  --radius-xl:      18px;
  --shadow:         0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-card:    0 4px 24px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255,255,255,0.04);
  --shadow-glow:    0 0 40px rgba(14, 165, 233, 0.08);
  --shadow-electric: 0 0 20px rgba(14, 165, 233, 0.15);
  
  --grad-electric:  linear-gradient(135deg, #0ea5e9, #6366f1);
  --grad-emerald:   linear-gradient(135deg, #10b981, #06b6d4);
  --grad-purple:    linear-gradient(135deg, #6366f1, #a855f7);
  --grad-steel:     linear-gradient(145deg, #1e293b 0%, #0f172a 50%, #1e293b 100%);

  --text-main:      #f1f5f9;
  --bg-card-sub:    rgba(15,23,42,0.65);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', 'Outfit', sans-serif;
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(ellipse at 20% 50%, rgba(14,165,233,0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(99,102,241,0.02) 0%, transparent 50%);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
}

/* ── Header Bar (Industrial) ── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(8,13,24,0.92);
  backdrop-filter: blur(24px);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0,0,0,0.3);
}
.header-brand { display: flex; align-items: center; gap: 12px; }
.header-title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.header-title span { color: var(--color-blue-electric); text-shadow: 0 0 12px rgba(14,165,233,0.3); }
.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.app-wrapper { min-height: 100vh; display: flex; flex-direction: column; }

.main-content {
  flex: 1;
  padding: 32px;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* ── Cards (Brushed Steel) ── */
.card {
  background: var(--grad-steel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
  flex-shrink: 0; /* Fixes content clipping in flex containers */
}
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Forms (Industrial) ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; margin-bottom: 8px; letter-spacing: 0.06em; }
.form-control {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  color: #fff;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  outline: none;
  font-family: inherit;
  transition: all 0.2s;
}
.form-control:focus { 
  border-color: var(--color-blue-electric); 
  box-shadow: 0 0 0 3px rgba(14,165,233,0.1), var(--shadow-electric); 
}

/* ── Buttons (Industrial Premium) ── */
.btn {
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-size: 0.85rem;
  font-family: inherit;
  transition: all 0.15s;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, transparent 50%);
  pointer-events: none;
}
.btn:active { transform: scale(0.97); }
.btn:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.3); }
.btn-primary { background: var(--grad-electric); color: white; border: 1px solid rgba(255,255,255,0.15); box-shadow: 0 4px 16px rgba(14,165,233,0.3); }
.btn-primary:hover { box-shadow: 0 6px 24px rgba(14,165,233,0.4); transform: translateY(-1px); }
.btn-emerald { background-color: rgba(16, 185, 129, 0.15); color: var(--color-emerald); border: 1px solid rgba(16, 185, 129, 0.3); }
.btn-emerald:hover { background-color: rgba(16, 185, 129, 0.25); box-shadow: 0 0 16px rgba(16,185,129,0.15); }
.btn-ghost { background-color: rgba(255,255,255,0.04); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background-color: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.2); }
.btn-full { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 0.75rem; }
.btn-red { background-color: rgba(239, 68, 68, 0.15); color: var(--color-red); border: 1px solid rgba(239, 68, 68, 0.3); }
.btn-red:hover { background-color: rgba(239, 68, 68, 0.25); box-shadow: 0 0 16px rgba(239,68,68,0.15); }
.btn-blue { background-color: rgba(59, 130, 246, 0.15); color: var(--color-blue); border: 1px solid rgba(59, 130, 246, 0.3); }
.btn-blue:hover { background-color: rgba(59, 130, 246, 0.25); box-shadow: 0 0 16px rgba(59,130,246,0.15); }
.btn-purple { background-color: rgba(99, 102, 241, 0.15); color: var(--color-purple); border: 1px solid rgba(99, 102, 241, 0.3); }
.btn-purple:hover { background-color: rgba(99, 102, 241, 0.25); box-shadow: 0 0 16px rgba(99,102,241,0.15); }

/* ── Switch Toggle ── */
.switch-group { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.switch-label { font-size: 0.8rem; color: var(--text-secondary); font-weight: 600; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #334155;
  transition: .4s; border-radius: 34px;
}
.slider:before {
  position: absolute; content: "";
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: .4s; border-radius: 50%;
}
input:checked + .slider { background-color: var(--color-emerald); box-shadow: 0 0 10px rgba(16,185,129,0.3); }
input:checked + .slider:before { transform: translateX(20px); }

/* ── Stats Panel ── */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 10px; }
.stat-box { text-align: center; padding: 12px; background: rgba(0,0,0,0.2); border-radius: 8px; border: 1px solid rgba(100,130,180,0.05); }
.stat-label { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; font-weight: 800; margin-bottom: 8px; letter-spacing: 0.05em; }
.stat-value { font-size: 1.5rem; font-weight: 800; }

/* ── Table (Industrial) ── */
.table-premium { width: 100%; border-collapse: collapse; margin-top: 10px; }
.table-premium th { text-align: left; padding: 12px; font-size: 0.7rem; color: var(--text-muted); border-bottom: 2px solid rgba(14,165,233,0.15); text-transform: uppercase; font-weight: 700; letter-spacing: 0.04em; }
.table-premium td { padding: 14px 12px; font-size: 0.8rem; border-bottom: 1px solid rgba(100,130,180,0.06); color: var(--text-secondary); }
.table-premium tr:hover { background: rgba(14,165,233,0.03); }

/* ── Stability Badges ── */
.stability-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
}
.stability-badge.stable { background: rgba(16,185,129,0.15); color: var(--color-emerald); box-shadow: 0 0 8px rgba(16,185,129,0.1); }
.stability-badge.unstable { background: rgba(245,158,11,0.15); color: var(--color-amber); }
.stability-badge.no-conn { background: rgba(100,116,139,0.15); color: var(--text-muted); }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }

/* ── Status dot ── */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); transition: all 0.3s; }
.status-dot.connected { background: var(--color-emerald); box-shadow: 0 0 10px var(--color-emerald); animation: pulse-dot 2s infinite; }

/* ══ FLASH SYSTEM (Retroalimentación Táctica) ══ */
.flash-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.15s;
}
.flash-overlay.flash-success {
  background: radial-gradient(circle at center, rgba(16,185,129,0.25), transparent 70%);
  opacity: 1;
  animation: flashFade 0.8s ease-out forwards;
}
.flash-overlay.flash-error {
  background: radial-gradient(circle at center, rgba(239,68,68,0.25), transparent 70%);
  opacity: 1;
  animation: flashFade 0.8s ease-out forwards;
}

@keyframes flashFade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.9); }
}

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

@keyframes weightPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

/* ── Toast ── */
.toast { animation: fadeIn 0.3s ease; }

/* ── Scrollbar (Steel) ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(14, 165, 233, 0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(14, 165, 233, 0.3); }

/* ════════════════════════════════════════════════════
   RESPONSIVE DESIGN
   ════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .main-content {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  .header {
    padding: 12px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .header-status {
    width: 100%;
    justify-content: flex-end;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

