/**
 * BITDASH Premium Design System
 * 공통 스타일 컴포넌트 라이브러리
 */

/* ==================== 다국어 폰트 설정 ==================== */
:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* 중국어 폰트 (简体中文) */
html[lang="zh"],
html[lang="zh"] * {
  font-family: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Microsoft YaHei", "微软雅黑", sans-serif !important;
}

/* 일본어 폰트 (日本語) */
html[lang="ja"],
html[lang="ja"] * {
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic Pro", "ヒラギノ角ゴ Pro W3", "Yu Gothic", "游ゴシック", sans-serif !important;
}

/* ==================== Toggle Switch ==================== */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #4B5563;
  border-radius: 9999px;
  transition: 0.3s;
}

.toggle-slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background: #FF6B35;
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* ==================== Modal Backdrop ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

/* ==================== Spinner Animation ==================== */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ==================== Skeleton Loading ==================== */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.skeleton {
  background: #2D2D2D;
  border-radius: 0.375rem;
  animation: pulse 2s cubic-bezier(0.4,0,0.6,1) infinite;
}

.skeleton-text {
  height: 1rem;
}

/* ==================== 메뉴 시스템 스타일 ==================== */
#nav-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  pointer-events: none;
}

#nav-menu.open {
  pointer-events: auto;
}

.menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 90;
}

#nav-menu.open .menu-overlay {
  opacity: 1;
  pointer-events: auto;
}

.menu-items {
  position: fixed;
  top: 0;
  left: 0;
  width: 320px;
  height: 100vh;
  background-color: #1A1A1A;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  pointer-events: auto;
  padding-top: 0;
  padding-bottom: 200px;
  z-index: 100;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

#nav-menu.open .menu-items {
  transform: translateX(0);
}

.menu-category {
  border-bottom: 1px solid #333;
}

.menu-category-btn {
  width: 100%;
  padding: 15px 20px;
  background: none;
  border: none;
  color: #F1F1F1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: background-color 0.2s ease;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}

.menu-category-btn:hover {
  background-color: #2D2D2D;
}

.category-title {
  flex: 1;
}

.category-toggle {
  font-size: 12px;
  color: #999;
  transition: transform 0.3s ease;
}

.menu-category-btn.open .category-toggle {
  transform: rotate(180deg);
}

.submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background-color: #2D2D2D;
}

.submenu.open {
  max-height: 1000px;
}

.menu-item {
  display: block;
  padding: 12px 20px 12px 54px;
  color: #999;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-left: 2px solid transparent;
  transition: all 0.2s ease;
  cursor: pointer;
}

.menu-item:hover {
  color: #FF6B35;
  background-color: rgba(255, 107, 53, 0.1);
  border-left-color: #FF6B35;
}

/* ==================== 뷰어 아이콘 섹션 ==================== */
.viewer-icon-section {
  position: sticky;
  top: 0;
  padding: 16px 20px;
  background-color: #1A1A1A;
  border-bottom: 1px solid #333;
  z-index: 10;
  margin-bottom: 0;
}

.viewer-icon-container {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-start;
}

.viewer-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid #FF6B35;
  background-color: transparent;
  color: #FF6B35;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
}

.viewer-icon-btn:hover {
  background-color: #FF6B35;
  color: #ffffff;
  transform: scale(1.05);
}

.viewer-icon-label {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
  text-align: center;
  width: 44px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==================== 언어 선택기 메뉴 ==================== */
.language-selector-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background-color: #2D2D2D;
  border: 1px solid #FF6B35;
  border-radius: 8px;
  padding: 8px 0;
  min-width: 140px;
  flex-direction: column;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 1000;
}

.language-option {
  padding: 10px 16px;
  color: #F1F1F1;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.language-option:hover {
  background-color: rgba(255, 107, 53, 0.1);
  color: #FF6B35;
}

.language-option.active {
  background-color: rgba(255, 107, 53, 0.2);
  color: #FF6B35;
  font-weight: 600;
}

/* ==================== 스크롤바 ==================== */
.menu-items::-webkit-scrollbar {
  width: 6px;
}

.menu-items::-webkit-scrollbar-track {
  background: transparent;
}

.menu-items::-webkit-scrollbar-thumb {
  background-color: #333;
  border-radius: 3px;
}

.menu-items::-webkit-scrollbar-thumb:hover {
  background-color: #999;
}

/* ==================== 데스크톱: 메뉴 초기 숨김 (햄버거 클릭 시 표시) ==================== */
@media (min-width: 769px) {
  /* 데스크톱에서도 초기에는 메뉴 숨김 */
  /* #nav-menu.open 상태일 때만 표시됨 (모바일과 동일) */
}

/* ==================== 모바일 반응형 ==================== */
@media (max-width: 768px) {
  .menu-items {
    width: 280px;
  }
}
