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

:root {
  --hh-blue: #005C8A;
  --hh-orange: #F26A21;
  --hh-dark: #0a1628;
  --hh-dark2: #0f1f38;
  --hh-panel: #111d2e;
  --hh-border: #1e3a5f;
  --green: #00e676;
  --text: #e0eaf4;
  --dim: #6b8cad;
  --transition: 0.5s ease;
}

html, body { width: 100%; min-height: 100vh; font-family: 'Segoe UI', system-ui, sans-serif; background: #f0f4f8; color: #1a2b3c; transition: background var(--transition), color var(--transition); }

/* EDGE DARK MODE */
body.edge-mode { background: var(--hh-dark); color: var(--text); }

/* HEADER */
#app-header {
  background: var(--hh-blue);
  color: #fff;
  padding: 0;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 24px; gap: 12px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
#hh-logo { width: 42px; height: 42px; border-radius: 6px; background: #fff; object-fit: contain; padding: 2px; }
.brand-name { display: block; font-size: 1.1rem; font-weight: 700; letter-spacing: 0.3px; }
.brand-sub { display: block; font-size: 0.7rem; opacity: 0.8; }
.partner-logos { display: flex; align-items: center; gap: 16px; }
.partner-logo { height: 28px; object-fit: contain; filter: brightness(0) invert(1); transition: filter 0.3s; }
.losant-logo { height: 22px; }
body.edge-mode .partner-logo { filter: brightness(0) invert(1); }

/* TOGGLE BAR */
.toggle-bar {
  background: rgba(0,0,0,0.25);
  padding: 8px 24px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.toggle-label { font-size: 0.82rem; font-weight: 600; color: rgba(255,255,255,0.75); }
#toggle-label-right { color: #fff; }

.toggle-switch { position: relative; display: inline-block; width: 52px; height: 26px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: rgba(255,255,255,0.2); border-radius: 26px;
  transition: background 0.3s;
}
.slider::before {
  content: ''; position: absolute;
  width: 20px; height: 20px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: transform 0.3s;
}
input:checked + .slider { background: var(--hh-orange); }
input:checked + .slider::before { transform: translateX(26px); }

.k8s-badge {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.25);
  border-radius: 20px; padding: 3px 10px 3px 6px;
  font-size: 0.75rem; font-weight: 600; color: #fff;
  animation: fadeIn 0.5s ease;
}
.k8s-badge img { width: 20px; height: 20px; }
.k8s-badge.hidden { display: none; }

/* LEGACY BANNER */
.legacy-banner { padding: 32px 24px; max-width: 1100px; margin: 0 auto; }
.legacy-inner h2 { color: var(--hh-blue); font-size: 1.4rem; margin-bottom: 10px; }
.legacy-inner > p { color: #4a5e72; font-size: 0.95rem; line-height: 1.6; max-width: 760px; margin-bottom: 28px; }

.manufacturer-grid { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 32px; }
.mfr-card {
  background: #fff; border: 1px solid #dce6ef; border-radius: 10px;
  padding: 16px 20px; display: flex; flex-direction: column; align-items: center;
  gap: 8px; min-width: 120px; box-shadow: 0 2px 8px rgba(0,92,138,0.08);
  transition: box-shadow 0.2s, transform 0.2s;
}
.mfr-card:hover { box-shadow: 0 4px 18px rgba(0,92,138,0.18); transform: translateY(-2px); }
.mfr-card img { width: 56px; height: 56px; object-fit: contain; }
.mfr-card span { font-size: 0.75rem; font-weight: 600; color: #3a5068; text-align: center; }

.six-rs h3 { color: var(--hh-blue); font-size: 1.1rem; margin-bottom: 14px; }
.rs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.r-card {
  background: #fff; border-left: 4px solid var(--hh-orange);
  border-radius: 8px; padding: 14px 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.r-card strong { display: block; font-size: 0.9rem; color: var(--hh-blue); margin-bottom: 4px; }
.r-card p { font-size: 0.75rem; color: #5a6e80; line-height: 1.4; }

/* EDGE VIEW */
.edge-view {
  display: flex; gap: 0; min-height: calc(100vh - 140px);
  transition: opacity 0.4s;
}
.edge-view.hidden { display: none; }

/* SKID PANEL */
.skid-panel {
  flex: 1 1 55%; background: var(--hh-panel);
  padding: 20px; border-right: 1px solid var(--hh-border);
  display: flex; flex-direction: column; gap: 14px;
}
.panel-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.live-badge { color: var(--green); font-size: 0.75rem; font-weight: 700; margin-left: 8px; animation: blink 2s infinite; }

.skid-wrapper {
  position: relative; width: 100%;
  border-radius: 10px; overflow: visible;
  background: #000;
}
#skid-img {
  width: 100%; display: block;
  border-radius: 10px; opacity: 0.85;
  filter: brightness(0.85) saturate(0.9);
}

/* NODE OVERLAYS */
.node-overlay {
  position: absolute; cursor: pointer;
  outline: none;
  transform: translate(-50%, -50%);
  z-index: 10;
}
.pulse-dot {
  width: 22px; height: 22px; border-radius: 50%;
  position: relative;
}
.pulse-dot::before, .pulse-dot::after {
  content: ''; position: absolute; inset: 0;
  border-radius: 50%; animation: pulse-ring 2s ease-out infinite;
}
.pulse-dot::after { animation-delay: 1s; }
.pulse-dot.orange { background: var(--hh-orange); }
.pulse-dot.orange::before, .pulse-dot.orange::after { background: rgba(242,106,33,0.4); }
.pulse-dot.blue { background: #29b6f6; }
.pulse-dot.blue::before, .pulse-dot.blue::after { background: rgba(41,182,246,0.35); }
.pulse-dot.green { background: var(--green); }
.pulse-dot.green::before, .pulse-dot.green::after { background: rgba(0,230,118,0.35); }

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(3); opacity: 0; }
}

/* TOOLTIPS */
.node-tooltip {
  display: none;
  position: absolute; top: 28px; left: 50%;
  transform: translateX(-50%);
  background: rgba(10,22,40,0.95);
  border: 1px solid var(--hh-border);
  border-top: 2px solid var(--hh-orange);
  border-radius: 8px; padding: 12px 16px;
  min-width: 200px; z-index: 20;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.5);
  animation: slideDown 0.2s ease;
}
.node-overlay:hover .node-tooltip,
.node-overlay:focus .node-tooltip,
.node-overlay.active .node-tooltip { display: block; }
.tt-header { font-size: 0.82rem; font-weight: 700; color: #fff; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.tt-metric { font-size: 0.8rem; color: var(--dim); margin-bottom: 4px; }
.tt-metric span { color: #fff; font-weight: 600; }
.status-ok { color: var(--green); font-size: 0.7rem; background: rgba(0,230,118,0.12); border-radius: 4px; padding: 1px 5px; margin-left: 4px; }
.tt-sub { font-size: 0.68rem; color: #3a5a7a; margin-top: 8px; font-family: monospace; }

/* PIPELINE LINE */
.pipeline-line {
  display: none;
  position: absolute; top: 40%; right: -2px;
  width: 40px; height: 3px;
  background: linear-gradient(90deg, var(--hh-orange), transparent);
  animation: flow-pulse 1s linear infinite;
}
body.edge-mode .pipeline-line { display: block; }
@keyframes flow-pulse {
  0% { opacity: 1; } 50% { opacity: 0.3; } 100% { opacity: 1; }
}

/* CLOUD PANEL */
.cloud-panel {
  flex: 1 1 45%; background: var(--hh-dark2);
  display: flex; flex-direction: column;
  padding: 20px; gap: 16px;
}
.cloud-header { display: flex; align-items: center; justify-content: space-between; }
.cloud-logo { height: 26px; object-fit: contain; filter: brightness(0) invert(1); }

.terminal {
  flex: 1; background: #060e1a; border-radius: 8px;
  border: 1px solid var(--hh-border);
  padding: 14px; font-family: 'Courier New', monospace;
  font-size: 0.72rem; overflow-y: auto; min-height: 200px; max-height: 320px;
  color: #00e676;
}
.term-line { margin-bottom: 4px; word-break: break-all; }
.term-line.dim { color: #2a4a6a; }
.term-line.json { color: #64b5f6; }
.term-line.warn { color: var(--hh-orange); }

.cloud-gauges { display: flex; flex-direction: column; gap: 12px; }
.gauge-card { background: rgba(255,255,255,0.04); border-radius: 8px; padding: 12px 16px; border: 1px solid var(--hh-border); }
.gauge-label { font-size: 0.72rem; color: var(--dim); margin-bottom: 6px; }
.gauge-bar { height: 8px; background: rgba(255,255,255,0.08); border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
.gauge-fill { height: 100%; border-radius: 4px; transition: width 1s ease; }
.gauge-fill.orange { background: linear-gradient(90deg, var(--hh-blue), var(--hh-orange)); }
.gauge-fill.blue { background: linear-gradient(90deg, #0d47a1, #29b6f6); }
.gauge-fill.green { background: linear-gradient(90deg, #00695c, var(--green)); }
.gauge-val { font-size: 0.82rem; font-weight: 700; color: #fff; }

/* TOAST */
.alert-toast {
  position: fixed; bottom: 90px; right: 24px; z-index: 999;
  background: #1a0a00; border: 1px solid var(--hh-orange);
  border-left: 4px solid var(--hh-orange);
  border-radius: 10px; padding: 16px 48px 16px 16px;
  max-width: 360px; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  display: flex; gap: 12px; align-items: flex-start;
  animation: slideIn 0.4s ease;
}
.alert-toast.hidden { display: none; }
.toast-icon { font-size: 1.4rem; color: var(--hh-orange); flex-shrink: 0; }
.toast-body strong { display: block; color: #fff; font-size: 0.85rem; margin-bottom: 4px; }
.toast-body p { font-size: 0.75rem; color: #c8a07a; line-height: 1.4; }
.toast-close {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none; color: #888; cursor: pointer; font-size: 0.9rem;
}

/* FOOTER */
#app-footer {
  background: var(--hh-blue); color: #fff;
  padding: 16px 24px;
  position: sticky; bottom: 0; z-index: 100;
}
.footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.footer-info { font-size: 0.78rem; opacity: 0.85; line-height: 1.6; }
.footer-info a { color: #ffcc80; }

.cta-btn {
  background: var(--hh-orange); color: #fff;
  padding: 12px 24px; border-radius: 8px;
  font-size: 0.9rem; font-weight: 700;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
  white-space: nowrap;
}
.cta-btn:hover { background: #d45a18; transform: translateY(-1px); }

/* ANIMATIONS */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown { from { opacity: 0; transform: translateX(-50%) translateY(-6px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

.hidden { display: none !important; }

/* RESPONSIVE */
@media (max-width: 768px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .partner-logos { flex-wrap: wrap; }
  .edge-view { flex-direction: column; }
  .skid-panel, .cloud-panel { flex: 1 1 100%; border-right: none; border-bottom: 1px solid var(--hh-border); }
  .rs-grid { grid-template-columns: 1fr 1fr; }
  .footer-inner { flex-direction: column; text-align: center; }
  .alert-toast { right: 12px; left: 12px; max-width: none; bottom: 80px; }
  .terminal { max-height: 200px; }
}
@media (max-width: 480px) {
  .rs-grid { grid-template-columns: 1fr; }
  .manufacturer-grid { gap: 10px; }
}
