/* PMDR Operational Situation Console — tema NOC oscuro */

:root {
  --noc-bg: #0b1118;
  --noc-surface: #121a24;
  --noc-surface-2: #182230;
  --noc-border: #243044;
  --noc-text: #e8eef5;
  --noc-muted: #8b9cb0;
  --noc-accent: #38a3d4;

  /* OK → verde · WARNING → amarillo · CRITICAL → naranja · DOWN → rojo */
  --st-ok: #22c55e;
  --st-ok-bg: rgba(34, 197, 94, 0.14);
  --st-warn: #eab308;
  --st-warn-bg: rgba(234, 179, 8, 0.16);
  --st-crit: #f97316;
  --st-crit-bg: rgba(249, 115, 22, 0.16);
  --st-down: #ef4444;
  --st-down-bg: rgba(239, 68, 68, 0.18);

  --font: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

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

html,
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--noc-bg);
  color: var(--noc-text);
}

.noc-page {
  display: grid;
  grid-template-rows: auto auto 1fr;
  min-height: 100vh;
}

/* —— Top bar —— */
.noc-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 1.25rem;
  background: linear-gradient(180deg, #0f1722 0%, var(--noc-surface) 100%);
  border-bottom: 1px solid var(--noc-border);
}

.noc-topbar-left {
  justify-self: start;
  min-width: 0;
}

.noc-topbar-right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* —— PBIP (centro) —— */
.noc-pbip-bar {
  justify-self: center;
  text-align: center;
  padding: 0.35rem 0.85rem 0.45rem;
  border-radius: 10px;
  border: 1px solid var(--noc-border);
  background: rgba(15, 23, 34, 0.85);
  min-width: 15.5rem;
}

.noc-pbip-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.noc-pbip-kicker {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--noc-accent);
}

.noc-pbip-authority {
  font-size: 0.62rem;
  font-family: var(--font-mono);
  color: var(--noc-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.noc-pbip-scale {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
}

.noc-pbip-level {
  padding: 0.28rem 0.4rem;
  border-radius: 6px;
  border: 2px solid var(--noc-border);
  background: var(--noc-surface-2);
  opacity: 0.45;
  transition: opacity 0.2s, transform 0.2s, box-shadow 0.2s;
}

.noc-pbip-level[data-nivel="1"] {
  border-color: rgba(34, 197, 94, 0.35);
}

.noc-pbip-level[data-nivel="2"] {
  border-color: rgba(234, 179, 8, 0.4);
}

.noc-pbip-level[data-nivel="3"] {
  border-color: rgba(239, 68, 68, 0.4);
}

.noc-pbip-level.active {
  opacity: 1;
  transform: scale(1.04);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.noc-pbip-level.active[data-nivel="1"] {
  background: rgba(34, 197, 94, 0.18);
  border-color: #22c55e;
}

.noc-pbip-level.active[data-nivel="2"] {
  background: rgba(234, 179, 8, 0.2);
  border-color: #eab308;
}

.noc-pbip-level.active[data-nivel="3"] {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
}

.noc-pbip-num {
  display: block;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.1;
  font-family: var(--font-mono);
}

.noc-pbip-color {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--noc-muted);
  margin-top: 0.1rem;
}

.noc-pbip-level.active .noc-pbip-color {
  color: var(--noc-text);
}

.noc-pbip-caption {
  margin: 0.35rem 0 0;
  font-size: 0.68rem;
  color: var(--noc-muted);
  font-family: var(--font-mono);
}

.noc-pbip-bar.pbip-active-1 .noc-pbip-caption {
  color: #86efac;
}

.noc-pbip-bar.pbip-active-2 .noc-pbip-caption {
  color: #fde047;
}

.noc-pbip-bar.pbip-active-3 .noc-pbip-caption {
  color: #fca5a5;
}

.noc-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.noc-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #0f2d4a;
  border: 1px solid #1e4a6e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #b8e4f8;
}

.noc-brand-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.noc-brand-sub {
  font-size: 0.72rem;
  color: var(--noc-muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.noc-topbar-meta {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.noc-topbar-meta .live-date {
  color: var(--noc-muted);
  text-transform: capitalize;
}

.noc-topbar-meta .live-clock {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--noc-accent);
}

.noc-topbar-nav a {
  color: var(--noc-muted);
  text-decoration: none;
  font-size: 0.82rem;
  margin-left: 1rem;
}

.noc-topbar-nav a:hover {
  color: var(--noc-text);
}

/* —— Status strip —— */
.noc-status-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "overall countdown counters"
    "legend legend legend";
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--noc-surface);
  border-bottom: 1px solid var(--noc-border);
}

.overall-block {
  grid-area: overall;
}

.counter-grid {
  grid-area: counters;
  justify-self: end;
}

.status-legend {
  grid-area: legend;
}

/* —— Sim countdown —— */
.sim-countdown {
  grid-area: countdown;
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.sim-countdown-ring {
  position: relative;
  width: 4.5rem;
  height: 4.5rem;
}

.sim-countdown-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.sim-countdown-track,
.sim-countdown-bar {
  fill: none;
  stroke-width: 2.8;
}

.sim-countdown-track {
  stroke: rgba(139, 156, 176, 0.2);
}

.sim-countdown-bar {
  stroke: var(--noc-accent);
  stroke-linecap: round;
  stroke-dasharray: 100 100;
  stroke-dashoffset: calc(100 - var(--sim-pct, 100));
  transition: stroke-dashoffset 1s linear, stroke 0.35s ease;
}

.sim-countdown--warn .sim-countdown-bar {
  stroke: var(--st-warn);
}

.sim-countdown--crit .sim-countdown-bar {
  stroke: var(--st-crit);
}

.sim-countdown--urgent .sim-countdown-bar {
  stroke: var(--st-down);
}

.sim-countdown--ended .sim-countdown-bar {
  stroke: var(--noc-muted);
  stroke-dashoffset: 100;
}

.sim-countdown-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
}

.sim-countdown-pct {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--noc-text);
}

.sim-countdown-time {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--noc-muted);
  margin-top: 0.1rem;
}

.sim-countdown-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--noc-muted);
}

.sim-countdown--idle .sim-countdown-pct {
  color: var(--noc-muted);
}

.overall-block {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.overall-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--noc-muted);
}

.overall-pill {
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
}

.status-ok.overall-pill,
.status-ok .status-pill {
  background: var(--st-ok-bg);
  color: var(--st-ok);
  border-color: rgba(34, 197, 94, 0.35);
}

.status-warning.overall-pill,
.status-warning .status-pill {
  background: var(--st-warn-bg);
  color: var(--st-warn);
  border-color: rgba(234, 179, 8, 0.35);
}

.status-critical.overall-pill,
.status-critical .status-pill {
  background: var(--st-crit-bg);
  color: var(--st-crit);
  border-color: rgba(249, 115, 22, 0.45);
}

.status-down.overall-pill,
.status-down .status-pill {
  background: var(--st-down-bg);
  color: var(--st-down);
  border-color: rgba(239, 68, 68, 0.5);
}

.counter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.counter-chip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  background: var(--noc-surface-2);
  border: 1px solid var(--noc-border);
  font-size: 0.78rem;
}

.counter-chip strong {
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.counter-chip.ok strong {
  color: var(--st-ok);
}
.counter-chip.warning strong {
  color: var(--st-warn);
}
.counter-chip.critical strong {
  color: var(--st-crit);
}
.counter-chip.down strong {
  color: var(--st-down);
}

.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 0;
  width: 100%;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-legend span {
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  border: 1px solid transparent;
}

.legend-ok {
  color: var(--st-ok);
  background: var(--st-ok-bg);
  border-color: rgba(34, 197, 94, 0.35);
}

.legend-warning {
  color: var(--st-warn);
  background: var(--st-warn-bg);
  border-color: rgba(234, 179, 8, 0.35);
}

.legend-critical {
  color: var(--st-crit);
  background: var(--st-crit-bg);
  border-color: rgba(249, 115, 22, 0.45);
}

.legend-down {
  color: var(--st-down);
  background: var(--st-down-bg);
  border-color: rgba(239, 68, 68, 0.5);
}

/* —— Main layout —— */
.noc-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 0;
  min-height: 0;
}

.noc-console-area {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--noc-border);
}

.noc-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background: var(--noc-surface-2);
  border-bottom: 1px solid var(--noc-border);
}

.control-field label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--noc-muted);
  margin-bottom: 0.25rem;
}

.control-field select {
  min-width: 14rem;
  padding: 0.45rem 0.6rem;
  background: var(--noc-bg);
  border: 1px solid var(--noc-border);
  border-radius: 6px;
  color: var(--noc-text);
  font: inherit;
  font-size: 0.85rem;
}

.sim-meta {
  display: flex;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--noc-muted);
  margin-left: auto;
}

.sim-meta strong {
  color: var(--noc-text);
}

.noc-btn {
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  border: 1px solid var(--noc-border);
  background: var(--noc-surface);
  color: var(--noc-text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.noc-btn:hover:not(:disabled) {
  border-color: var(--noc-accent);
}

.noc-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.noc-btn-primary {
  background: #0c5f8a;
  border-color: #0c5f8a;
  color: #fff;
}

.noc-btn-primary:hover:not(:disabled) {
  background: #095d85;
}

.scenario-brief {
  padding: 0.65rem 1.25rem;
  border-bottom: 1px solid var(--noc-border);
  background: rgba(56, 163, 212, 0.04);
}

.scenario-type-badge {
  display: inline-block;
  margin: 0 0 0.35rem;
  padding: 0.15rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--noc-accent);
  background: rgba(56, 163, 212, 0.12);
  border: 1px solid rgba(56, 163, 212, 0.28);
  border-radius: 4px;
}

.scenario-brief h2 {
  margin: 0 0 0.25rem;
  font-size: 0.92rem;
  font-weight: 600;
}

.scenario-brief p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--noc-muted);
  line-height: 1.45;
}

/* —— Service table —— */
.noc-table-wrap {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.noc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.noc-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #0e1520;
}

.noc-table th {
  text-align: left;
  padding: 0.55rem 1rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--noc-muted);
  border-bottom: 1px solid var(--noc-border);
  font-weight: 600;
}

.noc-table td {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid rgba(36, 48, 68, 0.6);
  vertical-align: middle;
}

.service-row {
  cursor: pointer;
  transition: background 0.2s ease;
}

.service-row:hover {
  background: rgba(56, 163, 212, 0.06);
}

.service-row.is-selected {
  background: rgba(56, 163, 212, 0.1);
  outline: 1px solid rgba(56, 163, 212, 0.25);
  outline-offset: -1px;
}

.service-row.is-flash {
  animation: noc-flash 0.8s ease;
}

@keyframes noc-flash {
  0% {
    background: rgba(255, 255, 255, 0.08);
  }
  100% {
    background: transparent;
  }
}

.col-name {
  font-weight: 500;
}

.service-cat {
  display: block;
  font-size: 0.68rem;
  color: var(--noc-muted);
  margin-top: 0.1rem;
}

.status-pill {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
}

.col-time,
.col-duration {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--noc-muted);
}

.col-reason {
  max-width: 16rem;
  font-size: 0.8rem;
  color: #c5d4e3;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-location {
  max-width: 11rem;
  font-size: 0.76rem;
  color: var(--noc-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-responsible {
  font-size: 0.78rem;
  color: #b8c8d9;
  max-width: 9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-reason {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #dbe8f4;
  padding: 0.55rem 0.7rem;
  background: rgba(15, 45, 74, 0.35);
  border-radius: 6px;
  border-left: 3px solid var(--noc-accent);
}

.detail-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.detail-meta-grid p {
  font-size: 0.84rem;
}

@media (max-width: 520px) {
  .detail-meta-grid {
    grid-template-columns: 1fr;
  }
}

/* —— Detail panel —— */
.noc-detail-wrap {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--noc-surface);
}

.noc-detail-wrap .noc-detail {
  flex: 1;
  min-height: 0;
}

.noc-detail-wrap .noc-detail[hidden] {
  display: none;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--noc-border);
  background: var(--noc-surface-2);
}

.detail-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.detail-category {
  font-size: 0.72rem;
  color: var(--noc-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.2rem;
}

.detail-close {
  background: transparent;
  border: none;
  color: var(--noc-muted);
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.15rem;
}

.detail-close:hover {
  color: var(--noc-text);
}

.detail-body {
  padding: 1rem 1.1rem;
  overflow-y: auto;
  flex: 1;
}

.detail-block {
  margin-bottom: 1.1rem;
}

.detail-block h3 {
  margin: 0 0 0.35rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--noc-muted);
  font-weight: 600;
}

.detail-block p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--noc-text);
}

.detail-status {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
}

.detail-opip {
  padding: 0.75rem;
  background: rgba(12, 95, 138, 0.15);
  border: 1px solid rgba(56, 163, 212, 0.25);
  border-radius: 8px;
}

.detail-opip p {
  color: #b8e4f8;
}

.detail-placeholder {
  padding: 2rem 1.1rem;
  color: var(--noc-muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.noc-disclaimer {
  padding: 0.45rem 1.25rem;
  font-size: 0.68rem;
  color: var(--noc-muted);
  border-top: 1px solid var(--noc-border);
  background: #0a0f15;
  font-family: var(--font-mono);
}

.load-error {
  margin: 1rem 1.25rem;
  padding: 0.75rem 1rem;
  background: var(--st-crit-bg);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 8px;
  color: #fecaca;
  font-size: 0.88rem;
}

@media (max-width: 960px) {
  .noc-status-strip {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "overall counters"
      "countdown countdown"
      "legend legend";
  }

  .counter-grid {
    justify-self: end;
  }

  .noc-topbar {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .noc-pbip-bar {
    width: 100%;
    max-width: 20rem;
    justify-self: center;
  }

  .noc-topbar-right {
    justify-self: stretch;
    justify-content: space-between;
  }

  .noc-main {
    grid-template-columns: 1fr;
  }

  .noc-console-area {
    border-right: none;
  }

  .noc-detail {
    position: fixed;
    inset: auto 0 0 0;
    max-height: 55vh;
    z-index: 20;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45);
  }

  .sim-meta {
    margin-left: 0;
    width: 100%;
  }
}
