/* 기본 스타일 초기화 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* 색상 테마 (어둡고 차분한 OP.GG 스타일) */
  --bg-primary: #121824;      /* 전체 메인 배경 */
  --bg-secondary: #1e283b;    /* 리스트, 헤더 배경 */
  --bg-tertiary: #27344c;     /* 호버, 활성화 배경 */
  --border-color: #2b3952;    /* 구분선 및 테두리 */
  --text-main: #f3f4f6;       /* 주 텍스트 (흰색 계열) */
  --text-sub: #9ca3af;        /* 부가 텍스트 (회색 계열) */
  --color-gold: #c89b3c;      /* 리그 오브 레전드 공식 골드 포인트 */
  --color-gold-hover: #f1cc7b;
  --color-blue: #005a82;      /* 리그 오브 레전드 공식 블루 포인트 */
  --color-active: #3b82f6;    /* 활성화 블루 */
  
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
}

/* 로딩 오버레이 */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(18, 24, 36, 0.85);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.3s ease, visibility 0.3s;
}

.loading-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
}

/* 공통 숨김 클래스 */
.hidden {
  display: none !important;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--color-gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

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

/* 앱 전체 컨테이너 */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
}

/* 헤더 영역 */
.main-header {
  background-color: var(--bg-secondary);
  border-bottom: 2px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  height: 64px;
  z-index: 10;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-text {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text-main);
  background: linear-gradient(135deg, var(--text-main) 0%, var(--color-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.patch-version {
  font-size: 11px;
  background-color: var(--border-color);
  color: var(--color-gold);
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.tab-navigation {
  display: flex;
  height: 100%;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-sub);
  font-size: 15px;
  font-weight: 600;
  padding: 0 24px;
  cursor: pointer;
  height: 100%;
  position: relative;
  transition: color 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  color: var(--color-gold);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 3px;
  background-color: var(--color-gold);
}

/* 메인 컨텐츠 영역 */
.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
  width: 100%;
}

/* 좌측 목록 섹션 */
.list-section {
  flex: 1;
  max-width: 60%;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  background-color: var(--bg-primary);
}

.filter-bar {
  padding: 16px 24px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box input {
  width: 100%;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  padding: 10px 16px;
  padding-right: 40px;
  font-size: 14px;
  font-family: var(--font-family);
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: var(--color-gold);
}

.clear-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-sub);
  font-size: 18px;
  cursor: pointer;
}

.clear-btn:hover {
  color: var(--text-main);
}

/* 필터 버튼들 */
.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-btn {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-sub);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-main);
}

.filter-btn.active {
  background-color: var(--color-gold);
  border-color: var(--color-gold);
  color: var(--bg-primary);
  font-weight: 700;
}

/* 목록 스크롤 영역 */
.list-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* 롤 테마 스크롤바 디자인 */
.list-scroll-area::-webkit-scrollbar,
.detail-section::-webkit-scrollbar {
  width: 8px;
}

.list-scroll-area::-webkit-scrollbar-track,
.detail-section::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

.list-scroll-area::-webkit-scrollbar-thumb,
.detail-section::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.list-scroll-area::-webkit-scrollbar-thumb:hover,
.detail-section::-webkit-scrollbar-thumb:hover {
  background: var(--bg-tertiary);
}

/* 목록 그리드 */
.list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 8px;
}

/* 챔피언 / 아이템 카드 */
.card-item {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 4px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.card-item:hover {
  transform: translateY(-1px);
  border-color: var(--color-gold);
  background-color: var(--bg-tertiary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.card-item.selected {
  border-color: var(--color-gold);
  background-color: var(--bg-tertiary);
  box-shadow: inset 0 0 0 1px var(--color-gold);
}

.card-img-wrapper {
  position: relative;
  width: 100%;
  padding-top: 100%; /* 1:1 비율 */
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 2px;
  background-color: var(--bg-primary);
}

.card-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-name {
  font-size: 9px;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* 우측 상세 정보 섹션 */
.detail-section {
  flex: 1;
  max-width: 40%;
  background-color: #161e2e; /* 더 어두운 디테일 영역 */
  border-left: 1px solid var(--border-color);
  overflow-y: auto;
}

/* 초기 비어있는 상태 */
.empty-detail-state {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  padding: 40px;
  text-align: center;
  color: var(--text-sub);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-detail-state h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
}

.empty-detail-state p {
  font-size: 13px;
  max-width: 240px;
  line-height: 1.5;
}

/* 상세 컨텐츠 영역 */
.detail-content-area {
  padding: 24px;
}

.detail-content-area.hidden {
  display: none;
}

/* 상세 헤더 */
.detail-header {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  align-items: flex-start;
}

.detail-portrait {
  width: 80px;
  height: 80px;
  border-radius: 6px;
  border: 2px solid var(--color-gold);
  object-fit: cover;
  background-color: var(--bg-primary);
}

.detail-title-group {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.detail-sub {
  font-size: 13px;
  color: var(--color-gold);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}

.detail-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.detail-tags {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.detail-tag {
  background-color: var(--bg-tertiary);
  color: var(--text-sub);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

/* 상세 탭/섹션 구분선 */
.detail-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 20px 0;
}

/* 상세 스펙/정보 영역 */
.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 14px;
  background-color: var(--color-gold);
  border-radius: 2px;
}

/* 능력치 그리드 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stat-item {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-label {
  font-size: 12px;
  color: var(--text-sub);
}

.stat-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

/* 스킬 컨테이너 */
.skills-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.skill-row {
  display: flex;
  gap: 12px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 12px;
  transition: border-color 0.2s;
}

.skill-row:hover {
  border-color: var(--bg-tertiary);
}

.skill-icon-wrapper {
  position: relative;
  flex-shrink: 0;
}

.skill-icon {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-primary);
}

.skill-key {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background-color: #101523;
  color: var(--color-gold);
  font-size: 9px;
  font-weight: 700;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--color-gold);
}

.skill-info {
  flex: 1;
}

.skill-name-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.skill-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.skill-meta {
  font-size: 11px;
  color: var(--text-sub);
}

.skill-desc {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.5;
  margin-top: 6px;
}

/* 아이템 가격 정보 */
.item-price-box {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.price-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.gold-icon {
  color: var(--color-gold);
  font-weight: bold;
}

/* 아이템 상세 설명 */
.item-description {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.6;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 16px;
}

.item-description stats {
  color: #55ff55; /* 아이템 스탯 강조 (초록색 계열) */
}

.item-description active {
  color: #ffaa00; /* 액티브 효과 강조 */
}

.item-description passive {
  color: #00e5ff; /* 패시브 효과 강조 */
}

/* 반응형 모바일 레이아웃 (태블릿 이하) */
@media (max-width: 900px) {
  .main-content {
    flex-direction: column;
    overflow-y: auto;
  }

  .list-section {
    max-width: 100%;
    border-right: none;
    border-bottom: 2px solid var(--border-color);
    flex: initial;
    height: 50vh;
  }
  
  .list-scroll-area {
    padding: 16px;
  }

  .list-grid {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 8px;
  }

  .detail-section {
    max-width: 100%;
    border-left: none;
    flex: 1;
    height: 50vh;
  }
}

/* 스킬 세부 스펙 및 계수 정보 박스 스타일 */
.skill-specs-box {
  margin-top: 10px;
  background-color: rgba(16, 21, 35, 0.4);
  border: 1px dashed var(--border-color);
  border-left: 3px solid var(--color-gold);
  border-radius: 4px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spec-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
}

.spec-attr {
  color: var(--text-sub);
  font-weight: 500;
}

.spec-val {
  color: var(--text-main);
  font-weight: 600;
}

.scaling-ratio {
  color: #ffaa00;
  font-size: 10px;
  font-weight: 600;
}
