/* ========================================
   TAEON Onboarding - Kakao Style Theme
   ======================================== */

:root {
  /* Kakao Colors */
  --kakao-yellow: #FEE500;
  --kakao-yellow-hover: #F5DC00;
  --kakao-brown: #3C1E1E;
  --kakao-black: #191919;
  
  /* Background */
  --bg-primary: #FFFFFF;
  --bg-secondary: #F9F9F9;
  --bg-tertiary: #F2F2F2;
  --bg-card: #FFFFFF;
  
  /* Text */
  --text-primary: #191919;
  --text-secondary: #666666;
  --text-muted: #999999;
  --text-on-yellow: #3C1E1E;
  
  /* Accent */
  --accent: #FEE500;
  --accent-hover: #F5DC00;
  --accent-light: #FFF9CC;
  
  /* Border */
  --border-color: #E5E5E5;
  --border-light: #F0F0F0;
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  
  /* Spacing */
  --sidebar-width: 260px;
  --header-height: 56px;
  --toc-width: 200px;
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

/* Dark Mode */
[data-theme="dark"] {
  --bg-primary: #1A1A1A;
  --bg-secondary: #242424;
  --bg-tertiary: #2D2D2D;
  --bg-card: #1E1E1E;
  
  --text-primary: #FFFFFF;
  --text-secondary: #B3B3B3;
  --text-muted: #808080;
  
  --accent: #FEE500;
  --accent-hover: #F5DC00;
  --accent-light: rgba(254, 229, 0, 0.15);
  
  --border-color: #333333;
  --border-light: #2A2A2A;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* ========================================
   Reset & Base
   ======================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--bg-secondary);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--kakao-brown);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--kakao-black);
}

/* ========================================
   Login Page
   ======================================== */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #FFF9CC 0%, #FFFFFF 50%, #F9F9F9 100%);
  padding: 20px;
}

.login-container {
  width: 100%;
  max-width: 400px;
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo-icon {
  width: 72px;
  height: 72px;
  background: var(--kakao-yellow);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--kakao-brown);
  margin: 0 auto 16px;
  box-shadow: 0 4px 12px rgba(254, 229, 0, 0.4);
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.login-logo p {
  font-size: 14px;
  color: var(--text-secondary);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 15px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: all 0.2s;
  font-family: inherit;
}

.form-input:focus {
  outline: none;
  border-color: var(--kakao-yellow);
  background: var(--bg-primary);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.login-error {
  background: #FFF0F0;
  border: 1px solid #FFD0D0;
  color: #D93025;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  display: none;
}

.login-error.show {
  display: block;
}

.login-btn {
  margin-top: 8px;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  background: var(--kakao-yellow);
  color: var(--kakao-brown);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.login-btn:hover {
  background: var(--kakao-yellow-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(254, 229, 0, 0.4);
}

.login-btn:active {
  transform: translateY(0);
}

.login-help {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}

.login-help p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.test-accounts {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 13px;
}

.test-accounts code {
  font-family: 'SF Mono', Monaco, monospace;
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-primary);
}

/* ========================================
   App Layout
   ======================================== */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ========================================
   Sidebar
   ======================================== */

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-close {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.sidebar-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.sidebar-overlay.show {
  display: block;
  opacity: 1;
}

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

.sidebar-logo-icon {
  width: 44px;
  height: 44px;
  background: var(--kakao-yellow);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--kakao-brown);
}

.sidebar-logo-text h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar-logo-text span {
  font-size: 12px;
  color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}

.nav-section {
  margin-bottom: 4px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 13px;
  font-weight: 500;
}

.nav-item:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--kakao-brown);
  font-weight: 600;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.6;
}

.nav-item.active svg {
  opacity: 1;
}

.nav-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-group {
  margin-bottom: 2px;
}

.nav-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 13px;
  font-weight: 500;
}

.nav-group-header:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.nav-group-header svg {
  width: 14px;
  height: 14px;
  transition: transform 0.2s;
  opacity: 0.5;
}

.nav-group.collapsed .nav-group-header svg {
  transform: rotate(-90deg);
}

.nav-group-items {
  padding-left: 8px;
  overflow: hidden;
  transition: all 0.2s;
}

.nav-group.collapsed .nav-group-items {
  display: none;
}

.nav-group-items .nav-item {
  font-size: 13px;
  padding: 8px 12px;
  color: var(--text-secondary);
}

/* Nav Children (Chapter 목록) */
.nav-children {
  display: none;
  padding-left: 24px;
  margin-top: 2px;
}

.nav-children.show {
  display: block;
}

.nav-child {
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  margin-bottom: 1px;
  border-left: 2px solid transparent;
  margin-left: 4px;
}

.nav-child:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.nav-child.active {
  color: var(--kakao-brown);
  background: var(--accent-light);
  border-left-color: var(--kakao-yellow);
  font-weight: 500;
}

/* Nav Arrow */
.nav-arrow {
  flex-shrink: 0;
  opacity: 0.5;
  transition: transform 0.2s ease;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-light);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--kakao-yellow);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--kakao-brown);
  flex-shrink: 0;
}

.user-details {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* Sidebar Footer Buttons */
.sidebar-footer-btns {
  display: flex;
  gap: 6px;
}

.sidebar-footer-btns .btn {
  flex: 1;
  padding: 8px 10px;
  font-size: 12px;
}

.sidebar-footer-btns .btn svg {
  width: 14px;
  height: 14px;
}

/* ========================================
   Main Content
   ======================================== */

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ========================================
   Header
   ======================================== */

.header {
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
}

.menu-toggle:hover {
  background: var(--bg-secondary);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.breadcrumb a {
  color: var(--text-muted);
}

.breadcrumb a:hover {
  color: var(--text-primary);
}

.breadcrumb-sep {
  color: var(--text-muted);
}

.breadcrumb span:last-child {
  color: var(--text-primary);
  font-weight: 500;
}

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

.search-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  transition: all 0.15s;
}

.search-btn:hover {
  border-color: var(--kakao-yellow);
  background: var(--bg-primary);
}

.search-btn kbd {
  font-size: 11px;
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: inherit;
}

/* Search Box */
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  transition: all 0.15s;
}

.search-box:hover {
  border-color: var(--kakao-yellow);
  background: var(--bg-primary);
}

.search-box kbd {
  font-size: 11px;
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: inherit;
}

/* ========================================
   Article Content
   ======================================== */

.content-wrapper {
  display: flex;
  flex: 1;
  justify-content: center;
  padding: 0 24px;
  padding-right: 240px; /* TOC 영역 확보 */
}

.content {
  flex: 1;
  max-width: 760px;
  padding: 32px 0;
}

.article-container {
  flex: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px;
}

.article-header {
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}

.article-badge {
  display: inline-block;
  padding: 4px 10px;
  background: var(--accent-light);
  color: var(--kakao-brown);
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
  margin-bottom: 12px;
}

.article-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 12px;
}

.article-description {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.article-content {
  color: var(--text-primary);
}

.article-content h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 36px 0 16px;
  padding-top: 20px;
  padding-bottom: 8px;
  border-top: 1px solid var(--border-color);
}

.article-content h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.article-content h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 24px 0 10px;
}

.article-content p {
  margin-bottom: 16px;
  line-height: 1.8;
}

.article-content ul,
.article-content ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.article-content li {
  margin-bottom: 8px;
  line-height: 1.7;
}

.article-content strong {
  font-weight: 600;
  color: var(--text-primary);
}

/* Info Boxes */
.info-box {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin: 20px 0;
  border-left: 4px solid;
}

.info-box.tip {
  background: #F0FDF4;
  border-color: #22C55E;
}

.info-box.warning {
  background: #FFFBEB;
  border-color: #F59E0B;
}

.info-box.important {
  background: #FFF9CC;
  border-color: var(--kakao-yellow);
}

.info-box-title {
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 14px;
}

.info-box.tip .info-box-title { color: #16A34A; }
.info-box.warning .info-box-title { color: #D97706; }
.info-box.important .info-box-title { color: var(--kakao-brown); }

.info-box p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}

/* Tables */
.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 14px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.article-content th,
.article-content td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.article-content th {
  background: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.article-content tr:last-child td {
  border-bottom: none;
}

.article-content tbody tr:nth-child(even) {
  background: var(--bg-secondary);
}

.article-content tbody tr:hover td {
  background: var(--accent-light);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  transition: all 0.2s;
}

.stat-card:hover {
  border-color: var(--kakao-yellow);
  box-shadow: var(--shadow-md);
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--kakao-brown);
  margin-bottom: 4px;
}

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

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: all 0.2s;
}

.content-card:hover {
  border-color: var(--kakao-yellow);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.content-card h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.content-card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.6;
}

/* Code */
.article-content code {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 13px;
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--kakao-brown);
}

.article-content pre {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--border-color);
}

.article-content pre code {
  background: none;
  padding: 0;
}

/* ========================================
   Table of Contents (Right Sidebar)
   ======================================== */

/* TOC (Table of Contents) - Right Side Fixed */
.toc {
  position: fixed;
  right: 24px;
  top: calc(var(--header-height) + 32px);
  width: 200px;
  max-height: calc(100vh - var(--header-height) - 64px);
  overflow-y: auto;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.toc-container {
  width: var(--toc-width);
  flex-shrink: 0;
  padding: 32px 20px 32px 0;
  position: sticky;
  top: var(--header-height);
  height: fit-content;
  max-height: calc(100vh - var(--header-height));
  overflow-y: auto;
}

.toc-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  padding-left: 12px;
}

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

.toc-item {
  margin-bottom: 2px;
}

.toc-item a,
.toc-link {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  padding: 5px 10px 5px 12px;
  border-left: 2px solid var(--border-light);
  transition: all 0.15s;
  line-height: 1.4;
}

.toc-item a:hover,
.toc-link:hover {
  color: var(--text-primary);
  border-left-color: var(--border-color);
}

.toc-item a.active,
.toc-link.active {
  color: var(--kakao-brown);
  border-left-color: var(--kakao-yellow);
  font-weight: 600;
  background: var(--accent-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ========================================
   Navigation (Prev/Next)
   ======================================== */

.article-nav {
  display: flex;
  gap: 16px;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border-light);
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.nav-btn:hover {
  border-color: var(--kakao-yellow);
  box-shadow: var(--shadow-md);
}

.nav-btn.next {
  text-align: right;
}

.nav-btn-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.nav-btn-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ========================================
   Buttons
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--kakao-yellow);
  color: var(--kakao-brown);
}

.btn-primary:hover {
  background: var(--kakao-yellow-hover);
  box-shadow: 0 4px 12px rgba(254, 229, 0, 0.3);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--kakao-yellow);
}

.btn-danger {
  background: #FEE2E2;
  color: #DC2626;
  border: 1px solid #FECACA;
}

.btn-danger:hover {
  background: #FECACA;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.logout-btn {
  width: 100%;
  justify-content: center;
}

/* ========================================
   Search Modal
   ======================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 100px 20px 20px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.search-modal {
  width: 100%;
  max-width: 560px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.search-input-wrapper svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  background: none;
  font-size: 16px;
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-results {
  max-height: 400px;
  overflow-y: auto;
}

.search-result-item {
  display: block;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.15s;
}

.search-result-item:hover {
  background: var(--accent-light);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
  font-size: 14px;
}

.search-result-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

.search-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ========================================
   Admin Page
   ======================================== */

.admin-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 32px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.admin-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
}

.admin-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  overflow: hidden;
}

.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
}

.admin-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.admin-card-body {
  padding: 24px;
}

/* User List */
.user-list {
  list-style: none;
}

.user-list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s;
}

.user-list-item:last-child {
  border-bottom: none;
}

.user-list-item:hover {
  background: var(--bg-secondary);
}

.user-list-avatar {
  width: 42px;
  height: 42px;
  background: var(--kakao-yellow);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--kakao-brown);
  flex-shrink: 0;
}

.user-list-info {
  flex: 1;
  min-width: 0;
}

.user-list-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}

.user-list-email {
  font-size: 13px;
  color: var(--text-secondary);
}

.user-list-role {
  padding: 4px 10px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  border-radius: 20px;
}

.user-list-role.admin {
  background: var(--accent-light);
  color: var(--kakao-brown);
}

.user-list-actions {
  display: flex;
  gap: 8px;
}

/* Modal */
.modal {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}

.modal-close:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

.modal-body .form-group {
  margin-bottom: 16px;
}

.modal-body .form-group:last-child {
  margin-bottom: 0;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

/* ========================================
   Toast
   ======================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  font-size: 14px;
}

.toast.success {
  border-left: 4px solid #22C55E;
}

.toast.error {
  border-left: 4px solid #EF4444;
}

.toast.info {
  border-left: 4px solid var(--kakao-yellow);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ========================================
   Mobile Responsive
   ======================================== */

@media (max-width: 1024px) {
  .toc-container,
  .toc {
    display: none !important;
  }
  
  .content-wrapper {
    padding-right: 24px;
  }
  
  .article-container {
    max-width: none;
    padding: 32px 24px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.show {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  
  .sidebar-close {
    display: flex;
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .menu-toggle {
    display: flex;
  }
  
  .header {
    padding: 0 16px;
  }
  
  .search-btn span,
  .search-btn kbd,
  .search-box span,
  .search-box kbd {
    display: none;
  }
  
  .search-box {
    padding: 8px;
    min-width: auto;
    gap: 0;
  }
  
  .article-container {
    padding: 24px 16px;
  }
  
  .article-title {
    font-size: 26px;
  }
  
  .article-nav {
    flex-direction: column;
  }
  
  .admin-container {
    padding: 24px 16px;
  }
  
  .admin-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .user-list-item {
    flex-wrap: wrap;
  }
  
  .user-list-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 8px;
  }
}

/* ========================================
   Utilities
   ======================================== */

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--text-primary); }
.text-accent { color: var(--kakao-brown); }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

/* ========================================
   Progress Tracker (진행률)
   ======================================== */

.progress-bar-container {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

.progress-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.progress-bar-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.progress-bar-percent {
  font-size: 12px;
  font-weight: 700;
  color: var(--kakao-brown);
}

[data-theme="dark"] .progress-bar-percent {
  color: var(--accent);
}

.progress-bar {
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--kakao-yellow);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.chapter-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.chapter-check:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

.chapter-check.completed {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--kakao-brown);
}

[data-theme="dark"] .chapter-check.completed {
  color: var(--accent);
}

.nav-item .check-icon {
  margin-left: auto;
  color: #22C55E;
  opacity: 0;
  transition: opacity 0.2s;
}

.nav-item.completed .check-icon {
  opacity: 1;
}

/* ========================================
   Bookmarks (북마크)
   ======================================== */

.bookmark-btn,
.theme-toggle,
.print-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.bookmark-btn:hover,
.theme-toggle:hover,
.print-btn:hover {
  background: var(--accent-light);
  color: var(--kakao-brown);
}

[data-theme="dark"] .bookmark-btn:hover,
[data-theme="dark"] .theme-toggle:hover,
[data-theme="dark"] .print-btn:hover {
  color: var(--accent);
}

.bookmark-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--kakao-brown);
}

.bookmarks-panel {
  position: fixed;
  top: 0;
  right: -320px;
  width: 320px;
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border-color);
  z-index: 200;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}

.bookmarks-panel.show {
  right: 0;
}

.bookmarks-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bookmarks-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.bookmarks-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.bookmark-item {
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.bookmark-item:hover {
  background: var(--accent-light);
}

.bookmark-item-title {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 4px;
}

.bookmark-item-badge {
  font-size: 11px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========================================
   Quiz (퀴즈)
   ======================================== */

.quiz-container {
  background: var(--bg-secondary);
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin: 32px 0;
}

.quiz-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.quiz-icon {
  width: 48px;
  height: 48px;
  background: var(--accent);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.quiz-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.quiz-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

.quiz-question {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
}

.quiz-question-number {
  font-size: 12px;
  font-weight: 600;
  color: var(--kakao-brown);
  background: var(--accent-light);
  padding: 4px 10px;
  border-radius: 12px;
  display: inline-block;
  margin-bottom: 12px;
}

.quiz-question-text {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 16px;
  line-height: 1.6;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
}

.quiz-option:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

.quiz-option.selected {
  background: var(--accent-light);
  border-color: var(--accent);
}

.quiz-option.correct {
  background: #DCFCE7;
  border-color: #22C55E;
}

.quiz-option.incorrect {
  background: #FEE2E2;
  border-color: #EF4444;
}

.quiz-option-radio {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quiz-option.selected .quiz-option-radio {
  border-color: var(--accent);
  background: var(--accent);
}

.quiz-option.selected .quiz-option-radio::after {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--kakao-brown);
  border-radius: 50%;
}

.quiz-option-text {
  font-size: 14px;
  color: var(--text-primary);
}

.quiz-submit {
  margin-top: 20px;
  padding: 14px 28px;
  background: var(--accent);
  color: var(--kakao-brown);
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.quiz-submit:hover {
  background: var(--accent-hover);
}

.quiz-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.quiz-result {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  margin-top: 20px;
}

.quiz-result.passed {
  border-color: #22C55E;
  background: #F0FDF4;
}

.quiz-result.failed {
  border-color: #EF4444;
  background: #FEF2F2;
}

.quiz-result-score {
  font-size: 48px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.quiz-result-text {
  font-size: 16px;
  color: var(--text-secondary);
}

/* ========================================
   Glossary Tooltip (용어 팝업)
   ======================================== */

.glossary-term {
  border-bottom: 2px dotted var(--accent);
  cursor: help;
  position: relative;
}

.glossary-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  width: 280px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}

.glossary-term:hover .glossary-tooltip {
  opacity: 1;
  visibility: visible;
}

.glossary-tooltip-title {
  font-weight: 600;
  color: var(--kakao-brown);
  font-size: 13px;
  margin-bottom: 6px;
}

[data-theme="dark"] .glossary-tooltip-title {
  color: var(--accent);
}

.glossary-tooltip-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ========================================
   Search Highlight (검색 하이라이트)
   ======================================== */

.search-highlight {
  background: var(--accent);
  color: var(--kakao-brown);
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 500;
}

/* ========================================
   Admin Progress Dashboard
   ======================================== */

.progress-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.progress-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-user-avatar {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--kakao-brown);
  font-size: 14px;
}

.progress-user-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}

.progress-user-email {
  font-size: 12px;
  color: var(--text-muted);
}

.progress-stats {
  display: flex;
  gap: 24px;
}

.progress-stat {
  text-align: center;
}

.progress-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.progress-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.progress-card-body {
  padding: 16px 20px;
}

.progress-mini-bar {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.progress-mini-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s;
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
  .sidebar,
  .header,
  .toc,
  .nav-buttons,
  .chapter-check,
  .header-actions,
  .quiz-submit,
  .bookmarks-panel {
    display: none !important;
  }
  
  .main-content {
    margin-left: 0 !important;
  }
  
  .content-wrapper {
    padding: 0 !important;
  }
  
  .article {
    max-width: 100% !important;
    padding: 20px !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
}
