/* ==========================================================================
   AI Funnel Academy - Eye-Comfort Sleek Dark Mode Pretendard Theme
   ========================================================================== */

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

:root, [data-theme="dark"] {
  /* Default Eye-Comfort Charcoal Dark Palette */
  --bg-main: #0f0f10;
  --bg-sub: #17171a;
  --bg-hover: #222226;
  --border-color: #27272a;
  --border-dark: #3f3f46;

  --text-main: #e4e4e7;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;

  --accent-black: #ffffff;
  --accent-gray: #27272a;

  --font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --header-height: 56px;
  --sidebar-width: 290px;
  --toc-width: 210px;
  --content-max-width: 720px;
}

[data-theme="light"] {
  /* Clean Light Mode */
  --bg-main: #ffffff;
  --bg-sub: #f8f8fa;
  --bg-hover: #f1f1f5;
  --border-color: #e5e5eb;
  --border-dark: #111111;

  --text-main: #111111;
  --text-muted: #666666;
  --text-dim: #999999;

  --accent-black: #111111;
  --accent-gray: #f3f3f5;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.75;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.3); }

/* ==========================================================================
   Private Auth Passcode Overlay
   ========================================================================== */

.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 16, 0.95);
  backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.auth-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.auth-card {
  background: var(--bg-sub);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 100%;
  max-width: 380px;
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ==========================================================================
   Minimalist Dark Header
   ========================================================================== */

.app-header {
  height: var(--header-height);
  background: var(--bg-main);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 50;
  flex-shrink: 0;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-logo {
  font-size: 16px;
  font-weight: 900;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.brand-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-muted);
}

.progress-widget {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.progress-bar-container {
  width: 80px;
  height: 5px;
  background: var(--bg-hover);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--text-main);
  transition: width 0.3s ease;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-minimal {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-minimal:hover {
  background: var(--bg-hover);
  border-color: var(--text-main);
}

.btn-minimal-dark {
  background: var(--text-main);
  color: var(--bg-main);
  border: 1px solid var(--text-main);
}

.btn-minimal-dark:hover {
  opacity: 0.85;
}

/* ==========================================================================
   App Container & Sidebar Layout
   ========================================================================== */

.app-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

.sidebar {
  width: var(--sidebar-width);
  min-width: 160px;
  max-width: 800px;
  background: var(--bg-sub);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-header {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-box {
  position: relative;
  width: 100%;
}

.search-input {
  width: 100%;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  padding: 7px 10px 7px 30px;
  border-radius: 4px;
  color: var(--text-main);
  font-size: 12px;
  font-family: var(--font-family);
  outline: none;
}

.search-input:focus {
  border-color: var(--text-main);
}

.search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 12px;
}

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: 100%;
}

.category-chip {
  padding: 3px 8px;
  font-size: 11px;
  background: var(--bg-main);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-grow: 1;
  text-align: center;
}

.category-chip.active {
  background: var(--text-main);
  color: var(--bg-main);
  border-color: var(--text-main);
  font-weight: 700;
}

.lesson-list-container {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
}

.special-tab-group {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.special-tab-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 4px;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 3px;
  border: 1px solid var(--border-color);
  background: var(--bg-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.special-tab-item:hover {
  background: var(--bg-hover);
}

.special-tab-item.active {
  background: var(--text-main);
  color: var(--bg-main);
  border-color: var(--text-main);
}

.lesson-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 4px;
  margin-bottom: 3px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  min-width: 0;
}

.lesson-item:hover {
  background: var(--bg-hover);
}

.lesson-item.active {
  background: var(--bg-main);
  border-color: var(--border-color);
}

.lesson-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  width: 100%;
  min-width: 0;
}

.lesson-check {
  appearance: none;
  width: 14px;
  height: 14px;
  border: 1px solid var(--text-dim);
  border-radius: 3px;
  cursor: pointer;
  display: grid;
  place-content: center;
  flex-shrink: 0;
}

.lesson-check:checked {
  background: var(--text-main);
  border-color: var(--text-main);
}

.lesson-check:checked::before {
  content: "✓";
  color: var(--bg-main);
  font-size: 9px;
  font-weight: bold;
}

.lesson-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  width: 18px;
  flex-shrink: 0;
}

.lesson-title-text {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.lesson-item.active .lesson-title-text {
  color: var(--text-main);
  font-weight: 700;
}

.lesson-item.completed .lesson-title-text {
  text-decoration: line-through;
  opacity: 0.4;
}

/* ==========================================================================
   Splitter / Resizers (Left & Right)
   ========================================================================== */

.resizer {
  position: relative;
  width: 6px;
  flex-shrink: 0;
  cursor: col-resize;
  user-select: none;
  z-index: 30;
  background-color: transparent;
  transition: background-color 0.15s ease;
}

/* Wider invisible grabbing hit area */
.resizer::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -5px;
  right: -5px;
  z-index: 2;
  cursor: col-resize;
}

/* Visual divider line */
.resizer::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2px;
  width: 2px;
  background-color: var(--border-color);
  transition: background-color 0.2s ease, width 0.2s ease, left 0.2s ease, box-shadow 0.2s ease;
}

.resizer:hover::after,
.resizer.is-resizing::after {
  background-color: var(--text-main);
  width: 3px;
  left: 1.5px;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

[data-theme="light"] .resizer:hover::after,
[data-theme="light"] .resizer.is-resizing::after {
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.25);
}

.resizer-left {
  height: calc(100vh - var(--header-height));
}

.resizer-right {
  position: sticky;
  top: 0;
  height: calc(100vh - var(--header-height));
}

body.is-resizing {
  user-select: none !important;
  cursor: col-resize !important;
}

body.is-resizing * {
  user-select: none !important;
  cursor: col-resize !important;
}

/* ==========================================================================
   Main Content Column & TOC
   ========================================================================== */

.main-content {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-main);
  display: flex;
  position: relative;
  min-width: 0;
}

.content-center-column {
  flex: 1;
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 40px 24px 100px;
  min-width: 280px;
}

/* Right TOC Sidebar */
.toc-sidebar {
  width: var(--toc-width);
  min-width: 140px;
  max-width: 600px;
  padding: 40px 16px;
  position: sticky;
  top: 0;
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  flex-shrink: 0;
}

.toc-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.toc-item {
  font-size: 11.5px;
  color: var(--text-muted);
  text-decoration: none;
  line-height: 1.4;
  padding-left: 8px;
  border-left: 1.5px solid transparent;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toc-item:hover { color: var(--text-main); }
.toc-item.active {
  color: var(--text-main);
  border-left-color: var(--text-main);
  font-weight: 700;
}

.toc-item.depth-3 { padding-left: 16px; font-size: 11px; }

/* Blog Header */
.blog-header {
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.blog-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.blog-category-tag {
  font-weight: 800;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.blog-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

/* Minimal Asset Banner */
.asset-banner-card {
  background: var(--bg-sub);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.asset-banner-title { font-size: 13px; font-weight: 700; color: var(--text-main); }
.asset-banner-desc { font-size: 11.5px; color: var(--text-muted); }

/* ==========================================================================
   Minimal Dark Markdown Body & Prompt Callout Box
   ========================================================================== */

.markdown-body {
  color: var(--text-main);
  font-size: 16px;
  line-height: 1.8;
  letter-spacing: -0.01em;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  color: var(--text-main);
  font-weight: 800;
  margin-top: 1.8em;
  margin-bottom: 0.6em;
  line-height: 1.3;
}

.markdown-body h1 { font-size: 22px; border-bottom: 1px solid var(--border-color); padding-bottom: 6px; }
.markdown-body h2 { font-size: 18px; margin-top: 1.6em; }
.markdown-body h3 { font-size: 15px; }

.markdown-body p { margin-bottom: 1.3em; }
.markdown-body ul, .markdown-body ol { padding-left: 1.4em; margin-bottom: 1.3em; }
.markdown-body li { margin-bottom: 0.4em; }

.markdown-body blockquote {
  border-left: 2px solid var(--text-main);
  background: var(--bg-sub);
  padding: 12px 16px;
  border-radius: 4px;
  margin-bottom: 1.4em;
  color: var(--text-muted);
}

.markdown-body blockquote blockquote {
  border-left: none;
  background: transparent;
  padding: 0;
  margin: 0;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.4em;
  font-size: 13px;
}

.markdown-body th, .markdown-body td {
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  text-align: left;
}

.markdown-body th {
  background: var(--bg-sub);
  color: var(--text-main);
  font-weight: 700;
}

/* Eye-Comfort Dark Prompt Box */
.minimal-prompt-box {
  background: var(--bg-sub);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  margin-bottom: 1.5em;
  overflow: hidden;
}

.minimal-prompt-header {
  padding: 6px 14px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-main);
}

.minimal-prompt-label {
  font-size: 11px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.minimal-copy-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
}

.minimal-copy-btn:hover {
  background: var(--text-main);
  color: var(--bg-main);
}

.minimal-prompt-body pre {
  padding: 14px 16px;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-main);
}

/* Personal Notes & Navigation */
.blog-notes-section {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.blog-notes-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.blog-notes-textarea {
  width: 100%;
  min-height: 80px;
  background: var(--bg-sub);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 10px;
  color: var(--text-main);
  font-size: 13px;
  font-family: var(--font-family);
  outline: none;
  resize: vertical;
}

.blog-notes-textarea:focus {
  border-color: var(--text-main);
}

.blog-bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
}

/* Modal & Toast */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal-card {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  width: 100%;
  max-width: 950px;
  height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 14px; font-weight: 700; }
.modal-close { background: transparent; border: none; font-size: 18px; cursor: pointer; color: var(--text-main); }
.modal-body { flex: 1; overflow: hidden; }
.iframe-sandbox { width: 100%; height: 100%; border: none; }

.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 300; }
.toast {
  background: var(--text-main);
  color: var(--bg-main);
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
