:root {
  --bg-color: #0f1115;
  --text-color: #f2f2f2;
  --accent-color: #66ffcc;
  --warning-color: #ff6666;
  --font-stack: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-stack);
  margin: 0 auto;
  max-width: 900px;
  padding: 6vh 2em;
  line-height: 1.6;
  animation: fadeIn 1.2s ease-out forwards;
  opacity: 0;
}

.footer {
  margin-top: 3em;
  font-size: 0.9rem;
  text-align: center;
  opacity: 0.8;
 }

footer {
  text-align: center;
  padding: 1em 0;
  font-size: 0.9em;
  color: #666;
}

h1, h2 {
  color: var(--accent-color);
  margin: 1.5em 0 0.5em;
  text-align: center;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1em;
}

th, td {
  padding: 0.6em;
  border-bottom: 1px solid #333;
  text-align: left;
}

tr:hover {
  background-color: #1c1c1c;
}

a {
  color: var(--accent-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

p.summary {
  text-align: center;
  max-width: 40rem;
  margin: 0.5rem auto 1.5rem;
}

td[data-label="Timestamp"] {
  word-break: keep-all;    
  white-space: nowrap;      
}

.api-card {
  background: #111318;
  border-left: 4px solid var(--accent-color);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  margin: 2.5rem 0 2rem;
  font-family: ui-monospace, SFMono-Regular, "Courier New", monospace;
}

.api-card h4 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-color);
}

.api-card .endpoint {
  background: #0a0c0f;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  display: inline-block;
  font-size: 0.9rem;
  margin: 0.4rem 0 0.8rem;
}

.api-card .meta {
  font-size: 0.8rem;
  color: #9ca3af;
  line-height: 1.5;
}

.api-card a {
  color: #60a5fa;
  font-size: 0.8rem;
}


.ip-moderate {
  color: #f59e0b;
  font-weight: 600;
}

.ip-severe {
  color: #ef4444;
  font-weight: 700;
}

.expand-desktop {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 2px 6px;
  font-size: 0.75rem;
  cursor: pointer;
}

.scenario-badge {
  display: inline-block;
  padding: 2px 6px;
  font-size: 0.7rem;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.scenario-badge.moderate {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.scenario-badge.severe {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.scenario-table {
  table-layout: fixed;
  width: 100%;
}

.scenario-table th:nth-child(1),
.scenario-table td:nth-child(1) {
  width: 45%;
  word-break: break-word;
}

.scenario-table th:nth-child(2),
.scenario-table td:nth-child(2) {
  width: 25%;
}

.scenario-table th:nth-child(3),
.scenario-table td:nth-child(3) {
  width: 10%;
  text-align: center;
}

.scenario-table th:nth-child(4),
.scenario-table td:nth-child(4) {
  width: 20%;
  white-space: nowrap;
}

@media (hover: hover) and (pointer: fine) {
  .scenario-badge:hover {
    background-color: #fbbf24;
    transform: scale(1.1);
  }

  .scenario-badge.severe:hover {
    background-color: #f87171;
    transform: scale(1.1);
  }
}

@media (max-width: 768px) {

  table,
  thead,
  tbody {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "time ip"
      "scenarios detected";
    gap: 0.5rem 0.75rem;

    background: #15171d;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
  }

  td {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    font-size: 0.85em;
    padding: 0.35rem 0.45rem;
    width: 100%;
    box-sizing: border-box;
  }

  td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 0.15rem;
  }

  td[data-label="Timestamp"] { grid-area: time; }
  td[data-label="IP Address"] { grid-area: ip; font-family: monospace; }
  td[data-label="Scenarios"] { grid-area: scenarios; }
  td[data-label="Detected On"] { grid-area: detected; }

  td[data-label="Scope"] {
    display: none;
  }

  td[data-label="Scenarios"] {
    border-radius: 6px;
    padding: 0.3rem 0.6rem 0.3rem 0.4rem;

    display: flex;
    flex-direction: column;
    justify-content: center;

    align-items: stretch;
  }

  td[data-label="Scenarios"].moderate {
    background: rgba(245, 158, 11, 0.12);
  }

  td[data-label="Scenarios"].severe {
    background: rgba(239, 68, 68, 0.18);
  }

  .scenario-badge {
    background: none !important;
    padding: 0;
    margin: 0;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 0.6;
  }

  tr.scenario-details {
    display: none;
  }

  .scenario-wrap {
    width: calc(100% - 1rem);
    padding: 0.5rem 0.6rem;
    border-radius: 6px;

    display: flex;
    align-items: center;
    justify-content: flex-start;
  }

  .scenario-wrap.moderate {
    background: rgba(245, 158, 11, 0.14);
  }

  .scenario-wrap.severe {
    background: rgba(239, 68, 68, 0.18);
  }
}

@keyframes fadeIn {
  to { opacity: 1; }
}

.pulse {
  width: 10px;
  height: 10px;
  display: inline-block;
  background-color: #4CAF50;
  border-radius: 50%;
  animation: pulse-animation 1.8s infinite;
  margin-right: 8px;
}

@keyframes pulse-animation {
  0% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.5); opacity: 1; }
  100% { transform: scale(1); opacity: 0.6; }
}

.impact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 2rem 0;
  font-family: ui-monospace, SFMono-Regular, "Courier New", monospace;
}

.impact-card {
  background: #15171d;
  padding: 1rem;
  border-radius: 6px;
  border-left: 4px solid var(--warning-color);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.impact-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 255, 204, 0.15);
}


.api-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(102, 255, 204, 0.18);
}

.impact-card h4 {
  margin: 0 0 0.5rem;
  color: var(--accent-color);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 500;
}

.impact-card .big-number {
  font-size: 1.9rem;
  font-weight: bold;
  color: var(--accent-color);
  margin: 0.25rem 0;
  display: block;
}

.impact-card .meta {
  color: #95a5a6;
  font-size: 0.85rem;
  margin: 0.3rem 0;
}

.impact-card .mono {
  background: #0a0c0f;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8rem;
}

.impact-card a {
  color: #3498db;
  font-size: 0.82rem;
  text-decoration: none;
}

.impact-card a:hover {
  text-decoration: underline;
}

@media (max-width: 500px) {
  body {
    padding: 4vh 1em;
    font-size: 0.95em;
  }

  tr {
    padding: 0.45rem 0.5rem;
  }

  td {
    font-size: 0.82em;
  }

  td[data-label="IP Address"] {
    word-break: break-all;  
    overflow-wrap: anywhere;     
  }

  .impact-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 1.5rem 0;
  }

  .impact-card .big-number {
    font-size: 1.7rem;
  }

  .api-card {
    padding: 1.1rem 1.2rem;
    border-radius: 8px;
    border-left-width: 5px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    margin-top: -0.4rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }

  .api-card .endpoint {
    font-size: 0.85rem;
    padding: 0.55rem 0.75rem;
    margin: 0.6rem 0 0.9rem;
    display: block;
    text-align: center;
  }

  .api-card h4 {
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-align: center;
  }

  .api-card a {
    display: inline-block;
    margin-top: 0.6rem;
    font-size: 0.82rem;
  }

  .api-card:active {
    transform: scale(0.985);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  }

  .api-card::before {
    content: "";
    display: block;
    height: 1px;
    background: linear-gradient(
      to right,
      transparent,
      rgba(102, 255, 204, 0.35),
      transparent
    );
    margin-bottom: 0.8rem;
  }
}
