/* ============================================================
   components.css — KDLearnSpace Shared UI Components
   ============================================================ */

/* ── Toast Container ── */
.toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9000;
  display: flex; flex-direction: column; gap: 0.5rem;
  pointer-events: none;
}

.toast {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-lg);
  font-size: 0.875rem; font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  max-width: 340px;
  line-height: 1.4;
}
.toast--success { background: #ecfdf5; color: #065f46; border-left: 4px solid var(--color-success); }
.toast--error   { background: #fff1f2; color: #9f1239; border-left: 4px solid var(--color-error); }
.toast--warning { background: #fffbeb; color: #92400e; border-left: 4px solid var(--color-warning); }
.toast--info    { background: #eff6ff; color: #1e40af; border-left: 4px solid var(--color-info); }

[data-theme="dark"] .toast--success { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .toast--error   { background: #4c0519; color: #fda4af; }
[data-theme="dark"] .toast--warning { background: #451a03; color: #fcd34d; }
[data-theme="dark"] .toast--info    { background: #1e3a5f; color: #93c5fd; }

.toast-icon { font-size: 1rem; flex-shrink: 0; }
.toast-msg  { flex: 1; }

/* ── Hidden utility ── */
.hidden { display: none !important; }

/* ── Scrollbar styling ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--color-border-hover); }

/* ── Chatbot widget visibility ── */
/* When not .open, widget is visually hidden via max-height:0 in main.css */
/* .open class is toggled by ChatbotController */

/* ── Empty state illustrations ── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: 3.5rem 1rem; text-align: center; color: var(--color-text-3);
}
.empty-state > span { display: block; font-size: 3rem; margin-bottom: 0.75rem; }
.empty-state > p   { font-size: 0.9rem; margin-bottom: 1.25rem; max-width: 320px; line-height: 1.5; }

/* ── Progress page ── */
.progress-page .empty-state > button { margin-top: 0.25rem; }

/* ── Section utilities ── */
.text-center { text-align: center; }
.text-muted  { color: var(--color-text-3); font-size: 0.875rem; }

/* ── Course detail back button ── */
.back-btn { display: inline-flex; margin-bottom: 1rem; }

/* ── Lesson / quiz locked tooltip ── */
.lesson--locked:hover::after,
.quiz--locked:hover::after {
  content: "Đăng ký khóa học để mở khoá";
  position: absolute;
  background: rgba(0,0,0,0.75); color: #fff;
  font-size: 0.75rem; padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm); white-space: nowrap;
  pointer-events: none; z-index: 10;
  transform: translateY(-2rem);
}
.lesson-item, .quiz-item { position: relative; }

/* ── Admin table action buttons spacing ── */
.admin-table .action-cell { padding: 0.5rem 1rem; }

/* ── Modal scroll lock ── */
body.modal-open { overflow: hidden; }

/* ── Focus-visible ring ── */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Link default ── */
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Avatar fallback gradient ── */
.nav-avatar { background: var(--grad-primary); }

/* ── Responsive chatbot ── */
@media (max-width: 480px) {
  .chatbot-fab   { bottom: 1rem; right: 1rem; }
  .chatbot-widget { bottom: 4.5rem; }
  .toast-container { bottom: 1rem; right: 1rem; left: 1rem; }
  .toast { max-width: 100%; }
}
