:root {
  --bg: #ffd84d;
  --border: #111;
  --text: #111;

  --shadow-x: 6px;
  --shadow-y: 6px;
}

@font-face {
  font-family: "Alfa Slab One";
  src: url("fonts/Alfa_Slab_One/AlfaSlabOne-Regular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/JetBrains_Mono/JetBrainsMono-VariableFont_wght.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

:root {
  --bg: #f2f2f2;
  --text: #000000;
  --border: #000000;
  --grid: #e5e5e5;

  /* Miro Colors */
  --miro-yellow: #ffd029;
  --miro-blue: #0500ff;
  --miro-green: #34b67b;
  --miro-pink: #ea4c89;
  --miro-orange: #ff7233;

  --card-bg: #ffffff;
  --hover-bg: #f2f2f2;

  --success: #42b883;
  --danger: #ea4c89;
}

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

body {
  font-family:
    "JetBrains Mono",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding: 40px 20px;
  min-height: 100vh;
  position: relative;
}

.grid-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(var(--grid) 1px, transparent 1px);
  background-size: 30px 30px;
  z-index: -1;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 60px;
  gap: 20px;
  flex-wrap: wrap;
}

.header h1 {
  font-family: "JetBrains Mono", cursive;
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -3.5px;
  line-height: 1;
  margin-bottom: 8px;
}

.header p {
  font-size: 18px;
  font-weight: 400;
  color: #666;
}

/* File Upload */
.upload-area {
  margin-bottom: 4px;
}

/* .custom-file-upload { */
  /* display: inline-block; */
  /* padding: 12px 24px; */
  /* cursor: pointer; */
  /* background: var(--miro-blue); */
  /* color: white; */
  /* border: 2px solid var(--border); */
  /* font-weight: 600; */
  /* transition: all 13ms linear; */
/* } */

/* .custom-file-upload:hover { */
  /* border: 3px solid var(--border); */
  /* border-right: 12px solid var(--border); */
  /* border-bottom: 10px solid var(--border); */
/* } */

.custom-file-upload:active {
  transform: translate(0, 0);
}

input[type="file"] {
  display: none;
}

/* Sections */
section {
  margin-bottom: 60px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 20px;
  flex-wrap: wrap;
}

.section-header h2 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

/* Buttons */
#download-json-btn {
  background-color: var(--miro-green);
  color: white;
}

#upload-json-btn {
  background-color: var(--miro-blue);
  color: white;
}

#sortBtn {
  background-color: var(--miro-yellow);
}

#clearComparisonBtn {
  background-color: var(--miro-pink);
  color: black;
}

.miro-shadow {
  /* Estado normal: ligeramente levantado */
  transform: translate(-2px, -2px);

  /* Sombra desplazada diagonalmente */
  box-shadow: var(--shadow-x) var(--shadow-y) 0 var(--border);

  transition:
    transform 60ms ease,
    box-shadow 60ms ease,
    background 60ms ease;
}

.miro-shadow:hover {
  box-shadow: 10px 10px 0 var(--border);
}

.miro-shadow:active {
  box-shadow: 2px 2px 0 var(--border);
}

.miro-button {
  color: black;
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  border: 2px solid var(--border);
}

/* Dropdown */
.miro-dropdown {
  position: relative;
  display: inline-block;
}

.miro-select {
  color: black;
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  border: 2px solid var(--border);
  background-color: var(--miro-blue);
  color: white;

  /* Estado normal: ligeramente levantado */
  transform: translate(-2px, -2px);

  /* Sombra desplazada diagonalmente */
  box-shadow: var(--shadow-x) var(--shadow-y) 0 var(--border);
  
  transition:
    transform 60ms ease,
    box-shadow 60ms ease,
    background 60ms ease;
}

.miro-dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 260px;
  background-color: white;
  border: 2px solid var(--border);
  box-shadow: 8px 8px 0 var(--border);
  z-index: 1000;
  margin-top: 10px;
  transform-origin: top left;
}

.miro-dropdown-content.show {
  display: block;
  animation: dropdownShow 60ms cubic-bezier(0.165, 0.84, 0.44, 1);
}

@keyframes dropdownShow {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.miro-select span {
  display: inline-block;
  margin-left: 8px;
}

.miro-dropdown.show .miro-select span {
  transform: rotate(180deg);
}

.miro-dropdown-item {
  padding: 12px 16px;
  color: black;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  border-bottom: 2px solid var(--border);
  transition: background-color 60ms ease;
}

.miro-dropdown-item:last-child {
  border-bottom: none;
}

.miro-dropdown-item:hover {
  background-color: var(--miro-yellow);
}

.miro-dropdown-item .icon {
  font-size: 18px;
}

.miro-select:hover {
  transform: translate(-6px, -6px);
  box-shadow: 10px 10px 0 var(--border);
}

.miro-select:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--border);
}

/* Hover: se levanta hacia arriba-izquierda */
.miro-button:hover {
  transform: translate(-6px, -6px);
}

/* Click: se hunde */
.miro-button:active {
  transform: translate(2px, 2px);
}

.miro-button:focus-visible {
  outline: 4px solid #4c9ffe;
  outline-offset: 4px;
}

/* Summary Grid */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.summary-card {
  background: var(--card-bg);
  border: 2px solid var(--border);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  cursor: pointer;
}

.summary-card.hidden {
  display: none;
}

.summary-card:hover {
  background-color: var(--hover-bg);
}

#showAllBtn {
  margin: 24px auto 0;
  display: block;
}

.summary-card.selected {
  border-color: var(--miro-blue);
  background-color: #f0f7ff;
  transform: translate(-4px, -4px);
}

.summary-card.selected::after {
  content: "✓";
  position: absolute;
  top: -12px;
  right: -12px;
  background: var(--miro-blue);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border);
  font-weight: 800;
  font-size: 12px;
}

.summary-card .card-title {
  font-size: 24px;
  font-weight: 800;
  background: var(--miro-yellow);
  display: inline-block;
  padding: 4px 12px;
  border: 2px solid var(--border);
  align-self: flex-start;
  margin-bottom: 10px;
}

.metrics {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.metric {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: #666;
  margin-bottom: 4px;
}

.metric-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.metric-value.total-tokens {
  color: var(--miro-blue);
}

/* Details in Card */
.details-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  border-top: 2px solid var(--border);
  padding-top: 16px;
}

.details-group h3 {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 800;
  margin-bottom: 10px;
}

.details-item {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
}

.details-item span {
  color: #666;
}

.details-item strong {
  font-weight: 600;
}

/* Comparison Section */
.comparison-section {
  background: #f8f8f8;
  border: 2px solid var(--border);
  padding: 32px;
  margin-bottom: 60px;
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.comparison-card {
  opacity: 0;
  transform: translateY(35px) scale(0.92);
  background: white;
  border: 2px solid var(--border);
  padding: 20px;
  transition:
    opacity 60ms steps(3),
    transform 60ms steps(3);
}

.comparison-card.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.comparison-card h3 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 15px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 8px;
}

.comparison-metric {
  margin-bottom: 12px;
}

.comparison-diff {
  font-weight: 800;
  font-size: 14px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  display: inline-block;
  margin-left: 8px;
}

.diff-positive {
  background: var(--miro-pink);
  color: white;
}

.diff-negative {
  background: var(--miro-green);
  color: black;
}

.comparison-rank {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  background: var(--miro-yellow);
  padding: 2px 8px;
  border: 1px solid var(--border);
  margin-bottom: 10px;
  display: inline-block;
}

/* Table Section */
.details-section {
  width: 100%;
}

.search-wrapper input {
  padding: 10px 16px;
  border: 2px solid var(--border);
  box-shadow: 3px 3px 0 var(--border);
  font-family: inherit;
  font-size: 14px;
  width: 300px;
  outline: none;
}

.search-wrapper input:focus {
  background-color: var(--hover-bg);
}

.table-container {
  border: 2px solid var(--border);
  background: white;
  overflow: hidden;
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  background: #f0f0f0;
  border-bottom: 2px solid var(--border);
  padding: 12px 16px;
  text-align: left;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 12px;
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--grid);
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background-color: var(--hover-bg);
}

#resultsTable {
  border-right: 3px solid var(--border);
  border-bottom: 3px solid var(--border);
}

#resultsTable tbody tr {
  opacity: 0;
  transform: translateX(-30px) scale(0.96);
  transition:
    opacity 60ms steps(3),
    transform 60ms steps(3);
}

#resultsTable tbody tr.visible {
  opacity: 1;
  transform: translateX(0) scale(1);
}

.correct {
  color: var(--success);
  font-weight: 800;
}

.incorrect {
  color: var(--danger);
  font-weight: 800;
}

/* Responsive */
@media (max-width: 768px) {
  .header h1 {
    font-size: 36px;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .search-wrapper input {
    width: 100%;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }
}
