:root {
  /* Provided Color Palette */
  --c-dark: #101419;
  --c-yellow: #f9dc5c;
  --c-brown: #a88f85;
  --c-gray: #d0cccc;
  --c-white: #ffffff;
  --c-blue: #4381c1;
  --c-green: #59a96a;
  --c-red: #d44b4b;

  /* Theme and Base Variables */
  --bg-color: #f8f9fa;
  --card-bg: var(--c-white);
  --text-main: var(--c-dark);
  --text-muted: #666666;
  --border-color: #e6e9ed;
  --font-family: 'Inter', sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1 {
  text-align: center;
}


/* ========================================================================== */
/* AD BANNER */
/* ========================================================================== */
#ad-banner {
  /* background-color: rgb(243, 227, 209); */
  position: relative;
  width: 100%;
  height: 20px;
  text-align: center;
  padding: 10px;
}

/* ========================================================================== */
/* START BUTTON */
/* ========================================================================== */
#start-button-container {
  text-align: center;
}
#start-button {
  padding: 10px 20px;
  font-size: 2rem;
  width: 250px;
  width: clamp(250px, 50%, 500px);
}

/* ========================================================================== */
/* LOADING BAR */
/* ========================================================================== */
/* Loading Section */
.loading-container {
  text-align: center;
  padding: 80px 0;
  max-width: 500px;
  margin: 0 auto;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 5px solid var(--c-gray);
  border-top-color: var(--c-blue);
  border-radius: 50%;
  margin: 0 auto 30px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-container h2 {
  font-size: 1.6rem;
  margin-bottom: 10px;
}

#loading-text {
  color: var(--text-muted);
  margin-bottom: 25px;
}

.progress-bar-container {
  width: 100%;
  height: 10px;
  background: var(--border-color);
  border-radius: 5px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--c-blue);
  width: 0%;
  transition: width 0.3s ease;
}

/* ========================================================================== */
/* MODE CONTROLS */
/* ========================================================================== */

.controls-bar {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin: 30px auto;
  max-width: 400px;
}

.mode-btn, #start-button {
  flex: 1;
  padding: 12px 20px;
  border: 2px solid var(--c-blue);
  background: transparent;
  color: var(--c-blue);
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.mode-btn:hover {
  background: rgba(67, 129, 193, 0.1);
  transform: translateY(-2px);
}

.mode-btn.active {
  background: var(--c-blue);
  color: var(--c-white);
  box-shadow: 0 4px 10px rgba(67, 129, 193, 0.3);
}

/* ========================================================================== */
/* DASHBOARD MODE (MODE 1) */
/* ========================================================================== */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 25px;
  padding: 0 20px 40px;
  max-width: 1400px;
  margin: 0 auto;
}

.dashboard-card {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(16, 20, 25, 0.05);
  border: 2px solid var(--border-color);
  overflow: hidden;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.dashboard-card:hover {
  box-shadow: 0 8px 25px rgba(16, 20, 25, 0.1);
  /* transform: translateY(-4px); */
  border-color: rgba(67, 130, 193, 0.80);
  border-width: 2px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  background: rgba(208, 204, 204, 0.2); /* Very faint gray */
  border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
  font-size: 1.25rem;
  color: var(--c-dark);
  margin: 0;
  font-weight: 700;
}

.expand-card-btn {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.dashboard-card:hover .expand-card-btn {
  opacity: 1;
  visibility: visible;
}

.expand-card-btn:hover {
  background: var(--c-blue);
  color: var(--c-white);
  border-color: var(--c-blue);
}

.card-body {
  padding: 10px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-row-separator {
  border-top: 2px solid #eeeeee;
  height: 0; /* Important for a flat line */
  margin: 10px 10px 10px 28px; /* Add spacing on each side */
}

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.card-row:hover {
  background: rgba(208, 204, 204, 0.1); /* light hover */
}

/* If marked as Bad */
.row-bad {
  background-color: rgba(212, 75, 75, 0.15); /* Pastel red background */
}
.row-bad:hover {
  background-color: rgba(212, 75, 75, 0.25);
}

.row-label-container {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 50%;
  min-width: 0;
  font-weight: 500;
  color: var(--c-dark);
  font-size: 0.95rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.good {
  background-color: var(--c-green);
  box-shadow: 0 0 5px rgba(89, 169, 106, 0.6);
}

.status-dot.bad {
  background-color: var(--c-red);
  box-shadow: 0 0 5px rgba(212, 75, 75, 0.6);
}

.status-dot.placeholder {
  visibility: hidden;
}

.row-label-container .label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-row .value {
  flex: 1 1 50%;
  text-align: right;
  font-weight: 400;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-all;
  font-family: monospace; /* Easier to read specific strings */
  font-size: 0.85rem;
  background: rgba(208, 204, 204, 0.1);
  padding: 4px 8px;
  border-radius: 4px;
}

.empty-state {
  padding: 20px;
  text-align: center;
  color: var(--c-gray);
  font-style: italic;
}

/* ========================================================================== */
/* MODAL */
/* ========================================================================== */

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(16, 20, 25, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-content {
  background-color: var(--card-bg);
  margin: 40px auto;
  padding: 30px;
  border: 1px solid var(--border-color);
  width: 90%;
  max-width: 800px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  position: relative;
  transform: translateY(20px);
  animation: slideUp 0.3s forwards ease-out;
}

@keyframes slideUp {
  to { transform: translateY(0); }
}

.close-modal {
  color: var(--c-gray);
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.close-modal:hover,
.close-modal:focus {
  color: var(--c-red);
  text-decoration: none;
}

#modal-title {
  font-size: 1.6rem;
  margin-bottom: 20px;
  color: var(--c-dark);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.modal-list .card-row {
  padding: 10px;
  border-bottom: 1px dashed var(--border-color);
  border-radius: 0;
}
.modal-list .card-row:last-child {
  border-bottom: none;
}
.modal-list .value {
  font-size: 0.9rem;
}

/* ========================================================================== */
/* JSON VIEWER MODE (MODE 2) */
/* ========================================================================== */

.json-mode-wrapper {
  position: relative;
  max-width: 1400px;
  margin: 0 auto 40px;
  padding: 0 20px;
}

.json-viewer-container {
  background-color: var(--c-dark);
  color: var(--c-white);
  padding: 30px 40px;
  border-radius: 12px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.95rem;
  line-height: 1.5;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
  overflow-x: auto;
}

.json-toolbar {
  position: absolute;
  top: 15px;
  right: 40px;
  display: flex;
  gap: 10px;
  background-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
  padding: 8px 12px;
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 10;
}

.icon-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--c-dark);
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
  font-family: var(--font-family);
}

.icon-btn:hover {
  background: var(--c-yellow);
  color: var(--c-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* JSON Visuals */
.json-node {
  margin-left: 20px;
  position: relative;
}

.json-content {
  border-left: 1px dashed rgba(255, 255, 255, 0.2);
  margin-left: 10px;
  padding-left: 10px;
}

.json-row {
  margin-top: 4px;
}

.json-toggle {
  cursor: pointer;
  display: inline-block;
  width: 20px;
  text-align: center;
  color: var(--text-muted);
  user-select: none;
  font-size: 0.75rem;
  position: absolute;
  left: -20px;
  top: 2px;
  transition: color 0.2s;
}

.json-toggle:hover {
  color: var(--c-yellow);
}

.json-expand-wrapper {
  position: relative;
}

/* Syntax Highlighting */
.json-key {
  color: var(--c-blue); /* Light blue for properties */
  font-weight: bold;
}

.json-val-string {
  color: var(--c-green); /* Green for strings */
}

.json-val-number {
  color: var(--c-brown); /* Brown/Orange for numbers */
}

.json-val-boolean {
  color: var(--c-red); /* Red for booleans */
  font-weight: bold;
}

.json-val-null {
  color: var(--c-gray);
  font-style: italic;
}
