/**
 * leaderboard.css
 * ランキングページスタイル
 */

.leaderboard-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.leaderboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
  padding: 1.5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  color: white;
}

.leaderboard-header__title-section {
  flex: 1;
}

.leaderboard-title {
  font-size: 32px;
  font-weight: 800;
  color: white;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 0.5rem 0;
}

.leaderboard-header__subtitle {
  font-size: 0.9rem;
  opacity: 0.9;
  margin: 0;
  color: white;
}

.leaderboard-header__actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.leaderboard-title i {
  color: #ffd93d;
  font-size: 36px;
  animation: trophy-shine 3s ease-in-out infinite;
}

@keyframes trophy-shine {
  0%,
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 8px rgba(255, 217, 61, 0.4));
  }
  50% {
    transform: scale(1.1);
    filter: drop-shadow(0 0 16px rgba(255, 217, 61, 0.6));
  }
}

.points-explanation-btn {
  padding: 8px 16px;
  background: white;
  border: 2px solid white;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #667eea;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.points-explanation-btn:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-2px);
}

.refresh-btn {
  padding: 12px 16px;
  background: white;
  border: 2px solid white;
  border-radius: 12px;
  cursor: pointer;
  font-size: 18px;
  color: #667eea;
  transition: all 0.2s ease;
}

.refresh-btn:hover:not(:disabled) {
  background: #f5f5f5;
  transform: rotate(180deg);
}

.refresh-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.timeframe-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
  background: white;
  padding: 8px;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.timeframe-tab {
  flex: 1;
  padding: 12px 24px;
  background: transparent;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-light, #757575);
  cursor: pointer;
  transition: all 0.2s ease;
}

.timeframe-tab:hover {
  background: #f5f5f5;
  color: var(--color-text, #212121);
}

.timeframe-tab--active {
  background: var(--gradient-primary, linear-gradient(135deg, #ff6b35 0%, #f7c331 100%));
  color: white;
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.user-rank-card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 32px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 2px solid #e0e0e0;
}

.user-rank-card--highlight {
  background: var(--gradient-hero, linear-gradient(135deg, #ffe66d 0%, #ff6b35 50%, #ff6b9d 100%));
  border: none;
  color: white;
}

.user-rank-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.user-rank-card__title {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.user-rank-card--highlight .user-rank-card__title {
  color: rgba(255, 255, 255, 0.9);
}

.user-rank-card__percentile {
  padding: 4px 12px;
  background: rgba(255, 107, 53, 0.1);
  color: #ff6b35;
  font-size: 13px;
  font-weight: 700;
  border-radius: 12px;
}

.user-rank-card--highlight .user-rank-card__percentile {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.user-rank-card__content {
  display: flex;
  align-items: center;
  gap: 24px;
}

.user-rank-card__rank {
  font-size: 48px;
  font-weight: 900;
  color: var(--color-text, #212121);
  line-height: 1;
}

.user-rank-card--highlight .user-rank-card__rank {
  color: white;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.user-rank-card__stats {
  display: flex;
  gap: 24px;
  flex: 1;
}

.user-rank-card__stat {
  display: flex;
  flex-direction: column;
}

.user-rank-card__stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text, #212121);
}

.user-rank-card--highlight .user-rank-card__stat-value {
  color: white;
}

.user-rank-card__stat-label {
  font-size: 13px;
  color: var(--color-text-light, #757575);
}

.user-rank-card--highlight .user-rank-card__stat-label {
  color: rgba(255, 255, 255, 0.8);
}

/* Empty state styling */
.user-rank-card--empty {
  text-align: center;
  padding: 40px 24px;
  background: linear-gradient(135deg, #f5f5f5 0%, #fafafa 100%);
  border: 2px dashed #e0e0e0;
  color: var(--color-text-light, #757575);
}

.user-rank-card__empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.3;
  filter: grayscale(100%);
}

.user-rank-card__empty-message {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text, #212121);
  margin: 0 0 8px 0;
}

.user-rank-card__empty-hint {
  font-size: 14px;
  margin: 0 0 20px 0;
}

.user-rank-card__cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.user-rank-card__cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.user-rank-card__cta-btn:active {
  transform: translateY(0);
}

.user-rank-card__cta-btn i {
  font-size: 16px;
}

.podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.podium-item {
  background: white;
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease;
  cursor: pointer;
}

.podium-item:hover {
  transform: translateY(-4px);
}

.podium-item__arrow {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 20px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.podium-item:hover .podium-item__arrow {
  opacity: 0.6;
}

.podium-item.rank-gold {
  background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
  color: white;
  box-shadow: 0 8px 32px rgba(255, 215, 0, 0.4);
}

.podium-item.rank-silver {
  background: linear-gradient(135deg, #e8e8e8 0%, #b8b8b8 100%);
  color: #424242;
  box-shadow: 0 6px 24px rgba(184, 184, 184, 0.4);
}

.podium-item.rank-bronze {
  background: linear-gradient(135deg, #cd7f32 0%, #a0522d 100%);
  color: white;
  box-shadow: 0 6px 24px rgba(205, 127, 50, 0.4);
}

.podium-item__medal {
  font-size: 48px;
  margin-bottom: 12px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.podium-item__rank {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  opacity: 0.8;
}

.podium-item__avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto 16px;
  overflow: hidden;
  border: 4px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.podium-item__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.podium-item__avatar-placeholder {
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
}

.podium-item__name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.podium-item__points {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.podium-item__stats {
  font-size: 13px;
  opacity: 0.8;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.leaderboard-list {
  background: white;
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 4px;
}

.leaderboard-item:hover {
  background: #f8f9fa;
  transform: translateX(4px);
}

.leaderboard-item--current {
  background: var(--gradient-hero, linear-gradient(135deg, #ffe66d 0%, #ff6b35 50%, #ff6b9d 100%));
  color: white;
  box-shadow: 0 4px 16px rgba(255, 107, 53, 0.3);
}

.leaderboard-item--current:hover {
  background: var(--gradient-hero, linear-gradient(135deg, #ffe66d 0%, #ff6b35 50%, #ff6b9d 100%));
}

.leaderboard-item__rank {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text-light, #757575);
  min-width: 48px;
  text-align: center;
}

.leaderboard-item--current .leaderboard-item__rank {
  color: white;
}

.leaderboard-item__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #e0e0e0;
  flex-shrink: 0;
}

.leaderboard-item--current .leaderboard-item__avatar {
  border-color: white;
}

.leaderboard-item__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.leaderboard-item__avatar-placeholder {
  width: 100%;
  height: 100%;
  background: #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--color-text-light, #757575);
}

.leaderboard-item__info {
  flex: 1;
}

.leaderboard-item__name {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text, #212121);
  margin-bottom: 4px;
}

.leaderboard-item--current .leaderboard-item__name {
  color: white;
}

.leaderboard-item__stats {
  font-size: 13px;
  color: var(--color-text-light, #757575);
  display: flex;
  gap: 4px;
}

.leaderboard-item--current .leaderboard-item__stats {
  color: rgba(255, 255, 255, 0.8);
}

.leaderboard-item__points {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 700;
  color: #ff6b35;
}

.leaderboard-item--current .leaderboard-item__points {
  color: white;
}

.leaderboard-item__arrow {
  font-size: 20px;
  color: var(--color-text-light, #757575);
  opacity: 0.3;
  transition: all 0.2s ease;
}

.leaderboard-item:hover .leaderboard-item__arrow {
  opacity: 1;
  transform: translateX(4px);
}

.leaderboard-item--current .leaderboard-item__arrow {
  color: white;
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--color-text-light, #757575);
}

.empty-state i {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state p {
  font-size: 16px;
  margin: 0;
}

.show-more {
  text-align: center;
  margin-top: 24px;
}

.show-more-btn {
  padding: 12px 32px;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text, #212121);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.show-more-btn:hover {
  background: #f5f5f5;
  border-color: #bdbdbd;
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  .leaderboard-container {
    padding: 16px;
  }

  .leaderboard-title {
    font-size: 24px;
  }

  .podium {
    grid-template-columns: 1fr;
  }

  .user-rank-card__content {
    flex-direction: column;
    align-items: flex-start;
  }

  .user-rank-card__stats {
    width: 100%;
  }

  .timeframe-tabs {
    flex-direction: column;
  }
}

@media (max-width: 576px) {
  .leaderboard-item__rank {
    min-width: 36px;
    font-size: 16px;
  }

  .leaderboard-item__avatar {
    width: 40px;
    height: 40px;
  }

  .user-rank-card__rank {
    font-size: 36px;
  }
}

.points-explanation {
  padding: 1rem 0;
}

.points-explanation__section-title {
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e0e0e0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text, #212121);
}

.points-explanation__section-title:first-child {
  margin-top: 0;
}

.points-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.points-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: #f8f9fa;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.points-item:hover {
  background: #e9ecef;
}

.points-item__label {
  font-weight: 500;
  color: var(--color-text, #212121);
}

.points-item__value {
  font-weight: 700;
  color: #667eea;
  font-size: 1.1rem;
}

.ranking-info .alert {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #e7f3ff;
  border: 1px solid #b3d9ff;
  border-radius: 8px;
  padding: 1rem;
}

.ranking-info .alert i {
  font-size: 20px;
  color: #0066cc;
  flex-shrink: 0;
}

.ranking-info .alert strong {
  display: block;
  margin-bottom: 0.5rem;
  color: #004080;
}

.ranking-info .alert p {
  color: #333;
  line-height: 1.5;
}

.modal-dialog {
  max-width: 600px;
  width: 90%;
}

.modal-content {
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body {
  padding: 1.5rem;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #e0e0e0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-text-light, #757575);
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.btn-close:hover {
  background: #f5f5f5;
}

.btn-close::before {
  content: '×';
  font-size: 2rem;
  line-height: 1;
}

/* ==========================================================================
   ダークモード対応
   ========================================================================== */

[data-theme='dark'] .timeframe-tabs {
  background: var(--color-surface);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

[data-theme='dark'] .timeframe-tab {
  color: var(--color-text-secondary);
}

[data-theme='dark'] .timeframe-tab:hover {
  background: var(--color-surface-light);
  color: var(--color-text);
}

[data-theme='dark'] .user-rank-card {
  background: var(--color-surface);
  border-color: var(--color-border);
}

[data-theme='dark'] .user-rank-card__rank,
[data-theme='dark'] .user-rank-card__stat-value,
[data-theme='dark'] .user-rank-card__empty-message {
  color: var(--color-text);
}

[data-theme='dark'] .user-rank-card__stat-label,
[data-theme='dark'] .user-rank-card__empty-hint {
  color: var(--color-text-secondary);
}

[data-theme='dark'] .user-rank-card--empty {
  background: var(--color-surface);
  border-color: var(--color-border);
}

[data-theme='dark'] .podium-item {
  background: var(--color-surface);
}

[data-theme='dark'] .leaderboard-list {
  background: var(--color-surface);
}

[data-theme='dark'] .leaderboard-item:hover {
  background: var(--color-surface-light);
}

[data-theme='dark'] .leaderboard-item__name {
  color: var(--color-text);
}

[data-theme='dark'] .leaderboard-item__stats,
[data-theme='dark'] .leaderboard-item__rank,
[data-theme='dark'] .leaderboard-item__arrow {
  color: var(--color-text-secondary);
}

[data-theme='dark'] .leaderboard-item__avatar-placeholder {
  background: var(--color-surface-light);
  color: var(--color-text-secondary);
}

[data-theme='dark'] .show-more-btn {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text);
}

[data-theme='dark'] .show-more-btn:hover {
  background: var(--color-surface-light);
}

[data-theme='dark'] .modal-content {
  background: var(--color-surface);
}

[data-theme='dark'] .modal-header,
[data-theme='dark'] .modal-footer {
  border-color: var(--color-border);
}

[data-theme='dark'] .modal-title,
[data-theme='dark'] .points-explanation__section-title {
  color: var(--color-text);
}

[data-theme='dark'] .points-explanation__section-title {
  border-bottom-color: var(--color-border);
}

[data-theme='dark'] .points-item {
  background: var(--color-surface-light);
}

[data-theme='dark'] .points-item:hover {
  background: var(--color-background);
}

[data-theme='dark'] .points-item__label {
  color: var(--color-text);
}

[data-theme='dark'] .ranking-info .alert {
  background: var(--color-surface-light);
  border-color: var(--color-border);
}

[data-theme='dark'] .ranking-info .alert strong {
  color: var(--color-text);
}

[data-theme='dark'] .ranking-info .alert p {
  color: var(--color-text-secondary);
}

[data-theme='dark'] .empty-state {
  color: var(--color-text-secondary);
}

[data-theme='dark'] .btn-close {
  color: var(--color-text-secondary);
}

[data-theme='dark'] .btn-close:hover {
  background: var(--color-surface-light);
}
