/* ===== CSS Variables ===== */
:root {
  --bg: #f8f9fa;
  --bg-elevated: #ffffff;
  --bg-sidebar: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #6c757d;
  --border: #e9ecef;
  --primary: #2563eb;
  --primary-light: #dbeafe;
  --accent: #0ea5e9;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --success: #22c55e;
  --success-bg: #f0fdf4;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --nav-width: 260px;
  --topbar-height: 56px;
  --transition: 0.25s ease;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg-elevated: #1e293b;
  --bg-sidebar: #1e293b;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --border: #334155;
  --primary: #60a5fa;
  --primary-light: #1e3a8a;
  --accent: #38bdf8;
  --warning: #fbbf24;
  --warning-bg: #451a03;
  --danger: #f87171;
  --danger-bg: #450a0a;
  --success: #4ade80;
  --success-bg: #064e3b;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.4);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "Noto Sans JP", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  transition: background var(--transition), color var(--transition);
}

/* ===== Topbar ===== */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-height);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  box-shadow: var(--shadow);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
}
.logo { width: 24px; height: 24px; color: var(--primary); }
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
#lang-select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.9rem;
  cursor: pointer;
  outline: none;
}
.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text);
  transition: background var(--transition);
}
.icon-btn:hover { background: var(--primary-light); }
.icon-btn svg { width: 18px; height: 18px; }
.mobile-only { display: none; }

/* ===== Layout ===== */
.layout {
  display: flex;
  padding-top: var(--topbar-height);
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--nav-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: fixed;
  top: var(--topbar-height); bottom: 0; left: 0;
  overflow-y: auto;
  padding: 20px 0;
  transition: transform var(--transition), background var(--transition);
}
.sidebar nav { padding: 0 12px; }
.nav-group { margin-bottom: 24px; }
.nav-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  padding: 0 12px 8px;
}
.nav-link {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.92rem;
  transition: all var(--transition);
  margin-bottom: 2px;
}
.nav-link:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

/* ===== Content ===== */
.content {
  flex: 1;
  margin-left: var(--nav-width);
  padding: 32px 40px;
  max-width: 860px;
}

.section { display: none; animation: fadeIn 0.3s ease; }
.section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

h1 { font-size: 1.8rem; margin-bottom: 8px; font-weight: 800; }
h2 { font-size: 1.35rem; margin-top: 28px; margin-bottom: 12px; font-weight: 700; color: var(--primary); }
h3 { font-size: 1.1rem; margin-top: 20px; margin-bottom: 8px; font-weight: 600; }
p { margin: 0 0 12px; }

/* ===== Cards ===== */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  transition: background var(--transition), border-color var(--transition);
}
.card-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-body p:last-child { margin-bottom: 0; }

/* ===== Alert Cards ===== */
.alert {
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.96rem;
}
.alert-icon { font-size: 1.3rem; flex-shrink: 0; line-height: 1.4; }
.alert-warning { background: var(--warning-bg); border-left: 4px solid var(--warning); color: var(--text); }
.alert-danger { background: var(--danger-bg); border-left: 4px solid var(--danger); color: var(--text); }
.alert-success { background: var(--success-bg); border-left: 4px solid var(--success); color: var(--text); }
.alert-info { background: var(--primary-light); border-left: 4px solid var(--primary); color: var(--text); }

/* ===== Steps ===== */
.steps { counter-reset: step; }
.step {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  align-items: flex-start;
}
.step-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem;
  flex-shrink: 0;
}
.step-body { flex: 1; }
.step-body h4 { margin: 0 0 4px; font-size: 1rem; }
.step-body p { margin: 0; color: var(--text-secondary); font-size: 0.95rem; }

/* ===== Code / Inline ===== */
code {
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "SF Mono", Monaco, Consolas, monospace;
  font-size: 0.9em;
}
pre {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 0.9rem;
}
pre code { background: none; color: inherit; padding: 0; }

/* ===== Step Image ===== */
.step-img {
  display: block;
  width: 100%;
  max-width: 720px;
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* ===== Placeholder Image ===== */
.img-placeholder {
  width: 100%;
  height: 180px;
  background: var(--bg);
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 10px;
}

/* ===== Platform Tabs ===== */
.platform-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.platform-tab {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all var(--transition);
}
.platform-tab:hover { border-color: var(--primary); color: var(--primary); }
.platform-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== Footer ===== */
.site-footer {
  text-align: center;
  padding: 24px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-left: var(--nav-width);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .mobile-only { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    z-index: 90;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .content { margin-left: 0; padding: 20px; max-width: 100%; }
  .site-footer { margin-left: 0; }
  h1 { font-size: 1.5rem; }
}

@media (max-width: 480px) {
  .content { padding: 16px; }
  .card { padding: 16px; }
  .topbar { padding: 0 12px; }
}

/* ===== Print ===== */
@media print {
  .topbar, .sidebar, .site-footer, .icon-btn, #menu-toggle { display: none !important; }
  .content { margin-left: 0; padding: 0; }
  .section { display: block !important; }
}
