/* Modern Flat Design - Упрощенные стили */
:root {
  --primary-color: #3498db;
  --text-primary: #2c3e50;
  --text-secondary: #7f8c8d;
  --bg-primary: #ecf0f1;
  --bg-card: #ffffff;
  --success-color: #27ae60;
  --warning-color: #e74c3c;
  --border-color: #bdc3c7;
}

* {
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  margin: 0;
  padding: 16px;
  line-height: 1.5;
  font-size: 14px;
}

h1 {
  font-size: 24px;
  color: var(--text-primary);
  text-align: center;
  margin: 0 0 24px 0;
  font-weight: 600;
}

h3 {
  font-size: 16px;
  color: var(--text-primary);
  margin: 0 0 12px 0;
  font-weight: 600;
}

/* Кнопка тестирования */
#startTestButton {
  width: 100%;
  max-width: 280px;
  padding: 16px;
  font-size: 16px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  margin: 0 auto 24px;
  display: block;
  font-weight: 600;
}

#startTestButton:hover:not(:disabled) {
  background-color: #2980b9;
}

#startTestButton:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

#startTestButton.progress {
  background-color: #95a5a6;
  position: relative;
  color: transparent;
}

#startTestButton.progress::after {
  content: attr(data-progress);
  color: white;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Счетчики статистики */
.stats-counter {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 16px;
  margin: 0 auto 24px;
  max-width: 280px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.total-tests, .cpu-info {
  margin: 8px 0;
  color: var(--text-secondary);
  font-size: 14px;
}

#totalTestsCount, #cpuThreadsCount {
  font-weight: bold;
  color: var(--primary-color);
  font-size: 16px;
}

/* Секция результатов */
.results-section {
  background-color: var(--bg-card);
  border-radius: 8px;
  margin: 0 auto 24px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  overflow: hidden;
  max-width: 700px;
}

.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}

th {
  background-color: #f8f9fa;
  font-weight: 600;
  color: var(--text-primary);
}

tr:hover {
  background-color: #f8f9fa;
}

/* Выравнивание числовых колонок */
th:nth-child(2), th:nth-child(3), th:nth-child(4),
.single-thread, .multi-thread, .scaling-factor {
  text-align: right;
  font-family: monospace;
  font-variant-numeric: tabular-nums;
}

.scaling-factor {
  font-weight: 600;
  color: var(--success-color);
}

/* Секция рейтингов */
.ratings-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 0 auto 24px;
  max-width: 700px;
}

.rating-card {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rating-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.rating-card.overall {
  border: 2px solid var(--primary-color);
  background: #f8f9fa;
}

.rating-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--primary-color);
  margin: 8px 0;
}

/* Итоговая строка таблицы */
.totals-row {
  background-color: #f8f9fa;
  font-weight: 600;
  border-top: 2px solid var(--primary-color);
}

.totals-row td {
  font-size: 15px;
  padding: 16px;
}

/* Сравнение рейтингов */
.rating-comparison {
  margin-top: 8px;
}

.comparison-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.comparison-main {
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.comparison-better {
  background: #d5f4e6;
  color: var(--success-color);
}

.comparison-worse {
  background: #fadbd8;
  color: var(--warning-color);
}

.comparison-average {
  background: #fdebd0;
  color: #f39c12;
}

.comparison-percentile {
  color: var(--text-secondary);
  font-size: 11px;
}

/* Детали рейтингов */
.rating-details {
  margin-top: 12px;
  text-align: left;
  font-size: 12px;
  color: var(--text-secondary);
}

.rating-details ul {
  margin: 0;
  padding-left: 16px;
}

.rating-details li {
  margin: 4px 0;
  line-height: 1.4;
}

/* Адаптивность */
@media (max-width: 768px) {
  body {
    padding: 12px;
  }
  
  .ratings-section {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  table {
    font-size: 13px;
  }
  
  th, td {
    padding: 10px 12px;
  }
  
  .rating-card {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .stats-counter,
  #startTestButton {
    max-width: 100%;
  }
  
  .results-section,
  .ratings-section {
    width: 100%;
  }
}

/* Стили для секции графика */
.chart-section {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 20px;
    margin: 0 auto 24px;
    max-width: 700px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

#distributionChart {
    width: 100%;
    height: 100%;
}


.user-rating-line {
    background-color: var(--primary-color);
    width: 3px;
    height: 100%;
    position: absolute;
    top: 0;
}

.user-rating-label {
    position: absolute;
    background: var(--primary-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    transform: translateX(-50%);
}

/* Адаптивность для графика */
@media (max-width: 768px) {
    .chart-container {
        height: 250px;
    }
    
    .chart-section {
        padding: 16px;
    }
}

/* Стили для вкладок */
.tabs-section {
    width: 100%;
}

.tabs-header {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab-button {
    background: none;
    border: none;
    padding: 6px 10px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.tab-button:hover {
    color: var(--text-primary);
    background-color: #f8f9fa;
}

.tab-button.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Адаптивность для вкладок */
@media (max-width: 768px) {
    .tabs-header {
        flex-wrap: wrap;
    }
    
    .tab-button {
        padding: 10px 16px;
        font-size: 13px;
        flex: 1;
        min-width: 120px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .tab-button {
        padding: 8px 12px;
        font-size: 12px;
        min-width: 100px;
    }
}

/* Стили для информации о рейтинге во вкладках */
.tab-rating-info {
    margin-top: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.rating-display {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.rating-value-large {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
}

.rating-comparison-tab {
    flex: 1;
    min-width: 200px;
}

.rating-details-tab {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.rating-details-tab ul {
    margin: 8px 0;
    padding-left: 20px;
}

.rating-details-tab li {
    margin: 4px 0;
    line-height: 1.4;
}

/* Адаптивность */
@media (max-width: 768px) {
    .rating-display {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .rating-value-large {
        font-size: 28px;
    }
}

/* Скрытие рейтинг-инфо до получения результатов */
.tab-rating-info.hidden {
    display: none;
}