/* Clean, Minimalist & Ultra-Crisp Matrix Styling */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600&display=swap');

:root {
  --primary: #2563eb;
  --bg-main: #f8fafc;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-main);
  color: #0f172a;
}

code, .font-mono {
  font-family: 'JetBrains Mono', monospace;
}

/* Minimal Scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}

/* Card */
.card-clean {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
}

/* Matrix Table & Strict Grid Equal Sizing */
.matrix-container {
  min-width: 860px;
}

.matrix-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) 12px repeat(2, minmax(0, 1fr)) 12px repeat(2, minmax(0, 1fr)) 12px repeat(2, minmax(0, 1fr));
  gap: 6px;
  align-items: stretch;
}

.matrix-header-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) 12px repeat(2, minmax(0, 1fr)) 12px repeat(2, minmax(0, 1fr)) 12px repeat(2, minmax(0, 1fr));
  gap: 6px;
  align-items: center;
}

.matrix-cell {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  min-width: 0; /* Prevents cell from expanding */
  height: 44px; /* Strict uniform height for all 32 cells */
  box-sizing: border-box;
}

.matrix-cell:hover {
  background: #f8fafc;
  border-color: #93c5fd;
  transform: translateY(-1px);
  box-shadow: 0 3px 6px -1px rgba(0, 0, 0, 0.05);
}

.matrix-cell.swap-selected {
  outline: 2px solid #f59e0b;
  border-color: #f59e0b;
  background: #fffbeb !important;
  animation: pulse-swap 1.2s infinite;
}

.matrix-cell.highlight-target {
  outline: 2px solid #10b981;
  border-color: #10b981;
  background: #f0fdf4 !important;
}

@keyframes pulse-swap {
  0%, 100% { transform: scale(1.02); }
  50% { transform: scale(1.04); }
}

.matrix-aisle {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.matrix-aisle-line {
  width: 2px;
  height: 60%;
  background: #e2e8f0;
  border-radius: 9999px;
}

/* Active tab */
.tab-btn.active {
  background: #2563eb;
  color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.2);
}

/* Podium */
.podium-1 {
  background: linear-gradient(180deg, #fef3c7 0%, #ffffff 100%);
  border: 1.5px solid #fcd34d;
}
.podium-2 {
  background: linear-gradient(180deg, #f1f5f9 0%, #ffffff 100%);
  border: 1.5px solid #cbd5e1;
}
.podium-3 {
  background: linear-gradient(180deg, #ffedd5 0%, #ffffff 100%);
  border: 1.5px solid #fed7aa;
}

/* Toast */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.animate-fade-in {
  animation: fadeIn 0.15s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}
