/* ============================================================
   Vigilant Game — estilos compartilhados
   Reaproveita a linguagem visual do dashboard (cards, chips,
   kill chain, radar, gauge de SCA).
   ============================================================ */

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

/* min-height (nao height): o body precisa poder crescer alem da viewport para
   o scroll normal do documento funcionar quando o painel fica alto. */
body {
  min-height: 100%;
  margin: 0;
  padding: 0;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: var(--font);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button {
  font-family: inherit;
}

a {
  color: hsl(var(--secondary));
}

/* ---------- Primitivos ---------- */

.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  font-size: 0.95rem;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    transform 0.1s;
}

.btn:hover {
  background: hsl(var(--hover));
  border-color: hsl(var(--secondary) / 0.5);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

.btn:disabled:hover {
  background: hsl(var(--card));
  border-color: hsl(var(--border));
}

.btn-primary:disabled:hover {
  background: hsl(var(--secondary));
  border-color: hsl(var(--secondary));
}

.btn-primary {
  background: hsl(var(--secondary));
  border-color: hsl(var(--secondary));
  color: #04121f;
  font-weight: 600;
}

.btn-primary:hover {
  background: hsl(var(--secondary) / 0.85);
  border-color: hsl(var(--secondary) / 0.85);
}

.btn-danger {
  background: hsl(var(--destructive));
  border-color: hsl(var(--destructive));
  color: #fff;
}

.muted {
  color: hsl(var(--muted-foreground));
}

.mono {
  font-variant-numeric: tabular-nums;
}

/* ---------- Kill chain (HUD topo) ---------- */

.killchain {
  display: flex;
  width: 100%;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 0.65rem 1.25rem;
}

.kc-stage {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0 0.75rem;
  border-left: 1px solid hsl(var(--border));
  position: relative;
  transition: background 0.3s;
}

.kc-stage:first-child {
  border-left: 0;
  padding-left: 0;
}

.kc-stage__name {
  font-size: 0.72rem;
  white-space: nowrap;
  color: hsl(var(--foreground));
  opacity: 0.65;
  transition: opacity 0.3s;
}

.kc-stage.is-active .kc-stage__name {
  opacity: 1;
  font-weight: 600;
}

.kc-stage.is-active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.65rem;
  height: 2px;
  background: hsl(var(--secondary));
  box-shadow: 0 0 12px hsl(var(--secondary));
}

.kc-stage.is-breached .kc-stage__name {
  color: hsl(var(--destructive));
  opacity: 1;
}

.kc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 1.4rem;
}

/* Chip identico ao mitreattack-chip.tsx */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.chip--shield {
  background: hsl(var(--secondary));
}
.chip--low {
  background: hsl(var(--success));
}
.chip--medium {
  background: hsl(var(--alert));
}
.chip--critical {
  background: hsl(var(--destructive));
}

.chip svg {
  width: 0.7rem;
  height: 0.7rem;
  fill: #fff;
}

@keyframes vg-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.vg-pulse {
  animation: vg-pulse 0.7s ease-in-out 4;
}

/* ---------- Radar ---------- */

.radar-wrap {
  position: relative;
  width: 100%;
  max-width: min(100%, 68vh);
  aspect-ratio: 1 / 1;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.radar-wrap svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.radar-dot {
  cursor: pointer;
  transition: opacity 0.3s;
}

.radar-dot__label {
  font-family: var(--font);
  fill: #fff;
  text-anchor: middle;
  pointer-events: none;
  font-size: 20px;
}

/* ---------- Cards de vetor (Network / Applications / OS / Files) ---------- */

.vectors {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem 0;
}

.vector {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  text-align: center;
  transition: transform 0.2s;
}

.vector__icon {
  width: 2.2rem;
  height: 2.2rem;
  fill: hsl(var(--muted-foreground));
  transition: fill 0.3s;
}

.vector__name {
  font-size: 0.72rem;
  max-width: 6rem;
}

.vector__value {
  font-size: 1.35rem;
}

.vector__safe {
  font-size: 0.68rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.15;
}

.vector.is-alert .vector__icon {
  fill: hsl(var(--destructive));
  animation: vg-pulse 0.7s ease-in-out 4;
}

.vector.is-alert .vector__value {
  color: hsl(var(--destructive));
}

.vector.is-locked {
  opacity: 0.25;
  filter: grayscale(1);
}

/* ---------- Cards de metrica ---------- */

.metric {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
}

.metric__bar {
  width: 0.4rem;
  align-self: stretch;
  border-radius: 999px;
  flex-shrink: 0;
}

.metric__bar--secondary {
  background: hsl(var(--secondary));
}
.metric__bar--destructive {
  background: hsl(var(--destructive));
}

.metric__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  width: 100%;
}

.metric__name {
  font-size: 0.72rem;
  text-align: center;
  color: hsl(var(--muted-foreground));
}

.metric__value {
  font-size: 1.75rem;
  line-height: 1;
}

.metric__value.is-rising {
  color: hsl(var(--destructive));
}

/* ---------- Shield card ---------- */

.shield {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  gap: 0.6rem;
  flex: 1;
}

.shield__top,
.shield__mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.shield__mid {
  flex-direction: row;
  justify-content: space-evenly;
  align-items: center;
}

.shield__status {
  font-size: 1.15rem;
  letter-spacing: 0.05em;
}

.shield__status.is-active {
  color: hsl(var(--success));
}
.shield__status.is-down {
  color: hsl(var(--destructive));
}

.shield__icon {
  width: 1.6rem;
  height: 1.6rem;
  fill: hsl(var(--foreground));
}

.shield hr {
  width: 100%;
  border: 0;
  border-top: 1px solid hsl(var(--border));
  margin: 0;
}

.shield__incidents {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  gap: 0.5rem;
  background: hsl(var(--destructive));
  border-radius: var(--radius);
  padding: 0.5rem 0.9rem;
  color: #fff;
}

.shield__incidents .metric__name {
  color: #fff;
}

/* ---------- Gauge SCA ---------- */

.gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
}

.gauge svg {
  width: 100%;
  max-width: 200px;
}

.gauge__label {
  font-size: 0.72rem;
  color: hsl(var(--muted-foreground));
  text-align: center;
}

/* ---------- Overlays / dialogos ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: hsl(213 67% 4% / 0.82);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 50;
  animation: vg-fade 0.25s ease-out;
}

@keyframes vg-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.overlay[hidden] {
  display: none;
}

.panel {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

/* ---------- Painel de decisao ---------- */

.decision {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.1rem 1.25rem 1.25rem;
}

.decision__timer {
  position: absolute;
  top: 0;
  left: 0;
  height: 3px;
  background: hsl(var(--secondary));
  border-radius: 999px 0 0 0;
  transition: width 0.1s linear;
}

.decision__timer.is-urgent {
  background: hsl(var(--destructive));
  box-shadow: 0 0 10px hsl(var(--destructive));
}

.decision__tag {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: hsl(var(--secondary));
}

.decision__event {
  font-size: 1rem;
  line-height: 1.45;
}

.decision__question {
  font-size: 0.8rem;
  color: hsl(var(--muted-foreground));
}

.options {
  display: grid;
  gap: 0.6rem;
}

.option {
  text-align: left;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background) / 0.5);
  color: hsl(var(--foreground));
  font-size: 0.88rem;
  line-height: 1.4;
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s;
}

.option:hover:not(:disabled) {
  border-color: hsl(var(--secondary));
  background: hsl(var(--hover));
}

.option:disabled {
  cursor: default;
  opacity: 0.5;
}

.option.is-correct {
  border-color: hsl(var(--success));
  background: hsl(var(--success) / 0.15);
  opacity: 1;
}

.option.is-wrong {
  border-color: hsl(var(--destructive));
  background: hsl(var(--destructive) / 0.15);
  opacity: 1;
}

.option.is-selected {
  border-color: hsl(var(--secondary));
  background: hsl(var(--secondary) / 0.12);
}

.option__meta {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.72rem;
  color: hsl(var(--muted-foreground));
}

/* ---------- Feedback / toasts ---------- */

.feedback {
  display: block;
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  border-left: 3px solid hsl(var(--secondary));
  background: hsl(var(--secondary) / 0.1);
  font-size: 0.82rem;
  line-height: 1.45;
}

.feedback--bad {
  border-left-color: hsl(var(--destructive));
  background: hsl(var(--destructive) / 0.12);
}

.feedback--good {
  border-left-color: hsl(var(--success));
  background: hsl(var(--success) / 0.12);
}

/* Barra de acao do painel: gruda no rodape da area rolavel, para o botao
   de continuar estar sempre ao alcance mesmo com a lista longa de opcoes. */
.decision__actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.8rem;
  /* O padding inferior cobre o padding do card (e a margem negativa evita que
     ele vire scroll extra), para o botao nao encostar na borda. */
  padding: 0.7rem 0 1.25rem;
  margin-bottom: -1.25rem;
  background: hsl(var(--card));
  box-shadow: 0 -10px 14px -10px hsl(var(--card));
}

/* Contador de seleção nas cenas de múltipla escolha. */
.decision__counter {
  margin-right: auto;
  align-self: center;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.feedback__brand {
  color: hsl(var(--secondary));
  font-weight: 600;
}

/* ---------- Log lateral ---------- */

.log {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.7rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.75rem;
}

.log__line {
  display: flex;
  gap: 0.5rem;
  color: hsl(var(--muted-foreground));
  animation: vg-slide-in 0.3s ease-out;
}

.log__line b {
  color: hsl(var(--foreground));
  font-weight: 500;
}

.log__line--critical b {
  color: hsl(var(--destructive));
}
.log__line--good b {
  color: hsl(var(--success));
}

@keyframes vg-slide-in {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Tremor da tela (Impact) ---------- */

@keyframes vg-shake {
  0%,
  100% {
    transform: translate(0, 0);
  }
  20% {
    transform: translate(-6px, 3px);
  }
  40% {
    transform: translate(5px, -4px);
  }
  60% {
    transform: translate(-4px, -3px);
  }
  80% {
    transform: translate(4px, 4px);
  }
}

.is-shaking {
  animation: vg-shake 0.45s linear 3;
}

/* ---------- Tabela do relatorio final ---------- */

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 1.25rem 0;
}

.report-table th,
.report-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid hsl(var(--border));
  text-align: left;
}

.report-table thead th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: hsl(var(--muted-foreground));
}

.report-table td:nth-child(2) {
  color: hsl(var(--destructive));
}

.report-table td:nth-child(3) {
  color: hsl(var(--success));
  font-weight: 600;
}

.grade {
  font-size: 4rem;
  line-height: 1;
  font-weight: 700;
  color: hsl(var(--secondary));
}

/* ---------- Barra de deteccao (modo pentest) ---------- */

.detection {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.9rem 1.1rem;
}

.detection__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.72rem;
  color: hsl(var(--muted-foreground));
}

.detection__value {
  font-size: 1.35rem;
  color: hsl(var(--foreground));
}

.detection__track {
  height: 0.5rem;
  border-radius: 999px;
  background: hsl(var(--progress));
  overflow: hidden;
}

.detection__fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    hsl(var(--success)),
    hsl(var(--alert)) 55%,
    hsl(var(--destructive))
  );
  transition: width 0.5s ease-out;
}

.detection.is-hot .detection__value {
  color: hsl(var(--destructive));
  animation: vg-pulse 0.7s ease-in-out infinite;
}

/* ---------- Utilitarios ---------- */

.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.row {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.hidden {
  display: none !important;
}

.brand-logo {
  height: 1.6rem;
  width: auto;
}

.title-lg {
  font-size: 1.6rem;
  font-weight: 600;
  margin: 0;
}

.title-md {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.lead {
  font-size: 0.95rem;
  line-height: 1.6;
  color: hsl(var(--muted-foreground));
  margin: 0;
}
