@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

/* tor-ai UI refresh — Clear Neutral Glassmorphism Theme */
:root {
  --tor-bg: #07090e;
  --tor-panel: rgba(14, 16, 22, 0.38);
  --tor-panel-2: rgba(22, 25, 34, 0.48);
  --tor-line: rgba(255, 255, 255, 0.12);
  --tor-line-strong: rgba(255, 255, 255, 0.22);
  --tor-text: #f4f7fb;
  --tor-muted: #94a3b8;
  --tor-accent: #ffffff;
  --tor-accent-2: #e2e8f0;
  --tor-danger: #f87171;
  --tor-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.45);
  --tor-radius: 18px;
}

html {
  background: linear-gradient(180deg, rgba(8, 10, 16, 0.22) 0%, rgba(8, 10, 16, 0.50) 100%),
              url('/static/background.jpg') center / cover no-repeat fixed !important;
  min-height: 100%;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif !important;
  background: transparent !important;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--tor-text);
  overflow-x: clip;
}

body::before {
  display: none !important;
}

/* Glassmorphism System - Pure Neutral Glass */
.glass-nav, nav {
  background: rgba(10, 14, 22, 0.22) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), inset 0 -1px 0 rgba(255, 255, 255, 0.05) !important;
}

.glass-panel {
  background: rgba(12, 16, 26, 0.28) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

.glass-card {
  background: rgba(16, 20, 28, 0.35) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: 1px solid rgba(255, 255, 255, 0.09) !important;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-card:hover {
  background: rgba(26, 30, 42, 0.50) !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
  box-shadow: 0 18px 45px -8px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.16) !important;
  transform: translateY(-2px);
}

.glass-input {
  background: rgba(8, 10, 15, 0.45) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

.glass-pill {
  background: rgba(255, 255, 255, 0.06) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  transition: all 0.2s ease;
}

.glass-pill:hover {
  background: rgba(255, 255, 255, 0.14) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
}

.glass-admin {
  background: rgba(220, 38, 38, 0.18) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: 1px solid rgba(248, 113, 113, 0.35) !important;
  color: #fca5a5 !important;
  box-shadow: 0 4px 20px -2px rgba(220, 38, 38, 0.25) !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-admin:hover {
  background: rgba(220, 38, 38, 0.30) !important;
  border-color: rgba(248, 113, 113, 0.6) !important;
  color: #ffffff !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px -2px rgba(220, 38, 38, 0.4) !important;
}

/* Nav & Layout */
nav {
  height: 64px !important;
  padding-inline: clamp(16px, 3vw, 44px) !important;
  border-color: var(--tor-line) !important;
  background: rgba(10, 14, 22, 0.22) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
}

nav .w-10 {
  width: 36px !important;
  height: 36px !important;
  border-radius: 11px !important;
  background: rgba(255, 255, 255, 0.12) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
}

nav .text-xl {
  font-size: 1rem !important;
  letter-spacing: 0.08em !important;
  font-weight: 800;
}

#sidebar {
  width: 280px !important;
  background: rgba(10, 14, 22, 0.22) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15) !important;
}

#sidebar > div {
  border-color: var(--tor-line) !important;
}

#sidebar h2 {
  color: #e2e8f0 !important;
  font-weight: 700;
  letter-spacing: -0.01em;
}

#session-list {
  padding: 10px !important;
}

#session-list > div {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 6px 10px !important;
  transition: all 0.18s ease;
}

#session-list > div:hover {
  background: rgba(255, 255, 255, 0.07) !important;
  border-color: var(--tor-line);
}

#session-list > div:has(button.bg-white\/10), #session-list > div.bg-white\/10 {
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
}

#session-list button {
  min-width: 0;
}

#session-list .session-title-text {
  color: #e2e8f0;
  font-size: 0.88rem;
  line-height: 1.4;
}

/* 3-Depth Hierarchical Tree Navigation */
.tree-d1-group {
  margin-bottom: 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  transition: all 0.2s ease;
}

.tree-d1-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.tree-d1-header:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
}

.tree-d1-header .chevron {
  transition: transform 0.2s ease;
  font-size: 0.72rem;
  color: #94a3b8;
}

.tree-d1-header.open .chevron {
  transform: rotate(90deg);
}

.tree-d2-group {
  margin: 3px 4px 4px 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  padding-left: 6px;
}

.tree-d2-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  transition: all 0.18s ease;
}

.tree-d2-header:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f8fafc;
}

.tree-d2-header .chevron {
  transition: transform 0.2s ease;
  font-size: 0.68rem;
  color: #64748b;
}

.tree-d2-header.open .chevron {
  transform: rotate(90deg);
}

.tree-d3-group {
  margin: 2px 2px 4px 6px;
  border-left: 1px dashed rgba(255, 255, 255, 0.1);
  padding-left: 6px;
}

.tree-d3-header {
  font-size: 0.72rem;
  font-weight: 600;
  color: #94a3b8;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.tree-session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 5px 8px;
  margin: 2px 0;
  border-radius: 8px;
  font-size: 0.78rem;
  color: #cbd5e1;
  transition: all 0.18s ease;
  border: 1px solid transparent;
}

.tree-session-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.15);
}

.tree-session-item.active {
  background: rgba(56, 189, 248, 0.18) !important;
  border-color: rgba(56, 189, 248, 0.45) !important;
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.15);
}

.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 6px;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}

.badge-in-progress {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fbbf24;
}

.badge-uncategorized {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

main {
  padding: clamp(14px, 2.5vw, 30px) !important;
}

main > div {
  max-width: 1060px !important;
  gap: 16px !important;
}

@font-face {
  font-family: 'LINESeedKR-Bd';
  src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/noonfonts_11-01@1.0/LINESeedKR-Bd.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'GmarketSansBold';
  src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/noonfonts_2001@1.1/GmarketSansBold.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

main h1, .hero-title {
  font-family: 'LINESeedKR-Bd', 'GmarketSansBold', 'Pretendard', -apple-system, sans-serif !important;
  font-size: clamp(1.5rem, 2.6vw, 2.3rem) !important;
  letter-spacing: -0.025em !important;
  line-height: 1.35 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

.hero-word-ask {
  background: linear-gradient(135deg, #a5f3fc 0%, #38bdf8 55%, #0284c7 100%);
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  filter: drop-shadow(0 2px 10px rgba(56, 189, 248, 0.35));
  display: inline-block;
}

.hero-word-make {
  background: linear-gradient(135deg, #fed7aa 0%, #fb923c 50%, #f43f5e 100%);
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  filter: drop-shadow(0 2px 10px rgba(244, 63, 94, 0.35));
  display: inline-block;
}

.hero-word-check {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  text-shadow: 0 2px 12px rgba(255, 255, 255, 0.35), 0 4px 20px rgba(0, 0, 0, 0.5);
  display: inline-block;
}

.hero-word-ai {
  background: linear-gradient(135deg, #e879f9 0%, #c084fc 45%, #818cf8 100%);
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  filter: drop-shadow(0 2px 14px rgba(192, 132, 252, 0.5));
  display: inline-block;
  font-weight: 900 !important;
}

main h1 + p {
  color: var(--tor-muted) !important;
  font-size: 0.85rem !important;
  line-height: 1.6 !important;
  margin-top: 4px;
}

.quick-prompt {
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--tor-line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.78rem;
  transition: all 0.2s ease;
}

.quick-prompt:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-1px);
}

/* Chat Messages & Dialog Bubbles */
.glass {
  background: rgba(12, 15, 22, 0.38) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
}

#chat-messages {
  padding: clamp(10px, 2vw, 22px) !important;
  scrollbar-width: thin;
}

#chat-messages > div {
  animation: tor-in 0.2s ease-out both;
}

#chat-messages [data-role="assistant"], #chat-messages > div > .bg-white\/10 {
  background: rgba(16, 20, 28, 0.40) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.3) !important;
  color: #edf3ff !important;
  line-height: 1.82 !important;
  padding: 18px 22px !important;
  border-radius: 18px !important;
}

#chat-messages [data-role="user"] {
  background: rgba(255, 255, 255, 0.12) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  line-height: 1.75 !important;
  padding: 14px 20px !important;
  border-radius: 18px !important;
}

#chat-messages + form, #chat-form {
  background: rgba(8, 10, 15, 0.45) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1px solid var(--tor-line-strong);
  border-radius: 18px;
  padding: 6px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.3);
}

#chat-input {
  border: 0 !important;
  background: transparent !important;
  color: #f8fafc !important;
  padding: 13px 115px 13px 18px !important;
  font-size: 0.95rem;
  line-height: 1.5;
}

#chat-input:focus {
  outline: none !important;
}

#chat-submit {
  top: 6px !important;
  right: 6px !important;
  bottom: 6px !important;
  border-radius: 14px !important;
  background: #ffffff !important;
  color: #0f172a !important;
  font-weight: 800 !important;
  padding-inline: 20px !important;
  box-shadow: 0 4px 14px rgba(255, 255, 255, 0.15);
  transition: all 0.2s ease;
}

#chat-submit:hover:not(:disabled) {
  background: #f1f5f9 !important;
  color: #000000 !important;
  transform: translateY(-1px);
}

#chat-submit:disabled {
  opacity: 0.45;
  background: #334155 !important;
  color: #94a3b8 !important;
  box-shadow: none;
}

/* Typography & Line Spacing Enhancements (Addresses font overlap and cramped lines) */
.markdown-content {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 0.95rem;
  line-height: 1.82 !important;
  color: #e2e8f0;
  letter-spacing: -0.012em;
  word-break: break-word;
}

.markdown-content p {
  margin-top: 0.5rem;
  margin-bottom: 0.85rem;
  line-height: 1.82 !important;
}

.markdown-content h1, .markdown-content h2, .markdown-content h3, .markdown-content h4 {
  color: #f8fafc;
  font-weight: 700;
  line-height: 1.45 !important;
  letter-spacing: -0.025em;
}

.markdown-content h1 { font-size: 1.45rem; margin-top: 1.4rem; margin-bottom: 0.7rem; }
.markdown-content h2 { font-size: 1.25rem; margin-top: 1.2rem; margin-bottom: 0.6rem; border-bottom: 1px solid rgba(255, 255, 255, 0.1); padding-bottom: 0.35rem; }
.markdown-content h3 { font-size: 1.1rem; margin-top: 1rem; margin-bottom: 0.5rem; }

.markdown-content ul, .markdown-content ol {
  margin-top: 0.4rem;
  margin-bottom: 0.85rem;
  padding-left: 1.4rem;
  line-height: 1.78 !important;
}

.markdown-content ul { list-style-type: disc !important; }
.markdown-content ol { list-style-type: decimal !important; }

.markdown-content li {
  margin-bottom: 0.35rem;
  line-height: 1.78 !important;
}

.markdown-content li > p {
  margin-top: 0.2rem;
  margin-bottom: 0.3rem;
}

.markdown-content blockquote {
  border-left: 3px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.65rem 1rem;
  border-radius: 0 0.5rem 0.5rem 0;
  margin: 0.85rem 0;
  color: #e2e8f0;
  line-height: 1.75 !important;
}

.markdown-content code {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.15rem 0.4rem;
  border-radius: 0.3rem;
  font-family: 'SF Mono', SFMono-Regular, ui-monospace, monospace;
  font-size: 0.88em;
  color: #ffffff;
  font-weight: 600;
}

.markdown-content pre {
  background: rgba(5, 10, 20, 0.7) !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  overflow-x: auto;
  margin: 0.85rem 0;
  line-height: 1.6 !important;
}

.markdown-content pre code {
  background: transparent !important;
  padding: 0;
  color: inherit;
}

.markdown-content hr {
  border: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
  margin: 1.25rem 0;
}

/* YouTube Card & Progress Stages Styling */
.yt-card {
  background: rgba(16, 20, 28, 0.42) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: var(--tor-radius) !important;
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.5) !important;
  padding: 20px !important;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.yt-card h3, .yt-card h4 {
  letter-spacing: -0.02em;
}

.yt-stage-list {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.35rem !important;
  width: 100% !important;
  margin-top: 0.4rem !important;
}

.yt-stage-list > div {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 0.6rem !important;
  padding: 6px 12px !important;
  border-left: 3px solid rgba(255, 255, 255, 0.35) !important;
  margin: 0 !important;
  background: rgba(255, 255, 255, 0.035) !important;
  border-radius: 0 8px 8px 0 !important;
  line-height: 1.5 !important;
}

.yt-clip-grid {
  gap: 10px !important;
}

.yt-clip-card {
  background: rgba(255, 255, 255, 0.045) !important;
  border: 1px solid var(--tor-line) !important;
  border-radius: 13px !important;
  padding: 11px !important;
}

#upload-form input, #api-settings-body input {
  border-color: var(--tor-line) !important;
  background: rgba(0, 0, 0, 0.3) !important;
  border-radius: 10px !important;
}

#upload-form button, #btn-generate-key {
  border: 1px solid var(--tor-line) !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

@keyframes tor-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 767px) {
  body { min-height: 100dvh !important; height: 100dvh !important; }
  nav { height: 58px !important; }
  #sidebar { width: min(86vw, 310px) !important; }
  main { padding: 10px !important; }
  main > div { gap: 10px !important; }
  main h1 + p { max-width: 280px; margin-inline: auto; line-height: 1.45; }
  #chat-messages { padding: 6px !important; }
  #chat-messages [data-role="assistant"], #chat-messages [data-role="user"] { max-width: 94% !important; padding: 12px 16px !important; }
  .yt-card { padding: 14px !important; }
  .yt-card video { max-height: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   Auto VOC Board & AI Review System Styles
   ========================================================================== */
.voc-card {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.voc-card:hover {
  border-color: rgba(34, 211, 238, 0.25);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}
.voc-review-box {
  background: rgba(8, 14, 28, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0.75rem;
}
.voc-tab-btn.active {
  background: rgba(6, 182, 212, 0.2) !important;
  color: #67e8f9 !important;
  border-color: rgba(34, 211, 238, 0.4) !important;
}
