/* resiter/css/20-hub.css — Hub de operaciones: barra, mosaicos, módulo oscuro, búsqueda del hub.
   Forma parte del CSS único de index.html (orden R2): se carga en el orden de los <link>; al editar este archivo,
   subir su ?v= en index.html. */
/* ══════════════════════════════════════════════════
   HUB DE OPERACIONES — Concepto 3 Dark Premium
══════════════════════════════════════════════════ */

/* Resetear body para modo hub */
body { background: #08090f; }
#app { display: block !important; height: 100vh; overflow: hidden; }
#sidebar { display: none !important; }
#main {
  width: 100%; height: 100vh;
  display: flex; flex-direction: column;
  background: transparent;
}

/* ── HUB SCREEN ──────────────────────────────────── */
#hub-screen {
  flex: 1; display: flex; flex-direction: column;
  background: #08090f;
  height: 100vh; overflow: hidden;
  position: relative;
}

/* Topbar del hub */
.hub-topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px; height: 88px; flex-shrink: 0;
  background: #ffffff;
  border-bottom: 1px solid rgba(7,55,99,0.12);
  box-shadow: 0 2px 8px rgba(7,55,99,0.07);
}
.hub-topbar-left { display: flex; align-items: center; gap: 0; flex-shrink: 0; }
.hub-logo { display: flex; align-items: center; flex-shrink: 0; }
.hub-logo img { height: 64px; width: auto; display: block; }
.hub-logo-fallback {
  width: 52px; height: 52px; border-radius: 12px;
  background: linear-gradient(135deg, #073763, #0e81c5);
  color: #fff; font-size: 20px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-family: 'Montserrat', sans-serif;
}
.hub-brand-name { font-size: 15px; font-weight: 800; color: #073763; letter-spacing: -.02em; font-family: 'Montserrat', sans-serif; line-height: 1.2; }
.hub-brand-sub { font-size: 10px; color: rgba(7,55,99,0.45); text-transform: uppercase; letter-spacing: .12em; margin-top: 3px; font-weight: 700; font-family: 'Montserrat', sans-serif; }

.hub-search-wrap {
  flex: 1; max-width: 440px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  background: #f4f7fb;
  border: 1px solid rgba(7,55,99,0.12);
  border-radius: 10px; padding: 0 16px; height: 40px;
  transition: border-color .15s, background .15s;
}
.hub-search-wrap:focus-within {
  border-color: rgba(14,129,197,0.50);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(14,129,197,0.10);
}
.hub-search-icon { font-size: 14px; opacity: .4; }
.hub-search-input {
  flex: 1; background: none; border: none; outline: none;
  color: #1a2740; font-size: 13px; font-family: inherit; font-weight: 500;
}
.hub-search-input::placeholder { color: rgba(7,55,99,0.35); }

.hub-topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.hub-apk-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 14px; border-radius: 20px;
  background: rgba(15,157,110,0.10);
  border: 1px solid rgba(15,157,110,0.25);
  color: #0b7a52; font-size: 11px; font-weight: 700;
  cursor: pointer; transition: all .15s; font-family: 'Montserrat', sans-serif;
}
.hub-apk-pill:hover { background: rgba(15,157,110,0.18); }
.hub-apk-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #0f9d6e; flex-shrink: 0;
  animation: dot-pulse 2s ease-in-out infinite;
}
.hub-bell {
  position: relative; cursor: pointer;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(7,55,99,0.12);
  background: transparent; transition: background .15s; flex-shrink: 0;
}
.hub-bell svg { width: 18px; height: 18px; stroke: #4a5e78; fill: none; stroke-width: 1.8; }
.hub-bell:hover { background: rgba(7,55,99,0.06); }
.hub-bell-badge {
  position: absolute; top: 4px; right: 4px;
  background: #c5282a; color: #fff;
  font-size: 8px; font-weight: 800;
  min-width: 15px; height: 15px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px; line-height: 1; border: 2px solid #fff;
}
.hub-user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 12px 5px 5px; border-radius: 30px;
  background: transparent; border: 1px solid rgba(7,55,99,0.14);
  cursor: pointer; transition: background .15s;
}
.hub-user-chip:hover { background: rgba(7,55,99,0.06); }
.hub-user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #073763, #0e81c5);
  color: #fff; font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-family: 'Montserrat', sans-serif;
}
.hub-user-info { display: flex; flex-direction: column; }
.hub-user-name { font-size: 12px; font-weight: 700; color: #073763; font-family: 'Montserrat', sans-serif; line-height: 1.2; }
.hub-user-role { font-size: 9px; font-weight: 700; color: #0e81c5; text-transform: uppercase; letter-spacing: .08em; font-family: 'Montserrat', sans-serif; }

/* ── SUBNAV NAVY — propuesta B ───────────────────── */
.hub-navbar {
  height: 48px; background: #073763; flex-shrink: 0;
  display: flex; align-items: stretch;
  padding: 0 20px; gap: 2px; overflow-x: auto;
  border-bottom: 1px solid rgba(0,0,0,0.15);
  cursor: grab;
}
.hub-navbar::-webkit-scrollbar { display: none; }
.hub-nav-item {
  display: flex; align-items: center; gap: 7px;
  padding: 0 14px; border-radius: 6px; margin: 6px 0;
  font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.65);
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  transition: all .16s; font-family: 'Montserrat', sans-serif;
  border: 1px solid transparent;
}
.hub-nav-item:hover { background: rgba(255,255,255,0.10); color: #fff; }
.hub-nav-item.active { background: rgba(255,255,255,0.16); color: #fff; border-color: rgba(255,255,255,0.15); }
.hub-nav-item svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; flex-shrink: 0; }
.gs-navdot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; box-shadow: 0 0 0 1.5px rgba(255,255,255,.85); }
.hub-nav-dot { width: 6px; height: 6px; border-radius: 50%; background: #ff6b6b; margin-left: 2px; flex-shrink: 0; }
.hub-nav-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: #ff6b6b; color: #fff; font-size: 10px; font-weight: 800; margin-left: 4px; flex-shrink: 0; }

/* ── HUB BODY ─────────────────────────────────────── */
.hub-body {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 20px 28px 16px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.08) transparent;
}

/* Saludo */
.hub-greeting-row {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 18px; flex-wrap: wrap; gap: 10px;
}
.hub-greeting {
  font-size: 28px; font-weight: 900; color: #fff;
  letter-spacing: -.04em; line-height: 1.1;
}
.hub-subgreeting {
  font-size: 13px; color: rgba(255,255,255,.4);
  font-weight: 500; margin-top: 5px;
}
.hub-status-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.hub-status-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 14px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}
.hsp-green { background: rgba(16,185,129,.12); border: 1px solid rgba(16,185,129,.25); color: #6ee7b7; }
.hsp-amber { background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.25); color: #fcd34d; }
.hsp-red   { background: rgba(239,68,68,.12);  border: 1px solid rgba(239,68,68,.25);  color: #fca5a5; }

/* ── TILES ────────────────────────────────────────── */
.hub-tiles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.hub-tile {
  position: relative; overflow: hidden;
  border-radius: 16px;
  padding: 20px 22px;
  cursor: pointer;
  transition: transform .2s cubic-bezier(.22,1,.36,1), box-shadow .2s;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  min-height: 130px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.hub-tile:hover {
  transform: translateY(-4px) scale(1.01);
  border-color: rgba(255,255,255,.14);
}
.hub-tile-glow {
  position: absolute; bottom: -40px; right: -40px;
  width: 130px; height: 130px; border-radius: 50%;
  filter: blur(40px); opacity: .45;
  transition: opacity .2s;
  pointer-events: none;
}
.hub-tile:hover .hub-tile-glow { opacity: .65; }

/* Colores por tile */
.hub-tile-fuel    { border-color: rgba(59,130,246,.15); }
.hub-tile-fuel    .hub-tile-glow { background: #3b82f6; }
.hub-tile-fuel:hover { box-shadow: 0 16px 48px rgba(59,130,246,.15); }

.hub-tile-fleet   { border-color: rgba(16,185,129,.15); }
.hub-tile-fleet   .hub-tile-glow { background: #10b981; }
.hub-tile-fleet:hover { box-shadow: 0 16px 48px rgba(16,185,129,.15); }

.hub-tile-maint   { border-color: rgba(245,158,11,.15); }
.hub-tile-maint   .hub-tile-glow { background: #f59e0b; }
.hub-tile-maint:hover { box-shadow: 0 16px 48px rgba(245,158,11,.15); }

.hub-tile-odo     { border-color: rgba(6,182,212,.15); }
.hub-tile-odo     .hub-tile-glow { background: #06b6d4; }
.hub-tile-odo:hover { box-shadow: 0 16px 48px rgba(6,182,212,.15); }

.hub-tile-analysis { border-color: rgba(168,85,247,.15); }
.hub-tile-analysis .hub-tile-glow { background: #a855f7; }
.hub-tile-analysis:hover { box-shadow: 0 16px 48px rgba(168,85,247,.15); }

.hub-tile-alerts  { border-color: rgba(239,68,68,.12); }
.hub-tile-alerts  .hub-tile-glow { background: #ef4444; }
.hub-tile-alerts:hover { box-shadow: 0 16px 48px rgba(239,68,68,.12); }

.hub-tile-top {
  display: flex; align-items: flex-start;
  justify-content: space-between;
}
.hub-tile-icon { font-size: 22px; line-height: 1; }
.hub-tile-num {
  font-size: 32px; font-weight: 800; color: #fff;
  font-variant-numeric: tabular-nums; letter-spacing: -.04em;
  line-height: 1;
}
.hub-tile-num-warn   { color: #fcd34d; }
.hub-tile-num-danger { color: #fca5a5; }

.hub-tile-name {
  font-size: 15px; font-weight: 700; color: #fff;
  letter-spacing: -.02em; margin-top: 14px;
}
.hub-tile-sub {
  font-size: 11px; color: rgba(255,255,255,.4);
  font-weight: 500; margin-top: 3px; line-height: 1.4;
}
.hub-tile-footer {
  font-size: 10px; color: rgba(255,255,255,.25);
  font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  margin-top: 14px; padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.06);
}

/* ── FILA INFERIOR ─────────────────────────────────── */
.hub-bottom-grid {
  display: grid; grid-template-columns: 1fr 300px; gap: 10px;
}
.hub-feed-card, .hub-quick-card {
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px; padding: 18px 20px;
}
.hub-feed-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.hub-feed-title { font-size: 13px; font-weight: 700; color: rgba(255,255,255,.8); }
.hub-feed-link {
  font-size: 11px; color: rgba(59,130,246,.8); font-weight: 600;
  background: none; border: none; cursor: pointer; font-family: inherit;
  transition: color .15s;
}
.hub-feed-link:hover { color: #93c5fd; }
.hub-feed-list { display: flex; flex-direction: column; gap: 2px; }
.hub-feed-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 7px;
  transition: background .12s; cursor: pointer;
}
.hub-feed-item:hover { background: rgba(255,255,255,.04); }
.hub-feed-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.hub-feed-text { font-size: 12px; color: rgba(255,255,255,.65); flex: 1; }
.hub-feed-text strong { color: rgba(255,255,255,.9); font-weight: 700; }
.hub-feed-time { font-size: 10px; color: rgba(255,255,255,.3); flex-shrink: 0; }
.hub-feed-badge { font-size: 9px; padding: 2px 7px; border-radius: 4px; font-weight: 700; flex-shrink: 0; }
.hub-feed-empty { font-size: 12px; color: rgba(255,255,255,.3); text-align: center; padding: 20px 0; }

/* Quick actions */
.hub-quick-actions { display: flex; flex-direction: column; gap: 6px; }
.hub-quick-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 10px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07);
  color: rgba(255,255,255,.7); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all .15s; font-family: inherit;
  text-align: left; width: 100%;
}
.hub-quick-btn:hover {
  background: rgba(255,255,255,.08);
  color: #fff; border-color: rgba(255,255,255,.12);
  transform: translateX(3px);
}
.hub-quick-icon { font-size: 16px; width: 22px; flex-shrink: 0; }

/* ── TOPBAR MÓDULO (dark) ─────────────────────────── */

.topbar-title { color: #fff !important; }
.topbar-user { background: rgba(255,255,255,.07) !important; border-color: rgba(255,255,255,.12) !important; color: rgba(255,255,255,.6) !important; }
.alerts-bell { color: rgba(255,255,255,.6) !important; }

/* Cuando estamos en módulo, el body y main cambian */
body.in-module { background: #f4f7fb; }
body.in-module #main { background: #f4f7fb; display:flex; flex-direction:column; height:100vh; overflow:hidden; }
body.in-module #tabArea {
  background: #f4f7fb;
  display: block !important;
}
body.in-module .tab-c.active { display: block; }
body.in-module #mod-navbar { display: flex !important; }

/* Override colores módulos para dark */
body.in-module .card { background: #ffffff !important; border-color: rgba(7,55,99,0.10) !important; }
body.in-module .card-title { color: #073763 !important; border-bottom-color: rgba(7,55,99,0.10) !important; }
body.in-module table thead tr { background: #f4f7fb !important; }
body.in-module table thead th { color: rgba(7,55,99,0.55) !important; border-bottom-color: rgba(7,55,99,0.10) !important; }
body.in-module table tbody tr:hover { background: rgba(7,55,99,0.03) !important; }
body.in-module table tbody tr { border-bottom-color: rgba(7,55,99,0.07) !important; }
body.in-module table tbody td { color: #1a2740 !important; }
body.in-module table tbody td strong { color: #073763 !important; }
body.in-module .page-header h1 { color: #073763 !important; }
body.in-module .page-header p { color: rgba(7,55,99,0.55) !important; }
body.in-module .btn { background: #ffffff !important; border-color: rgba(7,55,99,0.15) !important; color: #073763 !important; }
body.in-module .btn.primary { background: linear-gradient(135deg,#073763,#0e81c5) !important; color: #fff !important; border: none !important; }
body.in-module .search-input { background: #ffffff !important; border-color: rgba(7,55,99,0.15) !important; color: #1a2740 !important; }
body.in-module .sel-sm { background: #ffffff !important; border-color: rgba(7,55,99,0.15) !important; color: #1a2740 !important; }
body.in-module .pill { background: #f4f7fb !important; border-color: rgba(7,55,99,0.15) !important; color: #4a5e78 !important; }
body.in-module .pill.active { background: linear-gradient(135deg,#073763,#0e81c5) !important; border-color: transparent !important; color: #fff !important; }
body.in-module .kpi-card { background: #ffffff !important; border-color: rgba(7,55,99,0.10) !important; }
body.in-module .kpi-value { color: #073763 !important; }
body.in-module .kpi-label { color: rgba(7,55,99,0.55) !important; }
body.in-module .kpi-sub { color: rgba(7,55,99,0.45) !important; }
body.in-module .field label { color: rgba(7,55,99,0.70) !important; }
body.in-module .field input, body.in-module .field select, body.in-module .field textarea { background: #ffffff !important; border-color: rgba(7,55,99,0.15) !important; color: #1a2740 !important; }
body.in-module .count-label { background: #f4f7fb !important; border-color: rgba(7,55,99,0.12) !important; color: rgba(7,55,99,0.60) !important; }
body.in-module .table-wrap { border-color: rgba(7,55,99,0.10) !important; }
body.in-module #tabArea { padding: 20px 24px; }

/* Hub search overlay */
.hub-search-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  z-index: 200; backdrop-filter: blur(4px);
  align-items: flex-start; justify-content: center;
  padding-top: 80px;
}
.hub-search-results {
  background: #161b27; border: 1px solid rgba(255,255,255,.1);
  border-radius: 14px; width: 600px; max-height: 420px;
  overflow-y: auto; box-shadow: 0 24px 60px rgba(0,0,0,.5);
  padding: 8px;
}
.hub-sr-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 9px; cursor: pointer;
  transition: background .12s;
}
.hub-sr-item:hover { background: rgba(255,255,255,.06); }
.hub-sr-icon { font-size: 16px; width: 22px; text-align: center; }
.hub-sr-text { font-size: 13px; color: rgba(255,255,255,.8); }
.hub-sr-sub { font-size: 11px; color: rgba(255,255,255,.35); margin-top: 2px; }
.hub-sr-tag { font-size: 9px; padding: 2px 8px; border-radius: 4px; font-weight: 700; margin-left: auto; background: rgba(255,255,255,.08); color: rgba(255,255,255,.5); }

@media (max-width: 900px) {
  .hub-tiles-grid { grid-template-columns: repeat(2, 1fr); }
  .hub-bottom-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .hub-tiles-grid { grid-template-columns: 1fr 1fr; }
  .hub-body { padding: 20px 16px; }
}

/* ── Modal carga mantenimiento: anular dark theme de in-module ── */
#modal-carga-mes .field label,
#modal-carga-mes label {
  color: rgba(255,255,255,.65) !important;
}
#modal-carga-mes .field input,
#modal-carga-mes .field select,
#modal-carga-mes select,
#modal-carga-mes input[type="number"],
#modal-carga-mes input[type="text"] {
  background: rgba(255,255,255,.08) !important;
  border-color: rgba(255,255,255,.15) !important;
  color: rgba(255,255,255,.9) !important;
}
#modal-carga-mes .modal-title,
#modal-carga-mes .card-title {
  color: #fff !important;
}
/* Vista previa tabla */
#carga-preview-wrap table thead th {
  background: rgba(255,255,255,.08) !important;
  color: rgba(255,255,255,.7) !important;
  border-color: rgba(255,255,255,.1) !important;
}
#carga-preview-wrap table tbody td {
  color: rgba(255,255,255,.7) !important;
  border-color: rgba(255,255,255,.06) !important;
}
#carga-preview-wrap table tbody tr:hover {
  background: rgba(255,255,255,.04) !important;
}
#carga-preview-wrap {
  background: rgba(255,255,255,.03) !important;
  border-color: rgba(255,255,255,.08) !important;
}
/* Drop zone */
#carga-drop-zone {
  border-color: rgba(124,58,237,.5) !important;
}
#carga-drop-zone p, #carga-drop-zone span, #carga-drop-zone div {
  color: rgba(255,255,255,.7) !important;
}
