/* ==========================================
   Reaction Time Test Styles
   ========================================== */

.reaction-test-container {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--spacing-xl) var(--spacing-md);
}

/* Test Area */
.test-area {
  width: 100%;
  min-height: 400px;
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.1s ease;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  overflow: hidden;
}

.test-area.waiting {
  background-color: #ef4444;
  color: white;
}

.test-area.ready {
  background-color: #10b981;
  color: white;
}

.test-area.idle {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  border: 2px solid var(--border);
}

.test-area.too-early {
  background-color: #f59e0b;
  color: white;
}

.test-area.result {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  border: 2px solid var(--border);
}

.test-area h2 {
  font-size: 2rem;
  margin-bottom: var(--spacing-md);
  color: inherit;
}

.test-area p {
  font-size: 1.125rem;
  opacity: 0.9;
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

.test-area .icon {
  font-size: 4rem;
  margin-bottom: var(--spacing-lg);
}

/* Result Display */
.result-time {
  font-size: 4rem;
  font-weight: bold;
  margin: var(--spacing-lg) 0;
  color: var(--primary);
}

.result-rating {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: var(--spacing-md);
}

.result-rating.excellent { color: #10b981; }
.result-rating.good { color: #3b82f6; }
.result-rating.average { color: #f59e0b; }
.result-rating.slow { color: #ef4444; }

/* Statistics Panel */
.stats-panel {
  margin-top: var(--spacing-xl);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-md);
}

@media (min-width: 768px) {
  .stats-panel {
    grid-template-columns: repeat(3, 1fr);
  }
}

.stat-card {
  background-color: var(--bg-primary);
  padding: var(--spacing-lg);
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: var(--shadow-md);
}

.stat-card .label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-sm);
}

.stat-card .value {
  font-size: 2rem;
  font-weight: bold;
  color: var(--primary);
}

.stat-card .unit {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-left: 4px;
}

/* History Table */
.history-section {
  margin-top: var(--spacing-xl);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--bg-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.history-table thead {
  background-color: var(--bg-secondary);
}

.history-table th,
.history-table td {
  padding: var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.history-table th {
  font-weight: 600;
  color: var(--text-primary);
}

.history-table tbody tr:hover {
  background-color: var(--bg-secondary);
}

.history-table .attempt-number {
  font-weight: 600;
  color: var(--primary);
}

/* Rating Scale */
.rating-scale {
  margin-top: var(--spacing-xl);
  padding: var(--spacing-lg);
  background-color: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.rating-scale h3 {
  margin-bottom: var(--spacing-md);
}

.rating-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid var(--border-light);
}

.rating-item:last-child {
  border-bottom: none;
}

.rating-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.875rem;
  min-width: 100px;
  text-align: center;
}

.rating-badge.excellent {
  background-color: #d1fae5;
  color: #065f46;
}

.rating-badge.good {
  background-color: #dbeafe;
  color: #1e40af;
}

.rating-badge.average {
  background-color: #fef3c7;
  color: #92400e;
}

.rating-badge.slow {
  background-color: #fee2e2;
  color: #991b1b;
}

/* Tips Section */
.tips-section {
  margin-top: var(--spacing-xl);
  padding: var(--spacing-lg);
  background-color: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.tips-section h3 {
  margin-bottom: var(--spacing-md);
}

.tips-section ul {
  list-style: none;
  padding: 0;
}

.tips-section li {
  padding: var(--spacing-sm) 0;
  padding-left: var(--spacing-lg);
  position: relative;
}

.tips-section li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: bold;
}

/* Mobile Optimizations */
@media (max-width: 767px) {
  .result-time {
    font-size: 3rem;
  }
  
  .test-area h2 {
    font-size: 1.5rem;
  }
  
  .test-area p {
    font-size: 1rem;
  }
  
  .history-table {
    font-size: 0.875rem;
  }
  
  .history-table th,
  .history-table td {
    padding: var(--spacing-sm);
  }
}

/* Animations */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.test-area.ready {
  animation: pulse 0.5s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-time {
  animation: fadeIn 0.3s ease;
}
