/* ============================================================
   AIN Operations Center — production NOC dashboard styling
   Prefix: .opc-
   Built to be visually loud — large numbers, glowing accents,
   live-pulsing indicators, ambient gradients in the background.
   ============================================================ */

.opc-root {
  /* IMPORTANT: do NOT set `position` here. The parent class `.scr`
     (defined in styles.css) sets `position: absolute; inset: 0` so
     this element fills the #main scroll viewport. Overriding to
     `relative` breaks that and disables overflow-y: auto. */
  padding: 18px 22px 32px;
  color: #d4d4d4;
}
.opc-root > * + * { margin-top: 16px; }

/* ── Ambient background ─────────────────────────────────── */
.opc-bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(6, 182, 212, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(6, 182, 212, 0.04) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none; z-index: 0;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 0%, transparent 80%);
}
.opc-bg-glow {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 25% 20%,  rgba(6, 182, 212, 0.10), transparent 60%),
    radial-gradient(ellipse 60% 40% at 75% 80%,  rgba(139, 92, 246, 0.07), transparent 60%),
    radial-gradient(ellipse 50% 30% at 50% 100%, rgba(34, 197, 94, 0.05), transparent 60%);
  pointer-events: none; z-index: 0;
  animation: opc-glow-shift 18s ease-in-out infinite alternate;
}
@keyframes opc-glow-shift {
  0%   { opacity: 0.7; transform: translate(0, 0) scale(1); }
  100% { opacity: 1;   transform: translate(2%, -2%) scale(1.05); }
}
.opc-root > * { position: relative; z-index: 1; }

/* ── Header ─────────────────────────────────────────────── */
.opc-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 14px 22px;
  /* background: linear-gradient(135deg, rgba(15, 23, 42, 0.7), rgba(15, 23, 42, 0.5)); */
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: 8px;
  backdrop-filter: blur(14px);
  position: relative;
  overflow: hidden;
}
.opc-header::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 1px;
  background: linear-gradient(90deg, transparent, #06B6D4, transparent);
  animation: opc-header-sweep 4s ease-in-out infinite;
}
@keyframes opc-header-sweep {
  0%, 100% { left: -100%; }
  50%      { left: 100%; }
}
.opc-header-left  { justify-self: start; }
.opc-header-right { justify-self: end; display: flex; align-items: center; gap: 18px; }

.opc-clock-block {
  display: flex; flex-direction: column; align-items: flex-start;
}
.opc-clock {
  font-family: 'Courier New', monospace;
  font-size: 32px; font-weight: 800;
  color: #06B6D4;
  text-shadow: 0 0 22px rgba(6, 182, 212, 0.7);
  letter-spacing: 3px; line-height: 1;
}
.opc-clock-date {
  font-size: 10px; color: #9ca3af;
  letter-spacing: 2.5px; margin-top: 4px;
}

.opc-header-center { text-align: center; }
.opc-title {
  font-size: 20px; font-weight: 800; letter-spacing: 4px;
  background: linear-gradient(135deg, #fff 0%, #67e8f9 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 26px rgba(6, 182, 212, 0.4);
}
.opc-subtitle {
  font-size: 10px; color: #6b7280;
  letter-spacing: 1.5px; margin-top: 4px;
}

.opc-live-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.4);
  border-radius: 4px;
  font-size: 11px; font-weight: 700;
  color: #4ade80; letter-spacing: 1.5px;
}
.opc-live-dot {
  width: 8px; height: 8px;
  background: #22C55E;
  border-radius: 50%;
  box-shadow: 0 0 8px #22C55E;
  animation: opc-pulse-dot 1.4s ease-in-out infinite;
}
@keyframes opc-pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1);   }
  50%      { opacity: .4; transform: scale(0.7); }
}
.opc-refresh-info { text-align: right; }
.opc-refresh-label {
  font-size: 9px; color: #6b7280;
  letter-spacing: 1.5px; text-transform: uppercase;
}
.opc-refresh-value {
  font-size: 12px; font-weight: 600; color: #67e8f9;
  margin-top: 2px;
  font-family: monospace;
}

/* ── KPI ROW ────────────────────────────────────────────── */
.opc-kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
.opc-kpi-card {
  position: relative;
  padding: 18px 20px 0;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.85), rgba(20, 30, 50, 0.7));
  border: 1px solid rgba(6, 182, 212, 0.18);
  border-radius: 8px;
  overflow: hidden;
  backdrop-filter: blur(10px);
  display: flex; align-items: center; gap: 14px;
  min-height: 100px;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  animation: opc-slide-up 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}
.opc-kpi-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent, #06B6D4), transparent);
  opacity: 0.7;
}
.opc-kpi-card::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at top right, var(--accent, #06B6D4), transparent 60%);
  opacity: 0.06;
  pointer-events: none;
}
.opc-kpi-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent, #06B6D4);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4), 0 0 24px var(--accent, #06B6D4)33;
}

.opc-kpi-card:nth-child(1) { animation-delay: 0.05s; }
.opc-kpi-card:nth-child(2) { animation-delay: 0.10s; }
.opc-kpi-card:nth-child(3) { animation-delay: 0.15s; }
.opc-kpi-card:nth-child(4) { animation-delay: 0.20s; }
.opc-kpi-card:nth-child(5) { animation-delay: 0.25s; }

.opc-kpi-icon {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid var(--accent, #06B6D4);
  border-radius: 6px;
  font-size: 20px;
  color: var(--accent, #06B6D4);
  text-shadow: 0 0 8px var(--accent, #06B6D4);
  flex-shrink: 0;
}
.opc-kpi-body { flex: 1; min-width: 0; position: relative; z-index: 2; }
.opc-kpi-value {
  font-size: 36px; font-weight: 800; line-height: 1;
  color: #fff;
  text-shadow: 0 0 20px var(--accent, #06B6D4);
  margin-bottom: 4px;
  font-feature-settings: 'tnum';
}
.opc-kpi-label {
  font-size: 9px; color: #6b7280;
  letter-spacing: 1.5px; font-weight: 600;
}
.opc-kpi-spark {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  width: 100%; height: 30px;
  pointer-events: none;
}

/* ── Sections ───────────────────────────────────────────── */
.opc-section {
  /* background: linear-gradient(145deg, rgba(15, 23, 42, 0.8), rgba(20, 30, 50, 0.6)); */
  border: 1px solid rgba(6, 182, 212, 0.18);
  border-radius: 8px;
  padding: 14px 16px;
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
  animation: opc-slide-up 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
  animation-delay: 0.3s;
  display: flex; flex-direction: column;
}
.opc-section::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(6, 182, 212, 0.5), transparent);
}
.opc-section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(6, 182, 212, 0.1);
  flex-shrink: 0;
}
.opc-section-title {
  font-size: 11px; font-weight: 700;
  color: #67e8f9; letter-spacing: 2px;
}
.opc-section-meta {
  font-size: 10px; color: #9ca3af;
  display: flex; gap: 10px; align-items: center;
}

/* ── Status wall ────────────────────────────────────────── */
.opc-status-wall-section { animation-delay: 0.35s; }
.opc-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18px, 1fr));
  gap: 4px;
  min-height: 80px;
}
.opc-cell {
  aspect-ratio: 1;
  border-radius: 2px;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.opc-cell:hover { transform: scale(2); z-index: 5; position: relative; }
.opc-cell-pulse { animation: opc-cell-pulse 1.2s ease-in-out infinite; }
@keyframes opc-cell-pulse {
  0%, 100% { opacity: 1;   transform: scale(1);    }
  50%      { opacity: 0.5; transform: scale(0.85); }
}
.opc-cell-crit { outline: 1px solid #fff3; outline-offset: 1px; }

/* ── Donut + Alerts row ─────────────────────────────────── */
.opc-row-2 {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 14px;
  min-height: 280px;
}
.opc-donut-section { animation-delay: 0.4s; }
.opc-alerts-section { animation-delay: 0.45s; }

.opc-donut-wrap { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; }
.opc-donut-flex { display: flex; align-items: center; gap: 16px; width: 100%; }
.opc-donut-svg-wrap { position: relative; flex-shrink: 0; }
.opc-donut-svg { width: 220px; height: 210px; }
.opc-donut-center {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.opc-donut-total { font-size: 36px; font-weight: 800; color: #fff;
                   text-shadow: 0 0 20px rgba(6, 182, 212, 0.5); }
.opc-donut-total-label { font-size: 10px; color: #6b7280;
                         letter-spacing: 1.5px; margin-top: 2px; }

.opc-donut-legend { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.opc-donut-legend-row {
  display: grid;
  grid-template-columns: 12px 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 5px 8px;
  background: rgba(255,255,255,0.02);
  border-radius: 3px;
  font-size: 11px;
}
.opc-donut-dot { width: 10px; height: 10px; border-radius: 50%; }
.opc-donut-leg-label { color: #d4d4d4; font-weight: 500; }
.opc-donut-leg-val   { color: #fff; font-weight: 700; }
.opc-donut-leg-pct   { color: #67e8f9; font-family: monospace; min-width: 42px; text-align: right; }

/* ── Feed (alerts / down devices) ───────────────────────── */
.opc-feed {
  flex: 1;
  display: flex; flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  min-height: 0;
}
.opc-feed-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.025);
  border-left: 2px solid var(--c, #06B6D4);
  border-radius: 0 4px 4px 0;
  animation: opc-slide-right 0.4s ease backwards;
  flex-shrink: 0;
}
.opc-feed-firing {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.12), rgba(255,255,255,0.025));
}
.opc-feed-dot {
  width: 8px; height: 8px;
  border-radius: 50%; flex-shrink: 0;
}
.opc-feed-body { flex: 1; min-width: 0; }
.opc-feed-title {
  color: #fff; font-weight: 600; font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.opc-feed-meta {
  color: #6b7280; font-size: 10px;
  letter-spacing: 0.3px; margin-top: 2px;
}
.opc-feed-sev { font-weight: 700; }
.opc-feed-compact .opc-feed-item { padding: 6px 10px; }

/* ── Top lists row ──────────────────────────────────────── */
.opc-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 14px;
  min-height: 240px;
}
.opc-row-3 .opc-section:nth-child(1) { animation-delay: 0.5s; }
.opc-row-3 .opc-section:nth-child(2) { animation-delay: 0.55s; }
.opc-row-3 .opc-section:nth-child(3) { animation-delay: 0.6s; }

.opc-list { font-size: 11px; flex: 1; overflow-y: auto; min-height: 0; }
.opc-list-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  animation: opc-slide-right 0.4s ease backwards;
}
.opc-list-row:last-child { border-bottom: none; }
.opc-list-name {
  flex: 1.2;
  color: #d4d4d4; font-weight: 500;
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.opc-list-bar {
  flex: 1; height: 6px;
  background: rgba(255,255,255,0.05);
  border-radius: 3px; overflow: hidden;
}
.opc-list-fill {
  height: 100%;
  background: linear-gradient(90deg, #06B6D4, #0891b2);
  border-radius: 3px;
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.5);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.opc-list-fill.high { background: linear-gradient(90deg, #F59E0B, #d97706); box-shadow: 0 0 8px rgba(245,158,11,0.5); }
.opc-list-fill.crit { background: linear-gradient(90deg, #EF4444, #b91c1c); box-shadow: 0 0 8px rgba(239,68,68,0.6); }
.opc-list-val {
  color: #67e8f9; font-weight: 700;
  font-size: 10px; min-width: 50px;
  text-align: right; font-family: monospace;
}

/* ── Empty / loading ────────────────────────────────────── */
.opc-empty {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #6b7280;
  padding: 20px;
}

/* ── Animations ─────────────────────────────────────────── */
@keyframes opc-slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes opc-slide-right {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Responsive: stack on narrower screens */
@media (max-width: 1280px) {
  .opc-kpi-row { grid-template-columns: repeat(3, 1fr); }
  .opc-row-2   { grid-template-columns: 1fr; }
  .opc-row-3   { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .opc-kpi-row, .opc-row-3 { grid-template-columns: 1fr; }
  .opc-header { grid-template-columns: 1fr; gap: 8px; text-align: center; }
}