/* ============================================================
   LIKAY — Estilos compartidos para paneles web
   Archivo: panel/assets/css/likay.css
   Paleta azul oscuro — modo claro y oscuro
   ============================================================ */

/* ── VARIABLES DE COLOR ──────────────────────────────────── */
:root {
  --azul-900: #0a1628;
  --azul-800: #12274b;
  --azul-700: #1468b1;
  --azul-600: #2A7ABF;
  --azul-400: #4C97D2;
  --azul-200: #D0EDFC;
  --azul-100: #eaf4fc;

  --verde-700: #0a3d1f;
  --verde-500: #0ea04a;
  --verde-200: #d4f5df;

  --rojo-700:  #7a1f1f;
  --rojo-500:  #D85A30;
  --rojo-200:  #FAECE7;

  --amarillo-500: #f5a623;
  --amarillo-200: #FAEEDA;

  /* Modo CLARO (default) */
  --bg-primary:   #ffffff;
  --bg-secondary: #f4f6fb;
  --bg-tertiary:  #e8edf5;
  --text-primary:   #0a1628;
  --text-secondary: #4a5568;
  --text-muted:     #8898aa;
  --border:         #dce3ef;
  --shadow: 0 2px 8px rgba(18,39,75,0.08);
  --shadow-lg: 0 4px 20px rgba(18,39,75,0.12);
  --sidebar-bg:    #12274b;
  --sidebar-text:  #D0EDFC;
  --sidebar-hover: #1468b1;
  --topbar-bg:     #12274b;
}

/* Modo OSCURO */
body.dark {
  --bg-primary:   #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary:  #1e2530;
  --text-primary:   #e6edf3;
  --text-secondary: #8b949e;
  --text-muted:     #484f58;
  --border:         #2d333b;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.4);
}

/* ── RESET Y BASE ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: background 0.2s, color 0.2s;
}

a { color: var(--azul-700); text-decoration: none; }
a:hover { color: var(--azul-600); }

/* ── LAYOUT PRINCIPAL ────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 56px 1fr;
  min-height: 100vh;
}

.layout.sidebar-collapsed {
  grid-template-columns: 60px 1fr;
}

/* ── TOPBAR ──────────────────────────────────────────────── */
.topbar {
  grid-column: 1 / -1;
  background: var(--topbar-bg);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--azul-200);
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
}

.topbar-logo i { font-size: 20px; color: var(--azul-400); }

.topbar-empresa {
  background: rgba(255,255,255,0.1);
  color: var(--azul-200);
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 12px;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-usuario {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--azul-200);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.15s;
}
.topbar-usuario:hover { background: rgba(255,255,255,0.1); }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--azul-700);
  border: 1.5px solid var(--azul-400);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--azul-200);
  flex-shrink: 0;
}

.btn-modo-oscuro {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--azul-200);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.15s;
}
.btn-modo-oscuro:hover { background: rgba(255,255,255,0.1); }

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  background: var(--sidebar-bg);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
}

.sidebar-section {
  padding: 10px 16px 4px;
  font-size: 10px;
  color: var(--azul-400);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: rgba(208,237,252,0.75);
  font-size: 13px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-decoration: none;
}

.sidebar-item i { font-size: 16px; flex-shrink: 0; }
.sidebar-item:hover  { background: rgba(255,255,255,0.08); color: var(--azul-200); border-left-color: var(--azul-400); }
.sidebar-item.active { background: var(--azul-700); color: #fff; border-left-color: var(--azul-400); }

.sidebar-badge {
  margin-left: auto;
  background: var(--rojo-500);
  color: white;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
}

/* ── CONTENIDO PRINCIPAL ─────────────────────────────────── */
.main {
  padding: 20px;
  overflow-y: auto;
  height: calc(100vh - 56px);
}

.page { display: none; }
.page.active { display: block; }

/* ── TARJETAS ────────────────────────────────────────────── */
.card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 18px; }

/* ── STATS CARDS ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  border-left: 4px solid var(--azul-700);
}

.stat-card.verde  { border-left-color: var(--verde-500); }
.stat-card.rojo   { border-left-color: var(--rojo-500); }
.stat-card.naranja{ border-left-color: var(--amarillo-500); }

.stat-label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.stat-valor { font-size: 26px; font-weight: 700; color: var(--text-primary); }
.stat-sub   { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── BOTONES ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary  { background: var(--azul-700); color: white; }
.btn-primary:hover  { background: var(--azul-600); }
.btn-success  { background: var(--verde-500); color: white; }
.btn-success:hover  { background: #0c8a3e; }
.btn-danger   { background: var(--rojo-700); color: var(--rojo-200); }
.btn-danger:hover   { background: #6a1a1a; }
.btn-warning  { background: var(--amarillo-500); color: white; }
.btn-outline  { background: transparent; border: 1px solid var(--border); color: var(--text-primary); }
.btn-outline:hover  { background: var(--bg-secondary); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 7px; border-radius: 8px; }

/* ── BADGES ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}

.badge-verde   { background: var(--verde-200);   color: var(--verde-700); }
.badge-rojo    { background: var(--rojo-200);    color: var(--rojo-700); }
.badge-azul    { background: var(--azul-100);    color: var(--azul-800); }
.badge-gris    { background: var(--bg-tertiary); color: var(--text-muted); }
.badge-naranja { background: var(--amarillo-200);color: #633806; }

/* ── TABLAS ──────────────────────────────────────────────── */
.tabla-wrapper { overflow-x: auto; border-radius: 8px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  text-align: left;
  white-space: nowrap;
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-secondary); }

/* ── FORMULARIOS ─────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 5px; font-weight: 500; }

.form-control {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.form-control:focus { border-color: var(--azul-700); box-shadow: 0 0 0 3px rgba(20,104,177,0.1); }
.form-control.error { border-color: var(--rojo-500); }

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

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  display: none;
}

.modal-overlay.show { display: flex; }

.modal {
  background: var(--bg-primary);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 15px; font-weight: 600; }
.modal-body  { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

.btn-close {
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

/* ── ALERTAS INLINE ──────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 14px;
}

.alert-success { background: var(--verde-200); color: var(--verde-700); border: 1px solid #a3d9b8; }
.alert-danger  { background: var(--rojo-200);  color: var(--rojo-700);  border: 1px solid #f5b8a8; }
.alert-warning { background: var(--amarillo-200); color: #633806; border: 1px solid #f5d49a; }
.alert-info    { background: var(--azul-100);  color: var(--azul-800); border: 1px solid var(--azul-200); }

/* ── TOGGLE SWITCH ───────────────────────────────────────── */
.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle input { display: none; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 22px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
}

.toggle input:checked + .toggle-slider { background: var(--verde-500); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── WALKIE TALKIE ───────────────────────────────────────── */
.walkie-panel {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

.walkie-btn {
  width: 100%;
  padding: 14px;
  background: var(--azul-700);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s;
  user-select: none;
}

.walkie-btn:active,
.walkie-btn.hablando {
  background: var(--rojo-500);
  transform: scale(0.98);
}

.walkie-estado {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 6px;
}

/* ── MAPA PLACEHOLDER ────────────────────────────────────── */
.mapa-container {
  background: var(--bg-secondary);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

#mapa-operador, #mapa-superadmin {
  width: 100%;
  height: 420px;
}

/* ── TOAST NOTIFICACIONES ────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 380px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: slideIn 0.3s ease;
  border-left: 4px solid var(--azul-700);
}

.toast.success { border-left-color: var(--verde-500); }
.toast.danger  { border-left-color: var(--rojo-500); }
.toast.warning { border-left-color: var(--amarillo-500); }

.toast-icono { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.toast-titulo { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.toast-msg    { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

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

/* ── SPINNER ─────────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--azul-700);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

/* ── UTILIDADES ──────────────────────────────────────────── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-3  { margin-top: 12px; }
.mt-4  { margin-top: 16px; }
.mb-3  { margin-bottom: 12px; }
.mb-4  { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); font-size: 12px; }
.text-right { text-align: right; }
.w-100 { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── LOGIN PAGE ──────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--azul-900) 0%, var(--azul-800) 100%);
  padding: 20px;
}

.login-card {
  background: var(--bg-primary);
  border-radius: 16px;
  padding: 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo i { font-size: 40px; color: var(--azul-700); }
.login-logo h1 { font-size: 22px; color: var(--text-primary); margin-top: 6px; }
.login-logo p  { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .form-grid-2, .form-grid-3, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
