/* 기본 스타일 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Pretendard", "Apple SD Gothic Neo", sans-serif;
}

body {
  background-color: #f9f9f9;
  color: #333;
  line-height: 1.6;
}

/* 주간 랭킹 컨테이너 */
.weekly-ranking-medals {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 3rem;
  padding: 1rem;
}

/* 헤더 스타일 */
.ranking-header {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

@media (min-width: 768px) {
  .ranking-header {
    flex-direction: row;
    align-items: center;
  }
}

.title-container {
  display: flex;
  align-items: center;
}

.title-accent {
  width: 0.375rem;
  height: 2rem;
  background-color: #db2777;
  border-radius: 9999px;
  margin-right: 0.75rem;
}

.ranking-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
}

.ranking-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.week-badge {
  background-color: #fdf2f8;
  color: #be185d;
  border: 1px solid #fbcfe8;
  border-radius: 9999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.update-time {
  font-size: 0.875rem;
  color: #6b7280;
  display: flex;
  align-items: center;
}

.update-indicator {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  background-color: #10b981;
  border-radius: 50%;
  margin-right: 0.5rem;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    opacity: 0.5;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
  100% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

/* 탭 스타일 */
.tabs-container {
  width: 100%;
}

.league-tabs,
.record-tabs {
  display: grid;
  width: 100%;
  background-color: #f1f5f9;
  border-radius: 0.75rem;
  padding: 0.375rem;
  margin-bottom: 1.5rem;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.league-tabs {
  grid-template-columns: repeat(2, 1fr);
}

.record-tabs {
  grid-template-columns: repeat(3, 1fr);
}

.tab-button {
  padding: 0.875rem 1rem;
  border: none;
  background: none;
  border-radius: 0.5rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  color: #64748b;
  background-color: transparent;
}

.tab-button:hover {
  background-color: rgba(219, 39, 119, 0.1);
  color: #be185d;
  transform: translateY(-1px);
}

.tab-button.active {
  background-color: #db2777;
  color: white;
  box-shadow: 0 4px 6px -1px rgba(219, 39, 119, 0.3), 0 2px 4px -1px rgba(219, 39, 119, 0.2);
  transform: translateY(-1px);
}

.tab-button.active::before {
  content: "";
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background-color: #f472b6;
  border-radius: 0 0 3px 3px;
}

/* 리그 탭 특별 스타일 */
.league-tabs .tab-button {
  font-size: 18px;
  font-weight: 600;
}

.league-tabs .tab-button:not(.active) {
  color: #475569;
  background-color: rgba(255, 255, 255, 0.7);
}

.league-tabs .tab-button.active {
  background: linear-gradient(135deg, #db2777, #be185d);
  box-shadow: 0 6px 12px -2px rgba(219, 39, 119, 0.4);
}

/* 기록 탭 특별 스타일 */
.record-tabs .tab-button {
  font-size: 16px;
  font-weight: 500;
}

.record-tabs .tab-button:not(.active) {
  color: #64748b;
  background-color: rgba(255, 255, 255, 0.5);
}

.record-tabs .tab-button.active {
  background: linear-gradient(135deg, #ec4899, #db2777);
  box-shadow: 0 4px 8px -2px rgba(236, 72, 153, 0.4);
}

/* 리워드 선택기 */
.reward-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
  opacity: 0;
  transform: translateY(10px);
  animation: fadeInUp 0.5s forwards 0.5s;
}

.reward-button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  background-color: #fce7f3;
  color: #be185d;
}

.reward-button:hover {
  background-color: #fbcfe8;
}

.reward-button.active {
  background-color: #db2777;
  color: white;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* 로딩 스피너 */
.loading-spinner {
  display: none;
  justify-content: center;
  align-items: center;
  height: 20rem;
}

.spinner {
  width: 3rem;
  height: 3rem;
  border: 0.25rem solid #f3f4f6;
  border-top: 0.25rem solid #db2777;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* 메달 카드 그리드 */
.medal-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  opacity: 0;
  animation: fadeIn 0.5s forwards;
}

@media (min-width: 768px) {
  .medal-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 메달 카드 스타일 */
.medal-card {
  position: relative;
  border-radius: 0.5rem;
  overflow: hidden;
  background-color: white;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(20px);
  cursor: pointer;
}

.medal-card:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.medal-card.gold {
  border: 2px solid #fbbf24;
}

.medal-card.silver {
  border: 2px solid #d1d5db;
}

.medal-card.bronze {
  border: 2px solid #d97706;
}

.medal-card-header {
  height: 0.5rem;
}

.medal-card.gold .medal-card-header {
  background: linear-gradient(135deg, #fcd34d, #f59e0b, #d97706);
}

.medal-card.silver .medal-card-header {
  background: linear-gradient(135deg, #e5e7eb, #9ca3af, #6b7280);
}

.medal-card.bronze .medal-card-header {
  background: linear-gradient(135deg, #fb923c, #ea580c, #9a3412);
}

.medal-card-content {
  padding: 1.5rem;
  padding-top: 1.25rem;
}

.medal-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.medal-rank {
  display: flex;
  align-items: center;
}

.medal-icon {
  margin-right: 0.5rem;
  font-size: 1.75rem;
}

.gold .medal-icon {
  color: #f59e0b;
}

.silver .medal-icon {
  color: #9ca3af;
}

.bronze .medal-icon {
  color: #b45309;
}

.rank-number {
  font-weight: 700;
  font-size: 1.5rem;
}

.game-type {
  background-color: #fce7f3;
  color: #be185d;
  padding: 0.375rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
}

.rank-change {
  display: flex;
  align-items: center;
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.rank-change.up {
  color: #10b981;
}

.rank-change.down {
  color: #ef4444;
}

.rank-change.same {
  color: #6b7280;
}

.medal-card-info {
  text-align: center;
  margin-bottom: 1.25rem;
}

.nickname {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.25rem;
}

.profit-rate {
  font-size: 1.5rem;
  font-weight: 700;
  color: #db2777;
}

.reward-amount {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #f9fafb;
  border-radius: 0.5rem;
  padding: 0.75rem;
}

.reward-label {
  display: flex;
  align-items: center;
  color: #4b5563;
  font-weight: 500;
}

.reward-icon {
  color: #10b981;
  margin-right: 0.25rem;
}

.reward-value {
  color: #10b981;
  font-weight: 700;
}

.detail-link {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
  color: #db2777;
  font-weight: 500;
  font-size: 0.875rem;
}

.detail-link i {
  margin-left: 0.25rem;
  transition: transform 0.3s ease;
}

.medal-card:hover .detail-link i {
  transform: translateX(3px);
}

.top-ribbon {
  position: absolute;
  top: -1px;
  right: -1px;
  width: 5rem;
  height: 5rem;
  overflow: hidden;
}

.top-ribbon-content {
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 8.5rem;
  background-color: #db2777;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  transform: rotate(45deg);
  top: 1.25rem;
  right: -2.5rem;
  padding: 0.25rem 0;
}

/* 애니메이션 */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

/* 모달 스타일 */
.reward-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  overflow-y: auto;
}

.modal-content {
  position: relative;
  background-color: white;
  margin: 2rem auto;
  padding: 0;
  width: 90%;
  max-width: 800px;
  border-radius: 0.75rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  animation: modalFadeIn 0.3s;
}

.modal-header {
  padding: 1rem;
  text-align: right;
}

.close-modal {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6b7280;
}

.modal-body {
  padding: 0 2rem 2rem;
}

.modal-back-link {
  display: inline-flex;
  align-items: center;
  color: #db2777;
  margin-bottom: 2rem;
  text-decoration: none;
  font-weight: 500;
}

.modal-back-link i {
  margin-right: 0.5rem;
}

.modal-back-link:hover {
  text-decoration: underline;
}

.modal-header-bar {
  height: 0.75rem;
  width: 100%;
  transform-origin: left;
}

.modal-header-bar.gold {
  background: linear-gradient(90deg, #fcd34d, #f59e0b, #d97706);
}

.modal-header-bar.silver {
  background: linear-gradient(90deg, #e5e7eb, #9ca3af, #6b7280);
}

.modal-header-bar.bronze {
  background: linear-gradient(90deg, #fb923c, #ea580c, #9a3412);
}

.modal-title-section {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
}

@media (min-width: 768px) {
  .modal-title-section {
    flex-direction: row;
    align-items: center;
  }
}

.modal-title-container {
  display: flex;
  align-items: center;
}

.modal-rank-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  margin-right: 0.75rem;
}

.modal-rank-badge.gold {
  background-color: #fef3c7;
  color: #92400e;
}

.modal-rank-badge.silver {
  background-color: #f3f4f6;
  color: #4b5563;
}

.modal-rank-badge.bronze {
  background-color: #ffedd5;
  color: #9a3412;
}

.modal-title {
  font-size: 1.875rem;
  font-weight: 700;
  color: #1f2937;
}

.modal-subtitle {
  color: #6b7280;
  margin-top: 0.5rem;
}

.modal-reward-amount {
  background-color: #fdf2f8;
  border-radius: 0.5rem;
  padding: 0.75rem 1.5rem;
  text-align: center;
}

.modal-reward-label {
  font-size: 0.875rem;
  color: #be185d;
  margin-bottom: 0.25rem;
}

.modal-reward-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #be185d;
}

.modal-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .modal-stats {
    grid-template-columns: repeat(3, 1fr);
  }
}

.modal-stat-card {
  background-color: #f9fafb;
  border-radius: 0.5rem;
  padding: 1.25rem;
  text-align: center;
}

.modal-stat-label {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 0.25rem;
}

.modal-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.modal-stat-value.profit {
  color: #db2777;
}

.modal-stat-value.game {
  color: #4b5563;
}

.modal-rank-history {
  display: flex;
  justify-content: center;
  gap: 0.25rem;
}

.history-rank {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  background-color: #e5e7eb;
  color: #4b5563;
}

.history-rank.current {
  background-color: #db2777;
  color: white;
}

.modal-section {
  margin-bottom: 2rem;
}

.modal-section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 1rem;
}

.modal-description {
  color: #4b5563;
  line-height: 1.6;
}

.achievements-list {
  list-style: none;
}

.achievement-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.achievement-bullet {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  background-color: #fce7f3;
  color: #db2777;
  border-radius: 50%;
  font-size: 0.75rem;
  margin-right: 0.75rem;
  margin-top: 0.125rem;
  flex-shrink: 0;
}

.achievement-text {
  color: #4b5563;
}

/* 모달 하단 버튼 */
.modal-footer {
  display: flex;
  justify-content: center;
  padding: 1.5rem 0;
  border-top: 1px solid #e5e7eb;
  margin-top: 2rem;
}

.modal-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 2rem;
  background: linear-gradient(135deg, #db2777, #be185d);
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px -1px rgba(219, 39, 119, 0.3);
}

.modal-link-button:hover {
  background: linear-gradient(135deg, #be185d, #a21650);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px -2px rgba(219, 39, 119, 0.4);
  color: white;
  text-decoration: none;
}

.modal-link-button i {
  margin-left: 0.5rem;
  transition: transform 0.3s ease;
}

.modal-link-button:hover i {
  transform: translateX(3px);
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
