/* ========================================
   ТОП 5 ИГРАЧИ - СТИЛОВЕ
   Bulls & Cows - Leaderboard Widget
   ======================================== */

/* Контейнер за ТОП 5 */
.top5-container {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  border: 2px solid #b1aedf;
  transition: box-shadow 0.3s ease;
  margin-bottom: 20px;
}

/* Тъмна тема за ТОП 5 контейнер */
.theme-dark .top5-container {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border-color: #334155;
}

.top5-container:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Заглавие */
.top5-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 15px;
  color: #1e293b;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  padding-bottom: 12px;
}

.theme-dark .top5-title {
  color: #f1f5f9;
}

.top5-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, #391212, #f59e0b);
  border-radius: 2px;
}

/* Списък */
.top5-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: top5-counter;
}

/* Елемент от списъка */
.top5-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  margin-bottom: 8px;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.theme-dark .top5-item {
  background: #0f172a;
  border-color: #334155;
}

/* Hover ефект */
.top5-item:hover {
  transform: translateX(5px);
  border-color: #391212;
  box-shadow: 0 4px 12px rgba(57, 18, 18, 0.15);
  background: linear-gradient(135deg, rgba(57, 18, 18, 0.05), rgba(245, 158, 11, 0.05));
}

.theme-dark .top5-item:hover {
  background: linear-gradient(135deg, rgba(57, 18, 18, 0.2), rgba(245, 158, 11, 0.1));
}

/* Анимация при зареждане */
.top5-item {
  animation: slideInLeft 0.5s ease-out forwards;
  opacity: 0;
}

.top5-item:nth-child(1) { animation-delay: 0.1s; }
.top5-item:nth-child(2) { animation-delay: 0.2s; }
.top5-item:nth-child(3) { animation-delay: 0.3s; }
.top5-item:nth-child(4) { animation-delay: 0.4s; }
.top5-item:nth-child(5) { animation-delay: 0.5s; }

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Ранг (номер) */
.top5-rank {
  counter-increment: top5-counter;
  font-size: 14px;
  font-weight: 700;
  min-width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}

.top5-rank::before {
  content: counter(top5-counter);
}

/* Различни цветове за първите 3 места */
.top5-item:nth-child(1) .top5-rank {
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  color: #1e293b;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
  font-size: 15px;
}

.top5-item:nth-child(2) .top5-rank {
  background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
  color: #1e293b;
  box-shadow: 0 2px 8px rgba(192, 192, 192, 0.4);
}

.top5-item:nth-child(3) .top5-rank {
  background: linear-gradient(135deg, #cd7f32, #e8a87c);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(205, 127, 50, 0.4);
}

.top5-item:nth-child(n+4) .top5-rank {
  background: linear-gradient(135deg, #64748b, #94a3b8);
  color: #ffffff;
}

/* Флаг */
.flag-icon {
  width: 20px;
  height: 14px;
  display: inline-block;
  border-radius: 2px;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}


/* Флаг по подразбиране (ако няма флаг) */
.flag-none {
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  position: relative;
}

.flag-none::after {
  content: '🌐';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
}

/* Потребителско име */
.top5-username {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.theme-dark .top5-username {
  color: #f1f5f9;
}

/* Специален стил за първото място */
.top5-item:nth-child(1) .top5-username {
  font-size: 14px;
  color: #391212;
}

.theme-dark .top5-item:nth-child(1) .top5-username {
  color: #ffd700;
}

/* Точки */
.top5-points {
  font-size: 12px;
  font-weight: 700;
  color: #391212;
  background: rgba(57, 18, 18, 0.1);
  padding: 4px 8px;
  border-radius: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.theme-dark .top5-points {
  color: #a5b4fc;
  background: rgba(165, 180, 252, 0.1);
}

/* Специални стилове за първите 3 места */
.top5-item:nth-child(1) .top5-points {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 237, 78, 0.2));
  color: #b8860b;
  font-size: 13px;
}

.top5-item:nth-child(2) .top5-points {
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.2), rgba(232, 232, 232, 0.2));
  color: #6b7280;
}

.top5-item:nth-child(3) .top5-points {
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.2), rgba(232, 168, 124, 0.2));
  color: #92400e;
}

/* Икона за трофей/медал за първите 3 места */
.top5-item:nth-child(1)::before,
.top5-item:nth-child(2)::before,
.top5-item:nth-child(3)::before {
  content: '🏆';
  position: absolute;
  top: -3px;
  right: -3px;
  font-size: 16px;
  opacity: 0.25;
  transform: rotate(15deg);
}

.top5-item:nth-child(2)::before {
  content: '🥈';
}

.top5-item:nth-child(3)::before {
  content: '🥉';
}

/* ========== RESPONSIVE DESIGN ========== */

/* За таблети (768px - 1200px) */
@media (max-width: 1200px) {
  .top5-container {
    /* Показваме го на пълна ширина под основното съдържание */
    margin-top: 30px;
  }
}

/* За мобилни устройства (до 768px) */
@media (max-width: 768px) {
  .top5-container {
    padding: 20px;
    margin-bottom: 15px;
  }
  
  .top5-title {
    font-size: 18px;
    margin-bottom: 15px;
  }
  
  .top5-item {
    padding: 12px;
    gap: 10px;
    margin-bottom: 8px;
  }
  
  .top5-rank {
    min-width: 28px;
    height: 28px;
    font-size: 16px;
  }
  
  .top5-item:nth-child(1) .top5-rank {
    font-size: 18px;
  }
  
  .flag-icon {
    width: 20px;
    height: 14px;
  }
  
  .top5-username {
    font-size: 14px;
  }
  
  .top5-item:nth-child(1) .top5-username {
    font-size: 15px;
  }
  
  .top5-points {
    font-size: 13px;
    padding: 5px 10px;
  }
  
  .top5-item:nth-child(1) .top5-points {
    font-size: 14px;
  }
}

/* За малки мобилни устройства (до 480px) */
@media (max-width: 480px) {
  .top5-container {
    padding: 15px;
  }
  
  .top5-title {
    font-size: 16px;
    margin-bottom: 12px;
  }
  
  .top5-item {
    padding: 10px;
    gap: 8px;
  }
  
  .top5-rank {
    min-width: 26px;
    height: 26px;
    font-size: 14px;
  }
  
  .top5-item:nth-child(1) .top5-rank {
    font-size: 16px;
  }
  
  .flag-icon {
    width: 18px;
    height: 12px;
  }
  
  .top5-username {
    font-size: 13px;
  }
  
  .top5-item:nth-child(1) .top5-username {
    font-size: 14px;
  }
  
  .top5-points {
    font-size: 12px;
    padding: 4px 8px;
  }
  
  .top5-item:nth-child(1) .top5-points {
    font-size: 13px;
  }
  
  /* Скриваме емоджи иконите на много малки екрани */
  .top5-item:nth-child(1)::before,
  .top5-item:nth-child(2)::before,
  .top5-item:nth-child(3)::before {
    display: none;
  }
}

/* ========== ACCESSIBILITY ========== */
@media (prefers-reduced-motion: reduce) {
  .top5-item {
    animation: none;
    opacity: 1;
  }
  
  .top5-item:hover {
    transform: none;
  }
}

/* Focus стил за достъпност */
.top5-item:focus-within {
  outline: 3px solid #391212;
  outline-offset: 2px;
}