/* OW2 테마 CSS */

/* 로딩 스피너 */
.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #30363D;
  border-top-color: #F5A623;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 네비게이션 탭 */
.nav-tab {
  padding: 0 16px;
  height: 100%;
  font-size: 0.875rem;
  color: #9CA3AF;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.nav-tab:hover { color: #E5E7EB; }
.nav-tab.active { color: #F5A623; border-bottom-color: #F5A623; }

/* 영웅 카드 */
.hero-card {
  background: #161B22;
  border: 1px solid #30363D;
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.hero-card:hover {
  border-color: #4FC3F7;
  box-shadow: 0 0 0 1px rgba(79, 195, 247, 0.25);
}
.hero-card.selected {
  /* border-left color and box-shadow are set inline with the hero color */
}

/* 메타 점수 변화량 */
.delta-up      { color: #22c55e; font-size: 0.65rem; font-weight: 600; }
.delta-down    { color: #ef4444; font-size: 0.65rem; font-weight: 600; }
.delta-neutral { color: #6b7280; font-size: 0.65rem; }

/* 히스토리 차트 컨테이너 */
.chart-container {
  background: #0D1117;
  border: 1px solid #30363D;
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 16px;
}

/* 티어 배지 */
.tier-S { background: rgba(239, 68, 68, 0.12); border-color: #ef4444; color: #ef4444; }
.tier-A { background: rgba(249, 115, 22, 0.12); border-color: #f97316; color: #f97316; }
.tier-B { background: rgba(234, 179, 8, 0.12);  border-color: #eab308; color: #eab308; }
.tier-C { background: rgba(34, 197, 94, 0.12);  border-color: #22c55e; color: #22c55e; }
.tier-D { background: rgba(107, 114, 128, 0.12);border-color: #6b7280; color: #6b7280; }

/* 티어 섹션 헤더 */
.tier-header-S { border-left: 3px solid #ef4444; }
.tier-header-A { border-left: 3px solid #f97316; }
.tier-header-B { border-left: 3px solid #eab308; }
.tier-header-C { border-left: 3px solid #22c55e; }
.tier-header-D { border-left: 3px solid #6b7280; }

/* 빌드 코드 배지 */
.code-badge {
  font-family: monospace;
  letter-spacing: 0.1em;
  cursor: pointer;
  background: #0D1117;
  border: 1px solid #30363D;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 0.85rem;
  color: #4FC3F7;
  transition: border-color 0.15s, color 0.15s;
  user-select: all;
}
.code-badge:hover {
  border-color: #4FC3F7;
  color: #fff;
}
.code-badge.copied {
  border-color: #22c55e;
  color: #22c55e;
}

/* 역할 태그 */
.role-tank    { background: rgba(79, 195, 247, 0.15); color: #4FC3F7; }
.role-damage  { background: rgba(239, 68, 68, 0.15);  color: #ef4444; }
.role-support { background: rgba(34, 197, 94, 0.15);  color: #22c55e; }

/* 플레이스타일 뱃지 */
.playstyle-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(245, 166, 35, 0.12);
  border: 1px solid rgba(245, 166, 35, 0.3);
  color: #F5A623;
}

/* 스타디움 빌드 카드 */
.stadium-card {
  background: #161B22;
  border: 1px solid #30363D;
  border-radius: 10px;
  padding: 20px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.stadium-card:hover {
  border-color: #F5A623;
  box-shadow: 0 0 0 1px rgba(245, 166, 35, 0.2);
}

/* 빌드 순위 뱃지 */
.stadium-rank {
  width: 1.6rem;
  height: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 50%;
  background: rgba(245, 166, 35, 0.12);
  color: #F5A623;
  border: 1px solid rgba(245, 166, 35, 0.3);
  flex-shrink: 0;
}

/* 스타디움 스탯 바 */
.stat-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.stat-bar-label {
  font-size: 0.68rem;
  color: #8B949E;
  width: 68px;
  flex-shrink: 0;
  text-align: right;
}
.stat-bar-track {
  flex: 1;
  height: 5px;
  background: #21262D;
  border-radius: 2px;
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  border-radius: 2px;
}
.stat-bar-value {
  font-size: 0.68rem;
  color: #6E7681;
  width: 40px;
  text-align: right;
  flex-shrink: 0;
}

/* 패치 카드 */
.patch-hero-card {
  background: #161B22;
  border: 1px solid #30363D;
  border-radius: 8px;
  padding: 16px;
}
.patch-hero-card.is-stadium {
  border-color: rgba(245, 166, 35, 0.4);
}

/* 영웅 정보 패널 */
.hero-detail-panel {
  background: #161B22;
  border: 1px solid #30363D;
  border-radius: 8px;
  padding: 20px;
}

/* 모드 탭 (랭크별 / 맵별) */
.mode-tab {
  padding: 5px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #30363D;
  color: #6B7280;
  background: transparent;
  transition: all 0.15s;
  cursor: pointer;
}
.mode-tab:hover:not(.active) { color: #E5E7EB; border-color: #4B5563; }
.mode-tab.active {
  color: #F5A623;
  border-color: #F5A623;
  background: rgba(245, 166, 35, 0.08);
}

/* 맵 선택 버튼 */
.map-btn {
  padding: 4px 10px;
  font-size: 0.75rem;
  border-radius: 5px;
  border: 1px solid #30363D;
  color: #9CA3AF;
  background: transparent;
  transition: all 0.15s;
  cursor: pointer;
  white-space: nowrap;
}
.map-btn:hover:not(.active):not(:disabled) { color: #E5E7EB; border-color: #4B5563; }
.map-btn.active {
  color: #60A5FA;
  border-color: #60A5FA;
  background: rgba(96, 165, 250, 0.08);
}
.map-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* 필터 버튼 */
.filter-btn {
  padding: 4px 14px;
  border-radius: 9999px;
  font-size: 0.8rem;
  border: 1px solid #30363D;
  color: #9CA3AF;
  transition: all 0.15s;
}
.filter-btn:hover { border-color: #6B7280; color: #E5E7EB; }
.filter-btn.active {
  background: rgba(245, 166, 35, 0.15);
  border-color: #F5A623;
  color: #F5A623;
}

/* 검색 입력 */
.search-input {
  background: #161B22;
  border: 1px solid #30363D;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 0.875rem;
  color: #E5E7EB;
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus { border-color: #4FC3F7; }
.search-input::placeholder { color: #6B7280; }

/* 드롭다운 */
.ow-select {
  background: #161B22;
  border: 1px solid #30363D;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.875rem;
  color: #E5E7EB;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.ow-select:focus { border-color: #4FC3F7; }
.ow-select option { background: #161B22; }

/* 영웅 pill 버튼 */
.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 5px;
  border-radius: 9999px;
  font-size: 0.8rem;
  border: 1px solid #30363D;
  color: #9CA3AF;
  transition: all 0.15s;
  white-space: nowrap;
}
.hero-pill:hover { border-color: #6B7280; color: #E5E7EB; }
.hero-pill.active {
  background: rgba(245, 166, 35, 0.15);
  border-color: #F5A623;
  color: #F5A623;
}

/* 이번 주 메타 변화 영웅 버튼 */
.weekly-hero-btn {
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  border: 1px solid #30363D;
  color: #9CA3AF;
  transition: all 0.15s;
  cursor: pointer;
  white-space: nowrap;
}
.weekly-hero-btn:hover { border-color: #6B7280; color: #E5E7EB; }

/* 뷰 토글 버튼 (카드/테이블) */
.view-toggle-btn {
  padding: 4px 10px;
  border-radius: 5px;
  border: 1px solid #30363D;
  color: #6B7280;
  background: transparent;
  font-size: 0.8rem;
  transition: all 0.15s;
  cursor: pointer;
}
.view-toggle-btn:hover { color: #E5E7EB; border-color: #4B5563; }
.view-toggle-btn.active {
  color: #F5A623;
  border-color: #F5A623;
  background: rgba(245, 166, 35, 0.08);
}

/* 메타 테이블 */
.meta-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.meta-table th {
  padding: 8px 12px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: #6B7280;
  background: #0D1117;
  border-bottom: 1px solid #30363D;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}
.meta-table th:hover { color: #E5E7EB; }
.meta-table th.sort-active { color: #F5A623; }
.meta-table-row td {
  padding: 8px 12px;
  border-bottom: 1px solid #21262D;
  vertical-align: middle;
}
.meta-table-row:hover td { background: rgba(255,255,255,0.03); cursor: pointer; }
.meta-table-row.selected td { background: rgba(245, 166, 35, 0.06); }

/* 영웅 상세 패널 내 빌드 코드 배지 */
.detail-code-badge {
  font-family: monospace;
  letter-spacing: 0.08em;
  cursor: pointer;
  background: #0D1117;
  border: 1px solid #30363D;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.8rem;
  color: #4FC3F7;
  transition: border-color 0.15s, color 0.15s;
}
.detail-code-badge:hover { border-color: #4FC3F7; color: #fff; }
.detail-code-badge.copied { border-color: #22c55e; color: #22c55e; }

/* 패치 카드 티어 배지 */
.patch-tier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.3rem;
  height: 1.3rem;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 3px;
  border: 1px solid;
  flex-shrink: 0;
}

/* 스크롤바 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #0D1117; }
::-webkit-scrollbar-thumb { background: #30363D; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #6B7280; }

/* ── 영웅 초상화 ────────────────────────────────────────────────────────────── */

.hero-portrait {
  object-fit: cover;
  object-position: top center;
  flex-shrink: 0;
  display: block;
}
.hero-portrait-fallback {
  display: none;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: rgba(0,0,0,0.7);
  flex-shrink: 0;
  letter-spacing: -0.5px;
}
/* 메타 카드 (40×40) */
.hero-portrait-sm { width: 40px; height: 40px; border-radius: 6px; }
/* 패치 카드 (32×32) */
.hero-portrait-md { width: 32px; height: 32px; border-radius: 6px; }
/* 스타디움 pill (24×24) */
.hero-portrait-xs { width: 24px; height: 24px; border-radius: 50%; }

/* ── AI 챗봇 플로팅 버튼 + 팝업 ────────────────────────────────────────────── */

#ow-chat-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

/* 플로팅 버튼 (FAB) */
#ow-chat-fab {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #F5A623;
  color: #0D1117;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(245, 166, 35, 0.4);
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  flex-shrink: 0;
}
#ow-chat-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(245, 166, 35, 0.55);
}
#ow-chat-fab.active {
  background: #D4891A;
}

/* 팝업 창 */
.ow-chat-popup {
  width: 340px;
  max-height: 520px;
  background: #161B22;
  border: 1px solid #30363D;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: chatPopIn 0.2s ease;
}
.ow-chat-popup.hidden { display: none; }
@keyframes chatPopIn {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* 헤더 */
.ow-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #30363D;
  background: #0D1117;
  flex-shrink: 0;
}
.ow-chat-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #E5E7EB;
}
.ow-chat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  animation: chatPulse 2s ease-in-out infinite;
}
@keyframes chatPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
#ow-chat-close {
  background: none;
  border: none;
  color: #6B7280;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
#ow-chat-close:hover { color: #E5E7EB; background: #21262D; }

.ow-chat-limit-bar {
  display: none;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  margin-right: 8px;
}
.ow-chat-limit-track {
  width: 48px;
  height: 4px;
  border-radius: 2px;
  background: #30363D;
  overflow: hidden;
  flex-shrink: 0;
}
.ow-chat-limit-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s, background 0.3s;
}
.ow-chat-limit-text {
  font-size: 10px;
  white-space: nowrap;
}

/* 메시지 영역 */
.ow-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

/* 말풍선 */
.ow-chat-bubble {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 0.82rem;
  line-height: 1.55;
  word-break: break-word;
}
.ow-chat-bubble-ai {
  background: #21262D;
  color: #D1D5DB;
  border: 1px solid #30363D;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.ow-chat-bubble-user {
  background: #92400E;
  color: #FDE68A;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.ow-chat-bubble-hint {
  margin-top: 6px;
  font-size: 0.75rem;
  color: #6B7280;
  font-style: italic;
}

/* 로딩 타이핑 점 */
.ow-chat-typing {
  display: inline-block;
  font-size: 1.2rem;
  letter-spacing: 2px;
  animation: chatTyping 1.2s ease-in-out infinite;
}
@keyframes chatTyping {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* 입력 영역 */
.ow-chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #30363D;
  background: #0D1117;
  flex-shrink: 0;
}
.ow-chat-input {
  flex: 1;
  background: #21262D;
  border: 1px solid #30363D;
  border-radius: 8px;
  color: #E5E7EB;
  font-size: 0.82rem;
  padding: 8px 10px;
  resize: none;
  line-height: 1.5;
  min-height: 36px;
  max-height: 96px;
  overflow-y: auto;
  transition: border-color 0.15s;
  font-family: inherit;
}
.ow-chat-input::placeholder { color: #6B7280; }
.ow-chat-input:focus { outline: none; border-color: #F5A623; }

.ow-chat-send {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #F5A623;
  color: #0D1117;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, opacity 0.15s;
}
.ow-chat-send:hover:not(:disabled) { background: #D4891A; }
.ow-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.ow-chat-send.loading svg {
  animation: spin 0.8s linear infinite;
}

/* WORKER_URL 미설정 경고 */
.ow-chat-worker-warn {
  position: fixed;
  bottom: 90px;
  right: 24px;
  background: #7c2d12;
  color: #fed7aa;
  font-size: 0.75rem;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #ea580c;
  max-width: 300px;
  z-index: 999;
}

/* 모바일 */
@media (max-width: 480px) {
  #ow-chat-root { bottom: 16px; right: 16px; }
  .ow-chat-popup { width: calc(100vw - 32px); }
}
