/* Matrix Mode Styles */

/* Matrix Grid */
.matrix-grid {
  padding: var(--space-2);
  overflow: auto;
}

/* Matrix Table */
.matrix-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: var(--space-2);
}

.matrix-table th {
  background: var(--accent-primary);
  color: white;
  padding: var(--space-2);
  font-size: var(--text-base);
  font-weight: 700;
  text-align: center;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.matrix-table td {
  background: var(--bg-white);
  padding: var(--space-3);
  text-align: center;
  border-radius: 8px;
  border: 3px solid var(--accent-primary);
  transition: all 0.2s;
  cursor: pointer;
  min-height: 100px;
  vertical-align: middle;
}

.matrix-table td:hover:not(.used) {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
  background: #f0f9fc;
}

.matrix-table td.used {
  opacity: 0.3;
  background: #e0e0e0;
  border-color: #ccc;
  cursor: not-allowed;
}

.matrix-table td.used:hover {
  transform: none;
  box-shadow: none;
}

.matrix-cell-points {
  font-size: var(--text-4xl);
  font-weight: 900;
  color: var(--accent-secondary);
  line-height: 1;
}

.matrix-cell-label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: var(--space-1);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Matrix Card */
.matrix-card {
  background: var(--bg-white);
  border: 2px solid var(--ngw-turquoise);
  border-radius: 2px;
  padding: var(--space-3);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  position: relative;
  overflow: hidden;
}

.matrix-card:hover:not(.used) {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  background: #f0f9fc;
}

.matrix-card:active:not(.used) {
  transform: translateY(-2px);
}

/* Card Header (Category Name) */
.matrix-card .card-header {
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: var(--space-1);
  width: 100%;
}

/* Card Points */
.matrix-card .card-points {
  font-family: var(--font-mono);
  font-size: var(--text-4xl);
  font-weight: 700;
  color: var(--ngw-turquoise);
  line-height: 1;
  margin: var(--space-2) 0;
}

/* Card Label */
.matrix-card .card-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

/* Used Card State */
.matrix-card.used {
  cursor: not-allowed;
  position: relative;
}

.matrix-card.used::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(211, 47, 47, 0.7);
  z-index: 1;
  pointer-events: none;
}

.matrix-card.used::after {
  content: 'USED';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-15deg);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--bg-white);
  letter-spacing: 2px;
  z-index: 2;
  pointer-events: none;
}

.matrix-card.used .card-header,
.matrix-card.used .card-points,
.matrix-card.used .card-label {
  opacity: 0.5;
}

/* Responsive Grid */
@media (max-width: 767px) {
  .matrix-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-1);
  }
  
  .matrix-card {
    min-height: 120px;
    padding: var(--space-2);
  }
  
  .matrix-card .card-points {
    font-size: var(--text-3xl);
  }
  
  .matrix-card.used::after {
    font-size: var(--text-xl);
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .matrix-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

@media (min-width: 1024px) {
  .matrix-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
  
  .matrix-card {
    min-height: 180px;
  }
}

/* Matrix Card Animations */
@keyframes cardFlip {
  0% {
    transform: rotateY(0deg);
  }
  50% {
    transform: rotateY(90deg);
  }
  100% {
    transform: rotateY(0deg);
  }
}

.matrix-card.flipping {
  animation: cardFlip 0.6s ease;
}
