/* ==========================================================================
   Routify — Operador Portal Styles
   Command Center, TOTP 2FA Gate, Live Dispatch, SOS Emergency Banner, Fleet List
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg-dark: #070a13;
  --bg-sidebar: #0a0f1d;
  --bg-card: rgba(13, 18, 34, 0.85);
  --gold: #f59e0b;
  --gold-glow: rgba(245, 158, 11, 0.35);
  --emerald: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.35);
  --rose: #f43f5e;
  --rose-glow: rgba(244, 63, 94, 0.4);
  --border: rgba(255, 255, 255, 0.08);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 9999px;
  --shadow-luxe: 0 15px 35px rgba(0, 0, 0, 0.6);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  overflow: hidden;
}

.routify-guarded {
  opacity: 0;
  visibility: hidden;
  width: 100%;
  height: 100%;
  display: flex;
  transition: opacity 0.3s ease;
}

.routify-guarded.routify-active {
  opacity: 1;
  visibility: visible;
}

/* Sidebar */
.operator-sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 20;
}

.sidebar-brand {
  padding: 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
}

.sidebar-company-badge {
  font-size: 0.7rem;
  background: var(--gold);
  color: #070a13;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  text-transform: uppercase;
}

.sidebar-menu {
  list-style: none;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.menu-item:hover, .menu-item.active {
  color: #fff;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Main Workspace */
.operator-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Top App Bar */
.operator-topbar {
  height: 70px;
  background: rgba(10, 15, 29, 0.85);
  backdrop-filter: blur(15px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  flex-shrink: 0;
}

/* Mode Switcher Pill (FIFO vs Grupo) */
.dispatch-mode-selector {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px;
  gap: 4px;
}

.mode-btn {
  background: none;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-btn.active {
  background: linear-gradient(135deg, var(--gold), #d97706);
  color: #070a13;
  font-weight: 700;
  box-shadow: 0 4px 15px var(--gold-glow);
}

/* SOS High Priority Emergency Banner */
.sos-emergency-banner {
  display: none;
  background: linear-gradient(90deg, #991b1b, #dc2626);
  color: #fff;
  padding: 14px 28px;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 25px var(--rose-glow);
  animation: pulseBanner 1s infinite alternate;
  z-index: 30;
}

@keyframes pulseBanner {
  from { background-color: #991b1b; }
  to { background-color: #ef4444; }
}

.sos-emergency-banner.active {
  display: flex;
}

.sos-info-text {
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Tab Views Container */
.tab-content-area {
  flex-grow: 1;
  overflow-y: auto;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.tab-pane {
  display: none;
  flex-direction: column;
  gap: 24px;
}

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

/* Stats Metric Row */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-card h4 {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.metric-card p {
  font-family: 'Outfit', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
}

/* Two Column Live Dispatch Deck */
.dispatch-deck {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-luxe);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.panel-head h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
}

.items-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 480px;
  overflow-y: auto;
}

.queue-row {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.queue-row:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(245, 158, 11, 0.3);
}

/* Driver Row */
.driver-badge-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.driver-badge-status.online { background: var(--emerald); box-shadow: 0 0 8px var(--emerald-glow); }
.driver-badge-status.busy { background: var(--gold); box-shadow: 0 0 8px var(--gold-glow); }
.driver-badge-status.offline { background: #64748b; }

/* Table Styles */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.data-table th, .data-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.data-table th {
  background: rgba(255, 255, 255, 0.03);
  font-family: 'Outfit', sans-serif;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
}

.form-input:focus {
  border-color: var(--gold);
}

/* Buttons */
.btn {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold), #d97706);
  color: #070a13;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
  color: #fff;
}

.btn-danger {
  background: var(--rose);
  color: #fff;
}

/* TOTP 2FA Verification Overlay (Blocks unauthorized access) */
.totp-overlay {
  position: fixed;
  inset: 0;
  background: #070a13;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.totp-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
}

.totp-code-input {
  letter-spacing: 12px;
  font-family: monospace;
  font-size: 2rem;
  text-align: center;
  padding: 12px;
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--gold);
  border-radius: var(--radius-md);
  color: #fff;
  margin: 20px 0;
  outline: none;
}

@media (max-width: 900px) {
  .operator-sidebar {
    width: 70px;
  }
  .sidebar-brand h2, .sidebar-menu span, .sidebar-company-badge {
    display: none;
  }
  .dispatch-deck {
    grid-template-columns: 1fr;
  }
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Database RBAC Role Badges */
.role-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.role-badge-ac1 {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.role-badge-ac2 {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.role-badge-op {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.35);
}

.role-badge-sa {
  background: rgba(244, 63, 94, 0.15);
  color: #f43f5e;
  border: 1px solid rgba(244, 63, 94, 0.35);
}

/* HUD Modo Creación de Paradero de 4 Vértices */
.paradero-creator-hud {
  animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.vertex-step-pill {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  font-weight: 600;
  transition: all 0.25s ease;
}

.vertex-step-pill.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.25);
}

.vertex-step-pill.done {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
  color: #10b981;
}

/* ==========================================================================
   Marcadores Satelitales Estilo AutoCab365 para Móviles de Flota
   ========================================================================== */
.autocab-driver-marker {
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.autocab-driver-marker:hover {
  transform: scale(1.18);
  z-index: 9999 !important;
}

.autocab-marker-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px 4px 5px;
  border-radius: 9999px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.74rem;
  font-weight: 800;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.75);
  border: 1.5px solid;
  white-space: nowrap;
}

.autocab-marker-pill.online {
  background: #064e3b;
  border-color: #10b981;
  color: #ecfdf5;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.45);
}

.autocab-marker-pill.busy {
  background: #78350f;
  border-color: #f59e0b;
  color: #fffbeb;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.45);
}

.autocab-marker-pill.offline {
  background: #1e293b;
  border-color: #64748b;
  color: #94a3b8;
}

.autocab-movil-tag {
  background: #000;
  color: #fff;
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 900;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
}

.autocab-marker-pill.online .autocab-movil-tag {
  background: #10b981;
  color: #070a13;
}

.autocab-marker-pill.busy .autocab-movil-tag {
  background: #f59e0b;
  color: #070a13;
}

.autocab-status-text {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  font-weight: 700;
  text-transform: uppercase;
}

/* ==========================================================================
   Operator Company Brand Header (No Routify Desk)
   ========================================================================== */
.sidebar-brand {
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.operator-company-logo-box {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #141d33;
  border: 1.5px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.operator-company-name-text {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

/* ==========================================================================
   Porterías & Wallet Balance Badges & Topup Modal
   ========================================================================== */
.badge-porteria {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #a78bfa;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-paradero {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #60a5fa;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
}

.badge-balance-ok {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #10b981;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.76rem;
}

.badge-balance-low {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #f59e0b;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.74rem;
}

.filter-chips-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 6px 14px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-chip.active {
  background: rgba(245, 158, 11, 0.18);
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.25);
}

.quick-amount-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.quick-chip-btn {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: #cbd5e1;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.quick-chip-btn:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #10b981;
}

.quick-chip-btn:active {
  transform: scale(0.95);
}


