/* ===== 삼국지 AI — 메인 스타일 ===== */

:root {
  /* 색상 팔레트 */
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-sidebar: #0d0d15;
  --bg-card: #15151f;
  --bg-hover: #1c1c2a;
  --bg-modal: rgba(0, 0, 0, 0.85);

  --gold: #d4a843;
  --gold-light: #e8c66a;
  --gold-dim: #8a6f2e;
  --red: #8b2020;
  --red-light: #c0392b;
  --navy: #1a1a3e;
  --navy-light: #2a2a5e;

  --text-primary: #e8e0d0;
  --text-secondary: #a09880;
  --text-muted: #605848;
  --border: #2a2520;
  --border-light: #3a352f;

  /* 세력 색상 */
  --faction-wei: #4169E1;
  --faction-shu: #228B22;
  --faction-wu: #DC143C;
  --faction-dong-zhuo: #8B008B;
  --faction-yuan-shao: #DAA520;
  --faction-yuan-shu: #CD853F;
  --faction-liu-biao: #2E8B57;
  --faction-han: #FFD700;
  --faction-other: #808080;

  /* 레이아웃 */
  --sidebar-width: 240px;
  --content-max-width: 1200px;

  /* 타이포그래피 */
  --font-serif: 'Noto Serif KR', serif;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ===== 리셋 ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

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

/* ===== 스크롤바 ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* ===== 사이드바 ===== */
#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.logo {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 0.1em;
}

.logo-sub {
  font-size: 0.9rem;
  color: var(--red-light);
  margin-left: 4px;
  vertical-align: super;
}

.nav-menu {
  list-style: none;
  padding: 12px 0;
  flex: 1;
  overflow-y: auto;
}

.nav-menu li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.nav-menu li a:hover {
  color: var(--gold-light);
  background: var(--bg-hover);
  border-left-color: var(--gold-dim);
}

.nav-menu li a.active {
  color: var(--gold);
  background: var(--navy);
  border-left-color: var(--gold);
  font-weight: 700;
}

.nav-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.sidebar-footer p {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-serif);
}

/* ===== 메인 콘텐츠 ===== */
#content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: 32px 40px;
}

#page-container {
  max-width: var(--content-max-width);
  margin: 0 auto;
}

/* ===== 타이포그래피 ===== */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--gold);
}

.page-title {
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 8px;
  letter-spacing: 0.05em;
}

.page-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-size: 1.3rem;
  margin: 32px 0 16px;
  padding-left: 12px;
  border-left: 3px solid var(--gold);
}

/* ===== 모바일 햄버거 ===== */
#menu-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
}

#menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--gold);
  transition: all 0.3s ease;
}

#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 90;
}

/* ===== 모달 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-modal);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.modal-overlay.hidden {
  display: none;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--gold);
}

/* ===== 플레이스홀더 ===== */
.placeholder-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  background: var(--bg-card);
}

.placeholder-section .placeholder-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.6;
}

.placeholder-section .placeholder-text {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.placeholder-section .placeholder-phase {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ===== 공통 컴포넌트 ===== */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--gold-dim);
}

.btn.active {
  background: var(--navy);
  border-color: var(--gold);
  color: var(--gold);
}

/* ===== 반응형 ===== */
@media (max-width: 768px) {
  #sidebar {
    transform: translateX(-100%);
  }

  #sidebar.open {
    transform: translateX(0);
  }

  #menu-toggle {
    display: flex;
  }

  #sidebar-overlay.visible {
    display: block;
  }

  #content {
    margin-left: 0;
    padding: 72px 16px 32px;
  }

  .page-title {
    font-size: 1.5rem;
  }

  .modal-content {
    padding: 20px;
    margin: 10px;
  }
}
