/* General Setup and Variables */
:root {
  --primary-color: #4a90e2; /* A softer, modern blue */
  --primary-hover-color: #357abd;
  --background-color: #f7f8fc;
  --section-bg-color: #ffffff;
  --text-color: #4a5568; /* Darker gray for text */
  --border-color: #dee2e6;
  --header-font: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --body-font: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;

  --class-na-bg: #FFFFF3;
  --class-c0-bg: #D0EDFF;
  --class-c1-bg: #9FDBFF;

  --success-color-rgb: 112, 159, 37;
  --danger-color-rgb: 197, 50, 39;

  --border-radius: 8px; /* Slightly smaller radius */
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05),
    0 2px 4px -1px rgba(0, 0, 0, 0.04);
}

body {
  font-family: var(--body-font);
  background-color: var(--background-color);
  color: var(--text-color);
  margin: 0;
  padding: 2rem;
}

h1,
h2,
h3 {
  font-family: var(--header-font);
  color: #2d3748; /* Darker heading color */
  margin-top: 0;
}

h1 {
  text-align: center;
  margin-bottom: 2.5rem;
  font-size: 2.8rem;
  font-weight: 800;
  background:#4a90e2;
  background-size: 300% 300%;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  animation: gradient-animation 10s ease infinite;
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 8px;
  margin-bottom: 20px;
}

h3 {
  margin: 2rem 0 1rem;
  font-size: 1.2rem;
  font-weight: 600;
}

/* Layout & Sections */
.container {
  max-width: 1600px;
  margin: 0 auto;
}

.section {
  border: 1px solid var(--border-color);
  padding: 25px;
  border-radius: var(--border-radius);
  margin-bottom: 25px;
  background: var(--section-bg-color);
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s ease;
}

.section:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

/* Controls (Buttons, Selects) */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: center;
  margin-bottom: 20px;
}

.controls label {
  font-weight: 600;
}

.controls select {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background-color: #fff;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.controls select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.3s, transform 0.2s;
}

.btn-primary:hover {
  background-color: var(--primary-hover-color);
  transform: translateY(-2px);
}

/* Tables */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 25px 0;
  box-shadow: var(--shadow);
  border-radius: var(--border-radius);
  overflow: hidden;
  background-color: #fff;
}

th,
td {
  padding: 12px 15px;
  text-align: center;
  vertical-align: middle;
  border: none;
  border-bottom: 1px solid var(--border-color);
}

th {
  background-color: #f8f9fa;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #343a40;
}

/* Table class colors */
th.na,
td.na {
  background-color: var(--class-na-bg);
}
th.c0,
td.c0 {
  background-color: var(--class-c0-bg);
}
th.c1,
td.c1 {
  background-color: var(--class-c1-bg);
}

/* Legend for heatmaps */
.legend {
  margin-top: 15px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.legend > div {
  display: flex;
  align-items: center;
}
.legend .gradient-bar {
  width: 150px;
  height: 20px;
  border: 1px solid var(--border-color);
  margin-right: 8px;
}
.legend .gradient-success {
  background: linear-gradient(
    to right,
    rgba(var(--success-color-rgb), 0.1),
    rgba(var(--success-color-rgb), 1)
  );
}
.legend .gradient-danger {
  background: linear-gradient(
    to right,
    rgba(var(--danger-color-rgb), 0.1),
    rgba(var(--danger-color-rgb), 1)
  );
}

@keyframes gradient-animation {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  to {
    background-position: 0% 50%;
  }
}

/* Specific Sections & Plots */
#comparisonSection,
#score1Results {
  margin-top: 20px;
}

#comparisonResult {
  margin-top: 10px;
}

#mainPlot,
#score_1_Plot {
  width: 100%;
  height: 700px;
}

#matrixTable {
  overflow-x: auto;
}

#detailTable {
  margin-top: 20px;
}

/* Comparison table styles */
.diff-added {
  background-color: #e6ffed;
}
.diff-removed {
  background-color: #ffeef0;
}
.diff-changed {
  background-color: #fff3cd;
}
.metric-name {
  font-weight: 600;
}

/* Collapsible Sections */
.collapsible-container {
  margin-top: 30px;
}

.collapsible {
  margin-bottom: 15px;
  border-radius: var(--border-radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background-color: var(--section-bg-color);
}

.collapsible-header {
  background-color: var(--section-bg-color);
  color: #2d3748;
  cursor: pointer;
  padding: 18px 25px;
  width: 100%;
  border: none;
  text-align: left;
  outline: none;
  font-size: 1.2rem;
  font-family: var(--header-font);
  font-weight: 600;
  transition: background-color 0.3s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.collapsible:first-child .collapsible-header {
  border-top-left-radius: var(--border-radius);
  border-top-right-radius: var(--border-radius);
}
.collapsible:last-child {
  margin-bottom: 0;
}
.collapsible:last-child .collapsible-header.active {
  border-bottom: 1px solid var(--border-color);
}
.collapsible:last-child .collapsible-content {
  border-bottom-left-radius: var(--border-radius);
  border-bottom-right-radius: var(--border-radius);
}

.collapsible-header:hover {
  background-color: #f8f9fa;
}

.collapsible-header.active {
  background-color: var(--primary-color);
  color: white;
  border-bottom-color: transparent;
}

.collapsible-header::after {
  content: '+';
  font-weight: bold;
  font-size: 1.5rem;
  color: var(--primary-color);
  transition: color 0.3s ease;
}

.collapsible-header:hover::after,
.collapsible-header.active::after {
  color: inherit;
}

.collapsible-header.active::after {
  content: '−';
}

.collapsible-content {
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out, padding 0.3s ease-out;
  background-color: var(--section-bg-color);
  border-top: 1px solid transparent;
}

.collapsible-header.active + .collapsible-content {
  border-top-color: var(--border-color);
}

.collapsible-body {
  padding: 20px;
}

/* Smaller padding for confusion matrix */
.matrix-table {
  border-collapse: collapse;
  margin: 25px 0;
  box-shadow: var(--shadow);
  border-radius: var(--border-radius);
  overflow: hidden; /* For sticky header and border-radius */
}
.matrix-table th,
.matrix-table td {
  padding: 3px 6px; /* Compact padding */
  font-size: 0.8rem; /* Compact font */
  border: 1px solid #e2e8f0; /* Lighter borders */
  white-space: nowrap;
  text-align: center;
  vertical-align: middle;
  font-weight: bold;
}
.matrix-table thead th {
  background-color: #f8f9fa;
  font-weight: 600;
  color: #343a40;
  position: sticky;
  top: 0;
  z-index: 2;
}
.matrix-table .practice-header {
  width: 70px;
  font-weight: bold;
  position: sticky;
  left: 0;
  background-color: #f8f9fa; /* Match header bg */
  z-index: 3; /* Above other headers */
  border-right: 3px solid #a0aec0;
  border-bottom: 3px solid #a0aec0;
}
.matrix-table .class-group-header {
  border-bottom: 3px solid #a0aec0;
  font-size: 0.9rem;
  text-transform: uppercase;
  background-color: #e9ecef;
  font-weight: 700;
}
.matrix-table .group-separator {
  border-right: 3px solid #a0aec0;
}
.matrix-table .sub-header-separator {
  border-right: 1px solid #d1d9e6;
}
.matrix-table .row-separator-top {
  border-top: 2px solid #a0aec0;
}
.matrix-table .real-value {
  font-weight: bold;
  vertical-align: middle;
}
.matrix-table tbody tr:hover {
  background-color: #f5f5f5;
}
.matrix-table tbody tr:hover .practice-header {
  background-color: #e9ecef;
}
.practice-table th,
.practice-table td {
  padding: 8px;
  font-size: 0.9rem;
}