/* ============================================================
   17-home-hub.css - Command Hub & Site Gateway Styling
   ============================================================ */

.home-hub-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 6px;
  width: 100%;
  box-sizing: border-box;
}

/* 1. Command Banner */
.home-command-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #1e1e24 0%, #252433 100%);
  border: 1px solid #38364a;
  border-radius: 10px;
  padding: 24px 28px;
  gap: 24px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.command-banner-kicker {
  font-size: 11px;
  font-weight: 700;
  color: #6559ff;
  letter-spacing: 1px;
}
.command-banner-title {
  font-size: 22px;
  margin: 4px 0 6px 0;
  color: #ffffff;
  font-weight: 700;
}
.command-banner-desc {
  font-size: 13px;
  color: #94a3b8;
  margin: 0;
  max-width: 580px;
}
.command-banner-search-box {
  min-width: 320px;
  position: relative;
}
.search-box-label {
  font-size: 10px;
  font-weight: 800;
  color: #cbd5e1;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  display: block;
}
.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-input-wrap svg {
  position: absolute;
  left: 12px;
  color: #64748b;
}
.search-input-wrap input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  background: #111116;
  border: 1px solid #47455e;
  border-radius: 6px;
  color: #ffffff;
  font-size: 13px;
  outline: none;
  transition: all 0.2s ease;
}
.search-input-wrap input:focus {
  border-color: #6559ff;
  box-shadow: 0 0 0 2px rgba(101, 89, 255, 0.25);
}
.site-autocomplete-dropdown {
  position: absolute;
  top: 105%;
  left: 0;
  right: 0;
  background: #1a1a24;
  border: 1px solid #38364a;
  border-radius: 6px;
  z-index: 1000;
  box-shadow: 0 10px 20px rgba(0,0,0,0.5);
  max-height: 240px;
  overflow-y: auto;
}
.site-autocomplete-dropdown.is-hidden { display: none; }
.auto-item {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #282736;
}
.auto-item:hover { background: #28273d; }
.auto-name { font-size: 13px; font-weight: 600; color: #ffffff; }
.auto-region { font-size: 11px; color: #94a3b8; }

/* 2. Metric Pulse Grid */
.home-metric-pulse-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.pulse-card {
  background: #181820;
  border: 1px solid #2e2d3d;
  border-radius: 8px;
  padding: 18px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.pulse-card:hover {
  transform: translateY(-2px);
  border-color: #6559ff;
}
.pulse-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.pulse-tag {
  font-size: 11px;
  font-weight: 800;
  color: #94a3b8;
  letter-spacing: 0.5px;
}
.pulse-link {
  font-size: 11px;
  color: #6559ff;
  font-weight: 600;
}
.pulse-stats-row {
  display: flex;
  gap: 28px;
}
.pulse-stat-item .stat-num {
  display: block;
  font-size: 26px;
  font-weight: 800;
  color: #ffffff;
}
.pulse-stat-item .stat-lbl {
  font-size: 11px;
  color: #64748b;
}
.pulse-systems-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.system-mini-badge {
  background: #101016;
  border: 1px solid #282738;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.sys-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.dot-green { background: #10b981; }
.dot-blue { background: #3b82f6; }
.dot-purple { background: #8b5cf6; }
.dot-amber { background: #f59e0b; }

/* 3. Map & Directory Workspace */
.home-workspace-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
  height: 520px;
}
.home-map-card, .home-directory-card {
  background: #181820;
  border: 1px solid #2e2d3d;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.home-map-header, .directory-header {
  padding: 12px 16px;
  background: #14141c;
  border-bottom: 1px solid #282738;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.map-title, .directory-header h3 {
  font-size: 14px;
  margin: 0;
  font-weight: 700;
  color: #ffffff;
}
.map-subtitle { font-size: 11px; color: #64748b; }
.home-btn-sm {
  background: #232230;
  color: #ffffff;
  border: 1px solid #38364a;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  text-decoration: none;
}
.home-btn-sm.btn-primary {
  background: #6559ff;
  border-color: #6559ff;
}
.home-leaflet-container {
  flex: 1;
  width: 100%;
  height: 100%;
}

/* Site Directory Listing */
.directory-filter-pills { display: flex; gap: 4px; }
.dir-pill {
  background: transparent;
  border: 1px solid #38364a;
  color: #94a3b8;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.dir-pill.is-active { background: #6559ff; color: #fff; border-color: #6559ff; }

.home-selected-preview {
  padding: 12px 14px;
  background: #201f2e;
  border-bottom: 1px solid #2e2d3d;
}
.home-selected-preview.is-empty {
  text-align: center;
  color: #64748b;
  font-size: 12px;
  padding: 18px 14px;
}
.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}
.preview-title { margin: 0; font-size: 14px; color: #ffffff; font-weight: 700; }
.preview-sub { font-size: 11px; color: #94a3b8; }
.preview-primary-btn {
  background: #10b981;
  color: #ffffff;
  border: none;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.preview-badges-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.p-badge {
  background: #14141c;
  border: 1px solid #2e2d3d;
  border-radius: 4px;
  padding: 6px;
  text-align: center;
}
.p-badge-val { display: block; font-size: 14px; font-weight: 800; color: #ffffff; }
.p-badge-lbl { font-size: 9px; color: #64748b; }

.home-site-scroll-list {
  flex: 1;
  overflow-y: auto;
}
.site-dir-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #242331;
  cursor: pointer;
  transition: background 0.15s ease;
}
.site-dir-row:hover { background: #222130; }
.dir-site-name { display: block; font-size: 12.5px; font-weight: 700; color: #ffffff; }
.dir-site-region { font-size: 11px; color: #64748b; }
.dir-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 4px;
  margin-right: 6px;
}
.badge-danger { background: rgba(239, 68, 68, 0.2); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.4); }
.badge-ok { background: rgba(16, 185, 129, 0.2); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.4); }
.dir-go-btn {
  background: #2a293b;
  border: 1px solid #38364a;
  color: #cbd5e1;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  cursor: pointer;
}
.dir-go-btn:hover { background: #6559ff; color: #ffffff; }

/* 4. Weather Risk Radar */
.home-weather-radar-section {
  background: #181820;
  border: 1px solid #2e2d3d;
  border-radius: 8px;
  padding: 18px 20px;
}
.radar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.radar-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.radar-title-wrap h3 { margin: 0; font-size: 14px; color: #ffffff; }
.radar-pulse-icon {
  width: 9px;
  height: 9px;
  background: #ef4444;
  border-radius: 50%;
  box-shadow: 0 0 8px #ef4444;
  animation: pulseRadar 1.5s infinite;
}
@keyframes pulseRadar {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}
.radar-desc { font-size: 11px; color: #64748b; }
.radar-site-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.radar-card {
  background: #111116;
  border: 1px solid #282736;
  border-radius: 6px;
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.2s ease;
}
.radar-card:hover { border-color: #6559ff; }
.radar-card.hazard-active {
  border-color: #ef4444;
  background: #1c1518;
}
.radar-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.radar-site-name { font-size: 12px; color: #ffffff; }
.radar-status-badge {
  font-size: 9px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 3px;
}
.radar-telemetry-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed #282738;
}
.telemetry-item .tel-lbl { display: block; font-size: 9px; color: #64748b; }
.telemetry-item .tel-val { font-size: 11px; font-weight: 700; color: #cbd5e1; }
.radar-card-link { font-size: 10px; color: #6559ff; font-weight: 700; }

/* Custom Popup Inside Map */
.home-map-pin-popup {
  min-width: 180px;
}
.popup-site-name {
  font-size: 13px;
  font-weight: 800;
  margin: 0 0 2px 0;
  color: #0f172a;
}
.popup-site-region {
  font-size: 10px;
  color: #64748b;
  display: block;
  margin-bottom: 8px;
}
.popup-metrics-grid {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  border-top: 1px solid #e2e8f0;
  padding-top: 6px;
}
.popup-m-val { display: block; font-size: 14px; font-weight: 800; color: #0f172a; }
.popup-m-lbl { font-size: 9px; color: #64748b; }
.popup-go-btn {
  width: 100%;
  background: #6559ff;
  border: none;
  color: #ffffff;
  padding: 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.popup-go-btn:hover { background: #4f43e0; }