/* base.css — Notion-inspired design tokens + Bootstrap overrides */

/* ── Fonts ──
   Inter: 라틴/키릴 문자 커버리지가 넓고(우즈베크어 oʻ·gʻ 등 수정 문자 포함) 대시보드형 UI에
   적합한 산세리프 — 언어전환 UI(EN 기본/UZ 선택) 도입에 맞춰 1순위 폰트로 채택.
   Noto Sans KR: 2단계 번역 전까지 남아있는 한국어 라벨을 위한 폴백으로 유지(문자 단위 자동
   폴백이라 성능 영향 없음). 상세 근거는 docs/visual-guide.md 참고. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Noto+Sans+KR:wght@400;500;600;700&display=swap');

/* ── Design Tokens ── */
:root {
  /* Colors — Brand */
  --color-primary: #4f46e5;
  --color-primary-active: #005bab;
  --color-secondary: #312e81;
  --color-on-primary: #ffffff;

  /* Colors — Surface */
  --color-canvas: #ffffff;
  --color-canvas-soft: #f6f5f4;
  --color-surface: #ffffff;
  --color-hairline: #e6e6e6;

  /* Colors — Text */
  --color-ink: #000000;
  --color-ink-secondary: #31302e;
  --color-ink-muted: #615d59;
  --color-ink-faint: #5c5752;

  /* Colors — Accent (decorative only) */
  --color-accent-sky: #62aef0;
  --color-accent-purple: #d6b6f6;
  --color-accent-pink: #ff64c8;
  --color-accent-orange: #dd5b00;
  --color-accent-teal: #2a9d99;
  --color-accent-green: #1aae39;

  /* Spacing */
  --space-xxs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 1.75rem;
  --space-xxl: 2rem;

  /* Rounded */
  --rounded-xs: 0.25rem;
  --rounded-sm: 0.3125rem;
  --rounded-md: 0.5rem;
  --rounded-lg: 0.75rem;
  --rounded-xl: 1rem;
  --rounded-full: 9999px;

  /* Progress bar heights */
  --progress-height-sm: 4px;
  --progress-height-md: 6px;
  --progress-height-lg: 8px;

  /* Elevation — soft layered shadows */
  --shadow-soft: 0 0.011rem 0.065rem rgba(0,0,0,0.01),
                 0 0.05rem 0.183rem rgba(0,0,0,0.02),
                 0 0.127rem 0.49rem rgba(0,0,0,0.027),
                 0 0.25rem 1.125rem rgba(0,0,0,0.04);
  --shadow-elevated: 0 0.011rem 0.065rem rgba(0,0,0,0.01),
                     0 0.05rem 0.183rem rgba(0,0,0,0.02),
                     0 0.127rem 0.49rem rgba(0,0,0,0.027),
                     0 0.25rem 1.125rem rgba(0,0,0,0.04),
                     0 1.4375rem 3.25rem rgba(0,0,0,0.05);
}

/* ── Bootstrap Overrides ── */

/* Base font size */
html {
  font-size: 16px;
}

/* ── Font-weight utility shorthands ── */
.fw-500 { font-weight: 500 !important; }
.fw-600 { font-weight: 600 !important; }
.fw-700 { font-weight: 700 !important; }

/* Scrollbar — thin, hidden until scroll */
* {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
*:hover, *:focus-within {
  scrollbar-color: rgba(0,0,0,0.2) transparent;
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; }
*:hover::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); }
*:focus-within::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); }

/* Typography */
body {
  font-family: 'Inter', 'Noto Sans KR', -apple-system, system-ui, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.7;
  color: var(--color-ink);
  background-color: var(--color-canvas-soft);
}

/* Links */
a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.15s;
}
a:hover {
  color: var(--color-primary-active);
  text-decoration: none;
}

/* Body text defaults */
p { color: var(--color-ink-secondary); }
strong { color: var(--color-ink); }

/* Headings — Notion scale (heading-2 as h1, not display) */
h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.03rem; }
h2 { font-size: 1.375rem; font-weight: 700; line-height: 1.27; letter-spacing: -0.016rem; }
h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.4; letter-spacing: -0.008rem; }
h4 { font-size: 1rem; font-weight: 600; line-height: 1.5; }
h5 { font-size: 0.9375rem; font-weight: 600; line-height: 1.5; }
h6 { font-size: 0.875rem; font-weight: 600; line-height: 1.43; }

/* Buttons — shared */
.btn {
  font-weight: 500;
  font-size: 0.9375rem;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}
.btn:active {
  transform: scale(0.97);
}

/* Buttons — Primary (Notion blue) */
.btn-primary {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  border-radius: var(--rounded-md);
  color: var(--color-on-primary);
}
.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--color-primary-active);
  border-color: var(--color-primary-active);
}

/* Buttons — Outline secondary (utility) */
.btn-outline-secondary {
  background-color: var(--color-surface);
  color: var(--color-ink-secondary);
  border-color: var(--color-hairline);
  border-radius: var(--rounded-md);
}
.btn-outline-secondary:hover {
  background-color: var(--color-canvas-soft);
  color: var(--color-ink);
  border-color: var(--color-hairline);
}

/* Buttons — Outline primary */
.btn-outline-primary {
  color: var(--color-primary);
  border-color: var(--color-hairline);
  border-radius: var(--rounded-md);
}
.btn-outline-primary:hover {
  background-color: rgba(0, 117, 222, 0.05);
  color: var(--color-primary-active);
  border-color: var(--color-primary);
}

/* Buttons — Danger */
.btn-danger {
  border-radius: var(--rounded-md);
}

/* Cards — Notion feature-card: flat, hairline, generous padding */
.card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-lg);
  box-shadow: none;
  transition: box-shadow 0.15s;
}
.card-elevated,
.card:hover {
  box-shadow: var(--shadow-soft);
}

/* Navbar — Notion style: white surface, ink text, hairline bottom */
.navbar {
  padding: var(--space-sm) var(--space-lg);
  border-bottom: 1px solid var(--color-hairline);
  font-size: 0.9375rem;
}
.navbar .navbar-brand {
  color: var(--color-ink) !important;
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.02rem;
}
.navbar .nav-link {
  color: var(--color-ink-muted) !important;
  font-weight: 500;
  font-size: 1rem;
  transition: color 0.15s;
}
.navbar .nav-link:hover {
  color: var(--color-ink) !important;
}
.navbar .nav-link.router-link-active,
.navbar .nav-link.router-link-exact-active {
  color: var(--color-ink) !important;
  font-weight: 500;
}

/* Container — narrower for Notion-like content density */
.container {
  max-width: 860px;
}

/* Forms */
.form-control {
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-xs);
  padding: 0.375rem 0.75rem;
  font-size: 0.9375rem;
  color: var(--color-ink);
  background-color: var(--color-surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-select {
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-xs);
  padding: 0.375rem 2rem 0.375rem 0.75rem;
  font-size: 0.9375rem;
  color: var(--color-ink);
  background-color: var(--color-surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control::placeholder,
.form-select::placeholder {
  color: var(--color-ink-faint);
}
.form-control:focus,
.form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0,117,222,0.2);
}
/* WCAG 2.4.7 — 포커스 인디케이터 (키보드 탐색 지원) */
:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}
.btn:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}
.form-label {
  color: var(--color-ink-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

/* Badges (pill) */
.badge {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.008rem;
  border-radius: var(--rounded-full);
  padding: 0.25rem 0.5rem;
}
.badge.bg-primary {
  background-color: var(--color-surface) !important;
  color: var(--color-primary);
}

/* Table */
.table {
  margin-bottom: 0;
}
.table thead th {
  background-color: var(--color-canvas-soft);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.008rem;
  color: var(--color-ink-muted);
  border-bottom: 1px solid var(--color-hairline);
  padding: var(--space-sm) var(--space-md);
}
.table tbody td {
  font-size: 0.9375rem;
  color: var(--color-ink);
  border-bottom: 1px solid var(--color-hairline);
  padding: var(--space-sm) var(--space-md);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.table tbody tr:last-child td {
  border-bottom: none;
}
.table tbody tr:hover {
  background-color: var(--color-canvas-soft);
}

/* Nav tabs — Notion style */
.nav-tabs {
  border-bottom-color: var(--color-hairline);
}
.nav-tabs .nav-link {
  color: var(--color-ink-muted);
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.5rem 0.75rem;
  transition: color 0.15s, border-color 0.15s;
}
.nav-tabs .nav-link:hover {
  color: var(--color-ink);
  border-color: transparent;
}
.nav-tabs .nav-link.active {
  color: var(--color-ink);
  font-weight: 600;
  border-bottom-color: var(--color-ink);
  background: none;
}

/* Modal */
.modal-content {
  border-radius: var(--rounded-xl);
  border: none;
  box-shadow: var(--shadow-elevated);
}

/* Toast */
.toast {
  border-radius: var(--rounded-xl);
  box-shadow: var(--shadow-soft);
}

/* Footer */
.footer {
  background-color: var(--color-canvas-soft);
  color: var(--color-ink-secondary);
  font-size: 0.875rem;
  padding: var(--space-xxl);
}

/* ── Utility Classes ── */

/* Colors */
.text-muted { color: var(--color-ink-muted) !important; }
.text-faint { color: var(--color-ink-faint); }
.text-primary { color: var(--color-primary) !important; }
.text-success-custom { color: var(--color-accent-green); }
.bg-canvas { background-color: var(--color-canvas); }
.bg-canvas-soft { background-color: var(--color-canvas-soft); }
.bg-ink { background-color: var(--color-ink); }

/* Borders */
.border-hairline { border-color: var(--color-hairline) !important; }

/* Shadows */
.shadow-soft { box-shadow: var(--shadow-soft); }
.shadow-elevated { box-shadow: var(--shadow-elevated); }

/* Radius */
.rounded-pill-md { border-radius: var(--rounded-md); }
.rounded-pill-lg { border-radius: var(--rounded-lg); }
.rounded-pill-xl { border-radius: var(--rounded-xl); }

/* Layout */
.w-auto { width: auto !important; }
.min-w-label { min-width: 60px; }
.max-w-form { max-width: 400px; }
.min-w-modal { min-width: 280px; }
.min-vh-60 { min-height: 60vh; }

/* Modal overlay */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.4); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.modal-card {
  border-radius: var(--rounded-xl);
  box-shadow: var(--shadow-elevated);
}

/* Login card */
.login-card {
  width: 340px;
  border-radius: var(--rounded-lg);
  box-shadow: var(--shadow-soft);
}

/* Gallery */
.gallery-thumb-grid { height: 100px; font-size: 2rem; }
.gallery-thumb-list { width: 60px; height: 60px; font-size: 1.5rem; flex-shrink: 0; }
.gallery-thumb-modal { height: 120px; font-size: 3rem; }
.gallery-modal { max-width: 400px; width: 90%; }

/* Eyebrow text */
.text-eyebrow { font-size: 0.75rem; }

/* Sidebar */
.sidebar { width: 200px; }

/* ── LMS Layout ── */

/* LMS 전용 컬러 */
:root {
  --lms-sidebar-width: 220px;
  --lms-header-height: 56px;
  --color-student: #4f46e5;
  --color-instructor: #2a9d99;
  --color-admin: #312e81;
  --color-success: #1aae39;
  --color-warning: #dd5b00;
  --color-danger: #dc3545;
  --color-info: #4f46e5;
}

/* LMS App Shell */
.lms-shell {
  display: flex;
  min-height: 100vh;
  background-color: var(--color-canvas-soft);
}

/* LMS Sidebar */
.lms-sidebar {
  width: var(--lms-sidebar-width);
  background-color: var(--color-canvas);
  border-right: 1px solid var(--color-hairline);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.25s;
}
.lms-sidebar-logo {
  padding: 1rem 1rem;
  border-bottom: 1px solid var(--color-hairline);
  display: flex;
  align-items: center;
  gap: 0.625rem;
  height: var(--lms-header-height);
}
.lms-sidebar-logo-icon {
  width: 34px;
  height: 34px;
  background: var(--color-primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.95rem;
  font-weight: 700;
  flex-shrink: 0;
}
.lms-sidebar-logo-text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-ink);
  letter-spacing: -0.02rem;
}
.lms-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0;
}
.lms-sidebar-section {
  padding: 0.5rem 0.75rem 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06rem;
  text-transform: uppercase;
  color: var(--color-ink-faint);
}
.lms-nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.55rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-ink-muted);
  text-decoration: none;
  border-radius: 0;
  transition: background-color 0.12s, color 0.12s;
  position: relative;
  cursor: pointer;
}
.lms-nav-item:hover {
  background-color: var(--color-canvas-soft);
  color: var(--color-ink);
  text-decoration: none;
}
.lms-nav-item.active {
  background-color: rgba(0, 117, 222, 0.07);
  color: var(--color-primary);
  font-weight: 600;
}
.lms-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background-color: var(--color-primary);
  border-radius: 0 2px 2px 0;
}
.lms-nav-item i {
  font-size: 1.05rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.lms-nav-badge {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--color-danger);
  color: white;
  padding: 1px 6px;
  border-radius: var(--rounded-full);
  min-width: 20px;
  text-align: center;
}
.lms-sidebar-user {
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--color-hairline);
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.lms-sidebar-user-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.lms-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--rounded-full);
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.8125rem;
  font-weight: 600;
  flex-shrink: 0;
}
.lms-user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-ink);
  line-height: 1.2;
}
.lms-user-role {
  font-size: 0.75rem;
  color: var(--color-ink-faint);
}

/* LMS Main Content */
.lms-main {
  margin-left: var(--lms-sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.lms-topbar {
  height: var(--lms-header-height);
  background-color: var(--color-canvas);
  border-bottom: 1px solid var(--color-hairline);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.lms-topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-ink);
}
.lms-topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.lms-content {
  flex: 1;
  padding: 1.75rem;
  width: 100%;
}
.lms-page-header {
  margin-bottom: 1.5rem;
}
.lms-page-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--color-ink);
  letter-spacing: -0.02rem;
  margin-bottom: 0.25rem;
}
.lms-page-subtitle {
  font-size: 0.9rem;
  color: var(--color-ink-muted);
}
.lms-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-ink);
  letter-spacing: -0.01rem;
}

/* LMS Cards */
.lms-card {
  background: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-lg);
  padding: 1.25rem;
}
.lms-stat-card {
  background: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.lms-stat-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-ink-muted);
  letter-spacing: 0.01rem;
}
.lms-stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-ink);
  line-height: 1.2;
}
.lms-stat-desc {
  font-size: 0.8125rem;
  color: var(--color-ink-faint);
  margin-top: 0.25rem;
}

/* LMS Course Card */
.lms-course-card {
  background: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-lg);
  overflow: hidden;
  transition: box-shadow 0.15s, transform 0.15s;
  cursor: pointer;
  text-decoration: none;
}
.lms-course-card:hover {
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
  text-decoration: none;
}
.lms-course-thumb {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}
.lms-course-body {
  padding: 1rem;
}
.lms-course-tag {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.01rem;
  color: var(--color-ink-faint);
  margin-bottom: 0.25rem;
}
.lms-course-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-ink);
  margin-bottom: 0.375rem;
  line-height: 1.35;
}
.lms-course-meta {
  font-size: 0.8125rem;
  color: var(--color-ink-muted);
}
.lms-progress-bar-wrap {
  height: 4px;
  background: var(--color-canvas-soft);
  border-radius: var(--rounded-full);
  margin-top: 0.75rem;
  overflow: hidden;
}
.lms-progress-bar-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--rounded-full);
  transition: width 0.4s;
}

/* LMS Table */
.lms-table-wrap {
  background: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-lg);
  overflow: hidden;
}

/* LMS Badge status */
.lms-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--rounded-full);
  font-size: 0.75rem;
  font-weight: 600;
}
.lms-badge-blue { background: rgba(0,117,222,0.1); color: var(--color-primary); }
.lms-badge-green { background: #d4f0da; color: #0e7a27; }
.lms-badge-orange { background: #fce8d5; color: #a34200; }
.lms-badge-red { background: #fdd9dc; color: #a8182a; }
.lms-badge-gray { background: var(--color-canvas-soft); color: var(--color-ink-muted); }
.lms-badge-purple { background: rgba(124,58,237,0.1); color: #7c3aed; }

/* LMS Icon Button */
.lms-icon-btn {
  width: 32px;
  height: 32px;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--rounded-md);
  border: none;
  background: transparent;
  color: var(--color-ink-muted);
  cursor: pointer;
  transition: background-color 0.12s, color 0.12s;
  font-size: 1rem;
}
.lms-icon-btn:hover {
  background-color: var(--color-canvas-soft);
  color: var(--color-ink);
}
.lms-icon-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Notification dot */
.lms-notif-btn {
  position: relative;
}
.lms-notif-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  background: var(--color-danger);
  border-radius: var(--rounded-full);
  border: 1.5px solid white;
}

/* AI Chat UI */
.lms-chat-wrap {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--lms-header-height) - 3.5rem);
  background: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-lg);
  overflow: hidden;
}
.lms-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.lms-chat-msg {
  display: flex;
  gap: 0.625rem;
  max-width: 80%;
}
.lms-chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.lms-chat-msg.ai { align-self: flex-start; }
.lms-chat-bubble {
  padding: 0.625rem 0.875rem;
  border-radius: var(--rounded-lg);
  font-size: 0.9rem;
  line-height: 1.55;
}
.lms-chat-msg.user .lms-chat-bubble {
  background: var(--color-primary);
  color: white;
  border-radius: var(--rounded-lg) var(--rounded-lg) 4px var(--rounded-lg);
}
.lms-chat-msg.ai .lms-chat-bubble {
  background: var(--color-canvas-soft);
  color: var(--color-ink);
  border-radius: var(--rounded-lg) var(--rounded-lg) var(--rounded-lg) 4px;
}
.lms-chat-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--rounded-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
  margin-top: 2px;
}
.lms-chat-input-wrap {
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--color-hairline);
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}
.lms-chat-input {
  flex: 1;
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-lg);
  padding: 0.5rem 0.875rem;
  font-size: 0.9rem;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  background: var(--color-canvas);
  color: var(--color-ink);
  font-family: inherit;
}
.lms-chat-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0,117,222,0.2);
}

/* Responsive */
@media (max-width: 768px) {
  .lms-sidebar {
    transform: translateX(-100%);
  }
  .lms-sidebar.open {
    transform: translateX(0);
  }
  .lms-main {
    margin-left: 0;
    margin-right: 0 !important;
  }
  .lms-content {
    padding: 1rem;
  }
  /* 탭 모바일 가로 스크롤 */
  .nav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav-tabs::-webkit-scrollbar { display: none; }
  .nav-tabs .nav-link {
    white-space: nowrap;
  }
  /* 터치 타깃 최소 44px 보장 */
  .btn {
    min-height: 44px;
  }
  .btn-sm {
    min-height: 44px;
  }
  /* 테이블 가로 스크롤 */
  .lms-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Lecture viewer */
.lms-lecture-player {
  background: #1a1a1a;
  border-radius: var(--rounded-lg);
  overflow: hidden;
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}
.lms-lecture-play-btn {
  width: 64px;
  height: 64px;
  border-radius: var(--rounded-full);
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  transition: background 0.15s;
}
.lms-lecture-play-btn:hover {
  background: rgba(255,255,255,0.25);
}

/* Accordion for lecture list */
.lms-week-item {
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-md);
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.lms-week-header {
  padding: 0.75rem 1rem;
  background: var(--color-canvas);
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-ink);
  user-select: none;
}
.lms-week-header:hover {
  background: var(--color-canvas-soft);
}
.lms-week-body {
  border-top: 1px solid var(--color-hairline);
  background: var(--color-canvas);
}
.lms-lecture-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--color-hairline);
  cursor: pointer;
  transition: background 0.1s;
  font-size: 0.875rem;
  color: var(--color-ink-muted);
}
.lms-lecture-item:last-child { border-bottom: none; }
.lms-lecture-item:hover { background: var(--color-canvas-soft); }
.lms-lecture-item.completed { color: var(--color-ink); }
.lms-lecture-item.active { background: rgba(0,117,222,0.05); color: var(--color-primary); }

/* container override for LMS (full-width inside main) */
.lms-content .container {
  max-width: 100%;
  padding: 0;
}

/* Grid helpers */
.lms-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.lms-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.lms-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
@media (max-width: 1100px) { .lms-grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) { .lms-grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 680px) {
  .lms-grid-4, .lms-grid-3, .lms-grid-2 { grid-template-columns: 1fr; }
}

/* ── Design Review 반영 ── */

/* [1] 역할별 사이드바 활성 색 분리 */
.lms-sidebar--instructor .lms-nav-item.active {
  background-color: rgba(42, 157, 153, 0.08);
  color: var(--color-instructor);
}
.lms-sidebar--instructor .lms-nav-item.active::before {
  background-color: var(--color-instructor);
}
.lms-sidebar--admin .lms-nav-item.active {
  background-color: rgba(33, 49, 131, 0.08);
  color: var(--color-admin);
}
.lms-sidebar--admin .lms-nav-item.active::before {
  background-color: var(--color-admin);
}

/* [2] stat-card accent */
.lms-stat-card-accent {
  border-left: 3px solid var(--lms-stat-accent, var(--color-hairline));
}

/* text-lms-warning 유틸 */
.text-lms-warning { color: var(--color-warning) !important; }
.text-lms-success { color: var(--color-success) !important; }

/* [3] 모바일 topbar 제목 */
@media (max-width: 768px) {
  .lms-topbar {
    padding: 0 0.75rem;
    gap: 0.5rem;
  }
  .lms-topbar-title {
    font-size: 0.875rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    max-width: calc(100vw - 120px);
  }
}

/* [4] 로고 아이콘 내 Bootstrap Icons 크기 */
.lms-login-logo-icon i,
.lms-sidebar-logo-icon i {
  font-size: 1.05rem;
}

/* [5] AI 아이콘 공통 클래스 */
:root {
  --color-ai-from: var(--color-primary);
  --color-ai-to: #4f46e5;
}
.lms-ai-icon {
  flex-shrink: 0;
  border-radius: var(--rounded-sm);
  background: linear-gradient(135deg, var(--color-ai-from), var(--color-ai-to));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}
.lms-ai-icon-sm { width: 24px; height: 24px; font-size: 0.65rem; }
.lms-ai-icon-md { width: 28px; height: 28px; font-size: 0.75rem; }
.lms-ai-icon-lg { width: 32px; height: 32px; font-size: 0.875rem; }

/* 강좌 이모지 썸네일 */
.lms-course-emoji-thumb {
  width: 48px;
  height: 48px;
  font-size: 1.5rem;
  border-radius: var(--rounded-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* 이번 주 강의 컬러 바 */
.lms-week-color-bar {
  width: 3px;
  min-height: 36px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* [6] 승인/반려 액션 버튼 */
.btn-action-approve {
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--rounded-sm);
  border: none;
  background: rgba(26, 174, 57, 0.12);
  color: var(--color-success);
  transition: background 0.12s;
  cursor: pointer;
}
.btn-action-approve:hover { background: rgba(26, 174, 57, 0.22); }
.btn-action-reject {
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--rounded-sm);
  border: none;
  background: rgba(220, 53, 69, 0.1);
  color: var(--color-danger);
  transition: background 0.12s;
  cursor: pointer;
}
.btn-action-reject:hover { background: rgba(220, 53, 69, 0.2); }

/* [7] 테이블 반응형 */
.lms-table-wrap {
  overflow-x: auto;
}
/* 카드 뷰 기본: 테이블 공통 레이아웃 유지 (모바일에서 카드로 전환) */
.lms-table-responsive-card {
  width: 100%;
  border-collapse: collapse;
}
@media (max-width: 680px) {
  .lms-table-responsive-card thead { display: none; }
  .lms-table-responsive-card tbody tr {
    display: flex;
    flex-direction: column;
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--color-hairline);
  }
  .lms-table-responsive-card tbody td {
    border: none;
    padding: 0;
    font-size: 0.875rem;
  }
  .lms-table-responsive-card tbody td:first-child {
    font-weight: 600;
    margin-bottom: 0.25rem;
  }
  .lms-table-responsive-card tbody td:not(:first-child) {
    font-size: 0.8rem;
    color: var(--color-ink-muted);
  }
}

/* [8] 강좌 카드 진도 바 두께 및 완료 상태 */
.lms-course-card .lms-progress-bar-wrap { height: 6px; }
.lms-progress-bar-fill.completed { background: var(--color-success); }
.lms-progress-bar-fill.urgent { background: var(--color-danger); }
.lms-progress-bar-fill.warning { background: var(--color-warning); }
.lms-progress-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-ink-muted);
}

/* [11] 긴급/경고 인라인 배너 유틸 */
.lms-alert-urgent {
  background: rgba(220, 53, 69, 0.08);
  border: 1px solid rgba(220, 53, 69, 0.25);
  border-radius: var(--rounded-lg);
  color: var(--color-danger);
}
.lms-alert-warning {
  background: rgba(221, 91, 0, 0.08);
  border: 1px solid rgba(221, 91, 0, 0.25);
  border-radius: var(--rounded-lg);
  color: var(--color-warning);
}

/* [12] nav-tabs 활성 탭 하단 인디케이터 강화 — 역할별 색상 분리 */
.nav-tabs .nav-link.active {
  border-bottom-width: 2px;
  border-bottom-color: var(--color-primary);
  color: var(--color-primary);
}
/* 역할별 nav-tabs active 색상 */
.lms-role--student .nav-tabs .nav-link.active {
  border-bottom-color: var(--color-student);
  color: var(--color-student);
}
.lms-role--instructor .nav-tabs .nav-link.active {
  border-bottom-color: var(--color-instructor);
  color: var(--color-instructor);
}
.lms-role--admin .nav-tabs .nav-link.active {
  border-bottom-color: var(--color-admin);
  color: var(--color-admin);
}

/* [9] 사이드바 섹션 상단 여백 */
.lms-sidebar-section {
  padding: 1.1rem 1rem 0.3rem;
  margin-top: 0;
  font-size: 0.75rem;
  letter-spacing: 0.03rem;
}

/* [10] LMS 컨텍스트 폼 radius 통일 */
.lms-shell .form-control,
.lms-shell .form-select,
.lms-login-card .form-control,
.lms-login-card .form-select {
  border-radius: var(--rounded-md);
}
.lms-login-card .input-group .form-control:not(:first-child):not(:last-child) {
  border-radius: 0;
}
.lms-login-card .input-group .input-group-text:first-child {
  border-radius: var(--rounded-md) 0 0 var(--rounded-md);
}
.lms-login-card .input-group .input-group-text:last-child {
  border-radius: 0 var(--rounded-md) var(--rounded-md) 0;
}
.lms-login-card .input-group .form-control {
  border-radius: 0;
}

/* 링크 색상 상속 (text-decoration 및 color 인라인 대체) */
.lms-link-plain {
  text-decoration: none;
  color: inherit;
}
.lms-link-plain:hover {
  text-decoration: none;
  color: inherit;
}

/* 강좌 썸네일 — 역할별 배경 */
.lms-course-thumb-student {
  background: linear-gradient(135deg, rgba(0,117,222,0.10), rgba(0,117,222,0.20));
}
.lms-course-thumb-instructor {
  background: linear-gradient(135deg, rgba(42,157,153,0.10), rgba(42,157,153,0.20));
}

/* 작은 보조 텍스트 (color:var(--color-ink-faint) 인라인 대체) */
.lms-note-faint {
  font-size: 0.75rem;
  color: var(--color-ink-faint);
}

/* 교수 AI 패널 카드 배경 */
.lms-card-instructor-ai {
  border: 1px solid rgba(42,157,153,0.25);
  background: linear-gradient(135deg, rgba(42,157,153,0.04), rgba(42,157,153,0.02));
}

/* 관리자 선택 액션바 배경 */
.lms-actionbar-selected {
  background: rgba(0,117,222,0.06);
  border-color: rgba(0,117,222,0.2);
}

/* 관리자 경고 배너 (경고 이벤트 상세) */
.lms-alert-warning-detail {
  background: #fffbeb;
  border: 1px solid #fcd34d;
}

/* 관리자 토글 스위치 — --color-admin 기반으로 오버라이드 */
.lms-role--admin .form-check-input:checked {
  background-color: var(--color-admin);
  border-color: var(--color-admin);
}

/* btn-admin / btn-ghost / btn-xs */
.btn-admin { background: var(--color-admin); color: #fff; border-color: var(--color-admin); }
.btn-admin:hover { filter: brightness(0.9); }
.btn-ghost { background: transparent; border: 1px solid var(--color-hairline); color: inherit; }
.btn-ghost:hover { background: var(--color-canvas-soft); }
.btn-xs { padding: 0.15rem 0.5rem; font-size: 0.75rem; }

/* 댓글/토론 아바타 역할별 스타일 */
.avatar-instructor {
  background: var(--color-instructor, #7c3aed);
  color: var(--color-canvas);
}
.avatar-student {
  background: var(--color-canvas-soft);
  color: var(--color-ink-secondary);
}

/* ── Round 5 유틸 클래스 추가 ── */

/* 색상 토큰 */
:root {
  --color-admin-light: #eef2ff;
  --color-primary-10: #f0f0ff;
  --color-primary-20: rgba(99,102,241,0.2);
}

/* 텍스트 색상 유틸 */
.text-lms-warning { color: var(--color-warning); }
.text-lms-success { color: var(--color-success); }

/* 작은 보조 통계 텍스트 */
.lms-stat-desc-sm {
  font-size: 0.75rem;
  color: var(--color-text-muted, var(--color-ink-muted));
}

/* 프로필 스탯 설명 */
.lms-stat-desc-profile {
  font-size: 0.75rem;
  color: var(--color-ink-faint);
}

/* 성적 피드백 배경 */
.lms-feedback-bg {
  background: rgba(26,174,57,0.07);
  border: 1px solid rgba(26,174,57,0.2);
}

/* 세부 성적 배경 */
.lms-grade-detail-bg {
  background: rgba(0,117,222,0.03);
}

/* 성적 테이블 가로 스크롤 래퍼 */
.lms-grade-table-wrap {
  overflow-x: auto;
}

/* 관리자 그래디언트 배경 */
.bg-gradient-admin {
  background: linear-gradient(135deg, var(--color-admin-light, #eef2ff), var(--color-canvas));
}

/* 행 강조 */
.row-highlighted {
  background: var(--color-canvas-soft);
}

/* 메시지 아이콘 그래디언트 */
.msg-icon-bg {
  background: linear-gradient(135deg, var(--color-primary), var(--color-admin));
}

/* 인라인 카드 border — instructor AI */
.lms-card-instructor-ai-border {
  border: 1px solid var(--color-primary-20);
}

/* 경보/성공 알림 박스 */
.lms-alert-info {
  background: rgba(0,117,222,0.07);
  border: 1px solid rgba(0,117,222,0.2);
  border-radius: var(--rounded-lg);
}
.lms-alert-success {
  background: rgba(26,174,57,0.07);
  border: 1px solid rgba(26,174,57,0.2);
  border-radius: var(--rounded-lg);
}
.lms-alert-urgent-inline {
  background: rgba(220,53,69,0.07);
  border: 1px solid rgba(220,53,69,0.2);
  border-radius: var(--rounded-lg);
  color: var(--color-danger);
}

/* 미세 크기 안내 텍스트 */
.lms-note-faint {
  font-size: 0.75rem;
  color: var(--color-ink-faint);
}

/* 모바일(768px이하) 테이블 가로 스크롤 */
@media (max-width: 768px) {
  .lms-grade-table-wrap,
  .lms-mobile-scroll {
    overflow-x: auto;
  }
}

/* ══════════════════════════════════════════════════════════════
   언어 전환 (Language Switcher) — FR-043/045, NFR-009/010
   상세 스펙: docs/visual-guide.md
   전역 컴포넌트: 로그인(lms-login-bg 우상단) + lms-topbar(전 역할 공통)
   마크업은 Step4(frontend-dev)에서 아래 클래스에 맞춰 붙인다.
   ══════════════════════════════════════════════════════════════ */

.lang-switcher {
  position: relative;
  display: inline-flex;
}

/* Trigger — 로그인(전체표기형)·topbar(압축형) 공용 */
.lang-switcher-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 44px;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-full);
  background: var(--color-canvas);
  color: var(--color-ink-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01rem;
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
.lang-switcher-trigger:hover {
  background: var(--color-canvas-soft);
  color: var(--color-ink);
}
.lang-switcher-trigger:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}
/* open 상태 — 색만이 아니라 배경/테두리/쉐브론 회전까지 함께 바뀌어 색약자도 구분 가능 */
.lang-switcher.open .lang-switcher-trigger,
.lang-switcher-trigger[aria-expanded="true"] {
  background: rgba(0, 117, 222, 0.07);
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.lang-switcher-trigger-icon {
  font-size: 0.95rem;
  line-height: 1;
  flex-shrink: 0;
}
.lang-switcher-trigger-code {
  text-transform: uppercase;
}
.lang-switcher-trigger-chevron {
  font-size: 0.6rem;
  margin-left: 0.1rem;
  transition: transform 0.15s;
}
.lang-switcher.open .lang-switcher-trigger-chevron,
.lang-switcher-trigger[aria-expanded="true"] .lang-switcher-trigger-chevron {
  transform: rotate(180deg);
}

/* topbar(압축형) — "EN"/"UZ" 2글자 배지, 아이콘 없음(wireframes §5.2) */
.lang-switcher--topbar .lang-switcher-trigger-icon {
  display: none;
}

/* login(전체표기형) — 지구본 아이콘 + 전체 언어명, 화면(우측 패널) 우상단 절대배치 */
.lang-switcher--login {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 2;
}
.lang-switcher--login .lang-switcher-trigger {
  background: var(--color-canvas);
  box-shadow: var(--shadow-soft);
}
@media (max-width: 575px) {
  .lang-switcher--login {
    top: 1rem;
    right: 1rem;
  }
}

/* Dropdown menu */
.lang-switcher-menu {
  position: absolute;
  top: calc(100% + 0.375rem);
  right: 0;
  min-width: 168px;
  background: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-md);
  box-shadow: var(--shadow-elevated);
  padding: 0.375rem;
  z-index: 60;
}
.lang-switcher-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.625rem;
  border: none;
  background: transparent;
  border-radius: var(--rounded-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-ink-secondary);
  cursor: pointer;
  text-align: left;
  transition: background-color 0.12s, color 0.12s;
}
.lang-switcher-option:hover {
  background: var(--color-canvas-soft);
  color: var(--color-ink);
}
.lang-switcher-option:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: -2px;
}
/* 선택됨 — 색상 + 체크 아이콘 이중 표시(색약자 고려, 색만으로 구분하지 않음) */
.lang-switcher-option.active {
  color: var(--color-primary);
  font-weight: 600;
  background: rgba(0, 117, 222, 0.06);
}
.lang-switcher-option-check {
  font-size: 0.85rem;
  color: var(--color-primary);
  visibility: hidden;
}
.lang-switcher-option.active .lang-switcher-option-check {
  visibility: visible;
}

/* 모바일(~767px) — topbar 트리거는 지구본 아이콘만, 탭하면 바텀시트로 EN/UZ 노출 (wireframes §5.2) */
@media (max-width: 767px) {
  .lang-switcher--topbar .lang-switcher-trigger-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .lang-switcher--topbar .lang-switcher-trigger-code,
  .lang-switcher--topbar .lang-switcher-trigger-chevron {
    display: none;
  }
  .lang-switcher--topbar .lang-switcher-trigger {
    width: 44px;
    min-width: 44px;
    padding: 0;
    justify-content: center;
    border-radius: var(--rounded-full);
  }
}

.lang-switcher-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
}
.lang-switcher-sheet {
  width: 100%;
  background: var(--color-canvas);
  border-radius: var(--rounded-xl) var(--rounded-xl) 0 0;
  box-shadow: var(--shadow-elevated);
  padding: 0.75rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
}
.lang-switcher-sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--color-hairline);
  border-radius: var(--rounded-full);
  margin: 0 auto 0.75rem;
}
.lang-switcher-sheet-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.04rem;
  padding: 0 0.5rem 0.5rem;
}
.lang-switcher-sheet .lang-switcher-option {
  min-height: 52px;
  font-size: 0.9375rem;
}
