/* ========================================================================= */
/* teacher.css - FlipVocab Teacher Pro LMS Styles (Azota-Grade Design)      */
/* Clean Light & Dark Mode Tokens — Seamlessly Integrated in App Shell       */
/* ========================================================================= */

.hw-teacher-portal-page {
  font-family: var(--font-vietnamese, system-ui, -apple-system, sans-serif);
}

/* Tab Navigation Buttons */
.tp-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  font-size: 0.8125rem;
  font-weight: 700;
  border-radius: 0.75rem;
  border-bottom: 2px solid transparent;
  color: #64748b;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease-in-out;
}

.tp-tab-btn:hover {
  color: #1e293b;
  background-color: rgba(15, 23, 42, 0.04);
}

.tp-tab-btn.active {
  color: #4f46e5;
  border-bottom-color: #4f46e5;
  background-color: rgba(99, 102, 241, 0.08);
}

html.dark .tp-tab-btn {
  color: #94a3b8;
}

html.dark .tp-tab-btn:hover {
  color: #f1f5f9;
  background-color: rgba(255, 255, 255, 0.05);
}

html.dark .tp-tab-btn.active {
  color: #818cf8;
  border-bottom-color: #818cf8;
  background-color: rgba(99, 102, 241, 0.15);
}

/* Clean Form Inputs */
.tp-form-input {
  width: 100%;
  padding: 0.55rem 0.85rem;
  font-size: 0.8125rem;
  border-radius: 0.75rem;
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
  color: #0f172a;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tp-form-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

html.dark .tp-form-input {
  border-color: #334155;
  background-color: #020617;
  color: #f8fafc;
}

html.dark .tp-form-input:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.tp-form-input-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  border-radius: 0.625rem;
  height: 2rem;
  line-height: 1.25;
}

/* Cards & Containers */
.tp-card {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.tp-card-hover:hover {
  border-color: #c7d2fe;
  box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.1);
}

html.dark .tp-card {
  background-color: #0f172a;
  border-color: #1e293b;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

html.dark .tp-card-hover:hover {
  border-color: #4338ca;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

/* Azota-Style Data Tables */
.tp-table-wrap {
  overflow-x: auto;
  border-radius: 0.875rem;
  border: 1px solid #e2e8f0;
  background-color: #ffffff;
}

html.dark .tp-table-wrap {
  border-color: #1e293b;
  background-color: #0f172a;
}

.tp-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.78125rem;
  color: #334155;
}

html.dark .tp-table {
  color: #cbd5e1;
}

.tp-table th {
  padding: 0.75rem 1rem;
  font-weight: 700;
  font-size: 0.71875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background-color: #f8fafc;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
}

html.dark .tp-table th {
  background-color: #020617;
  color: #94a3b8;
  border-bottom-color: #1e293b;
}

.tp-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

html.dark .tp-table td {
  border-bottom-color: #1e293b;
}

.tp-table tr:last-child td {
  border-bottom: none;
}

.tp-table tr:hover {
  background-color: #f8fafc;
}

html.dark .tp-table tr:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

/* Status Badges */
.tp-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: 0.5rem;
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.025em;
  white-space: nowrap;
}

.tp-badge-success {
  background-color: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}
html.dark .tp-badge-success {
  background-color: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.tp-badge-warning {
  background-color: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}
html.dark .tp-badge-warning {
  background-color: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

.tp-badge-danger {
  background-color: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}
html.dark .tp-badge-danger {
  background-color: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

.tp-badge-primary {
  background-color: #eef2ff;
  color: #4f46e5;
  border: 1px solid #c7d2fe;
}
html.dark .tp-badge-primary {
  background-color: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.3);
}

/* Buttons */
.tp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 0.65rem;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease-in-out;
}

.tp-btn-primary {
  background-color: #4f46e5;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.3);
}
.tp-btn-primary:hover {
  background-color: #4338ca;
}

.tp-btn-secondary {
  background-color: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}
.tp-btn-secondary:hover {
  background-color: #e2e8f0;
  color: #0f172a;
  border-color: #94a3b8;
}
html.dark .tp-btn-secondary {
  background-color: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}
html.dark .tp-btn-secondary:hover {
  background-color: #334155 !important;
  color: #ffffff !important;
  border-color: #475569 !important;
}
.tp-btn-secondary.active {
  background-color: #4f46e5 !important;
  color: #ffffff !important;
  border-color: #4f46e5 !important;
}
#tp-qb-branch-body label,
#tp-qb-branch-body p,
#tp-qb-branch-body h4 {
  color: var(--tp-qb-text-sec);
}
#tp-qb-branch-body h4 {
  color: var(--tp-qb-text);
}

/* Action Icon Buttons */
.tp-action-btn {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  background: transparent;
  border: 1px solid transparent;
  color: #64748b;
  cursor: pointer;
  transition: all 0.12s;
}

.tp-action-btn:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}

html.dark .tp-action-btn:hover {
  background-color: #1e293b;
  color: #f8fafc;
}

/* ========================================================================= */
/* Elimination of dirty gray backgrounds in Dark Mode for Teacher & Modals  */
/* ========================================================================= */
html.dark .hw-teacher-portal-page .hw-bg-slate-50,
html.dark [id^="tp-"] .hw-bg-slate-50,
html.dark #view-teacher .hw-bg-slate-50 {
  background-color: #0b1120 !important;
}

html.dark .hw-teacher-portal-page .hw-bg-slate-100,
html.dark [id^="tp-"] .hw-bg-slate-100,
html.dark #view-teacher .hw-bg-slate-100 {
  background-color: #0f172a !important;
}

html.dark .hw-teacher-portal-page .hw-bg-slate-200,
html.dark [id^="tp-"] .hw-bg-slate-200,
html.dark #view-teacher .hw-bg-slate-200,
html.dark .hw-teacher-portal-page .hw-bg-slate-300,
html.dark [id^="tp-"] .hw-bg-slate-300,
html.dark #view-teacher .hw-bg-slate-300 {
  background-color: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}

html.dark .hw-teacher-portal-page .hw-bg-slate-200:hover,
html.dark [id^="tp-"] .hw-bg-slate-200:hover,
html.dark #view-teacher .hw-bg-slate-200:hover,
html.dark .hw-teacher-portal-page .hw-bg-slate-300:hover,
html.dark [id^="tp-"] .hw-bg-slate-300:hover,
html.dark #view-teacher .hw-bg-slate-300:hover {
  background-color: #334155 !important;
  color: #ffffff !important;
  border-color: #475569 !important;
}

/* Modal header/footer surfaces in dark mode */
html.dark [id^="tp-"] .hw-border-t.hw-bg-slate-50,
html.dark [id^="tp-"] .hw-border-b.hw-bg-slate-50,
html.dark [id^="tp-"] .hw-border-t.hw-bg-slate-50\/60,
html.dark [id^="tp-"] .hw-border-b.hw-bg-slate-950\/50 {
  background-color: #0b1120 !important;
  border-color: #1e293b !important;
}

/* ========================================================================= */
/* Student Search Candidate Card (Light & Dark Mode)                         */
/* ========================================================================= */
.tp-student-candidate-card {
  background-color: transparent;
  border-color: #e2e8f0;
  transition: all 0.15s ease-in-out;
}
.tp-student-candidate-card:hover {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
}
:is(html.dark, html[data-theme="dark"], .dark) .tp-student-candidate-card {
  border-color: rgba(51, 65, 85, 0.6) !important;
}
:is(html.dark, html[data-theme="dark"], .dark) .tp-student-candidate-card:hover {
  background-color: #1e293b !important;
  border-color: #475569 !important;
}

/* Eliminate dirty/white hover states in dark mode */
:is(html.dark, html[data-theme="dark"], .dark) .hw-teacher-portal-page [class*="hover:hw-bg-slate-50"]:hover,
:is(html.dark, html[data-theme="dark"], .dark) [id^="tp-"] [class*="hover:hw-bg-slate-50"]:hover,
:is(html.dark, html[data-theme="dark"], .dark) #view-teacher [class*="hover:hw-bg-slate-50"]:hover,
:is(html.dark, html[data-theme="dark"], .dark) .hw-teacher-portal-page [class*="hover:hw-bg-slate-100"]:hover,
:is(html.dark, html[data-theme="dark"], .dark) [id^="tp-"] [class*="hover:hw-bg-slate-100"]:hover,
:is(html.dark, html[data-theme="dark"], .dark) #view-teacher [class*="hover:hw-bg-slate-100"]:hover,
:is(html.dark, html[data-theme="dark"], .dark) .hw-teacher-portal-page [class*="hover:hw-bg-slate-200"]:hover,
:is(html.dark, html[data-theme="dark"], .dark) [id^="tp-"] [class*="hover:hw-bg-slate-200"]:hover,
:is(html.dark, html[data-theme="dark"], .dark) #view-teacher [class*="hover:hw-bg-slate-200"]:hover,
:is(html.dark, html[data-theme="dark"], .dark) .hw-teacher-portal-page [class*="hover:hw-bg-slate-300"]:hover,
:is(html.dark, html[data-theme="dark"], .dark) [id^="tp-"] [class*="hover:hw-bg-slate-300"]:hover,
:is(html.dark, html[data-theme="dark"], .dark) #view-teacher [class*="hover:hw-bg-slate-300"]:hover {
  background-color: #1e293b !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

:is(html.dark, html[data-theme="dark"], .dark) [id^="tp-"] [class*="hover:hw-bg-red-50"]:hover,
:is(html.dark, html[data-theme="dark"], .dark) [id^="tp-"] [class*="hover:hw-bg-rose-50"]:hover,
:is(html.dark, html[data-theme="dark"], .dark) .hw-teacher-portal-page [class*="hover:hw-bg-red-50"]:hover,
:is(html.dark, html[data-theme="dark"], .dark) .hw-teacher-portal-page [class*="hover:hw-bg-rose-50"]:hover,
:is(html.dark, html[data-theme="dark"], .dark) #view-teacher [class*="hover:hw-bg-red-50"]:hover,
:is(html.dark, html[data-theme="dark"], .dark) #view-teacher [class*="hover:hw-bg-rose-50"]:hover {
  background-color: rgba(239, 68, 68, 0.2) !important;
  color: #f87171 !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
}

:is(html.dark, html[data-theme="dark"], .dark) [id^="tp-"] [class*="hover:hw-bg-indigo-50"]:hover,
:is(html.dark, html[data-theme="dark"], .dark) .hw-teacher-portal-page [class*="hover:hw-bg-indigo-50"]:hover,
:is(html.dark, html[data-theme="dark"], .dark) #view-teacher [class*="hover:hw-bg-indigo-50"]:hover {
  background-color: rgba(99, 102, 241, 0.2) !important;
  color: #818cf8 !important;
}


/* =========================================================================
 * EPS-TOPIK QUESTION UNDERLINE STYLING (HIGH CONTRAST & ACCESSIBILITY)
 * ========================================================================= */
.tp-underlined,
.underline-text-option,
.text-decoration-underline,
u {
  text-decoration-line: underline !important;
  text-underline-offset: 4px !important;
  text-decoration-thickness: 2.5px !important;
  text-decoration-color: #4f46e5 !important;
  font-weight: 700 !important;
  padding-left: 2px !important;
  padding-right: 2px !important;
  text-decoration-skip-ink: none !important;
}

html.dark .tp-underlined,
html.dark .underline-text-option,
html.dark .text-decoration-underline,
html.dark u {
  text-decoration-color: #818cf8 !important;
}

/* Green highlight coordination when an option is the correct answer */
.hw-border-emerald-500 .tp-underlined,
.hw-border-emerald-500 .underline-text-option,
.hw-border-emerald-500 .text-decoration-underline,
.hw-border-emerald-500 u {
  text-decoration-color: #059669 !important;
}

html.dark .hw-border-emerald-500 .tp-underlined,
html.dark .hw-border-emerald-500 .underline-text-option,
html.dark .hw-border-emerald-500 .text-decoration-underline,
html.dark .hw-border-emerald-500 u {
  text-decoration-color: #34d399 !important;
}


/* =========================================================================
 * EPS-TOPIK PREVIEW MODAL MOBILE RESPONSIVE ENGINE
 * ========================================================================= */
@media (max-width: 767.98px) {
  /* Modal Window takes full screen without margins on mobile */
  #tp-eps-preview-modal > div {
    max-height: 100vh !important;
    height: 100% !important;
    width: 100% !important;
    border-radius: 0 !important;
  }

  /* Question Pane takes 100% full height & width on mobile */
  #tp-preview-question-pane {
    width: 100% !important;
    height: 100% !important;
    flex: 1 1 100% !important;
    padding: 0.625rem !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* Question Card container inside pane */
  #tp-preview-question-pane > div {
    max-width: 100% !important;
    padding: 0.875rem !important;
    margin: 0 !important;
    border-radius: 1rem !important;
    box-shadow: none !important;
  }

  /* Question Title on mobile */
  #tp-preview-question-pane .hw-text-base,
  #tp-preview-question-pane .sm\:hw-text-lg {
    font-size: 0.95rem !important;
    line-height: 1.45rem !important;
  }

  /* Question Image responsive sizing on mobile */
  #tp-preview-question-pane img {
    max-height: 220px !important;
    width: auto !important;
    max-width: 100% !important;
  }

  /* Question Options on mobile */
  #tp-preview-question-pane .hw-space-y-2\.5 > div {
    padding: 0.65rem 0.75rem !important;
    font-size: 0.8125rem !important;
  }

  /* Question Options numbering badge */
  #tp-preview-question-pane .hw-w-7.hw-h-7 {
    width: 1.5rem !important;
    height: 1.5rem !important;
    font-size: 0.75rem !important;
  }

  /* Bottom Navigation Buttons */
  #tp-preview-question-pane .tp-btn {
    padding: 0.45rem 0.75rem !important;
    font-size: 0.75rem !important;
  }

  /* Floating Quick Palette Button on Mobile */
  .tp-mobile-palette-fab {
    position: fixed;
    right: 1rem;
    bottom: 1.25rem;
    z-index: 142;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.95rem;
    background: #4f46e5;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 9999px;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
  }
  .tp-mobile-palette-fab:active {
    transform: scale(0.95);
  }
  html.dark .tp-mobile-palette-fab {
    background: #6366f1;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.5);
  }

  /* Palette Sidebar transforms into a Slide-up Bottom Drawer on Mobile */
  #tp-preview-palette-sidebar.tp-preview-palette-responsive {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-height: 72vh !important;
    z-index: 150 !important;
    border-top-left-radius: 1.25rem !important;
    border-top-right-radius: 1.25rem !important;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.4) !important;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
    transform: translateY(105%) !important;
    display: flex !important;
    flex-direction: column !important;
  }

  #tp-preview-palette-sidebar.tp-preview-palette-responsive.is-open {
    transform: translateY(0%) !important;
  }

  /* Backdrop for bottom drawer */
  #tp-preview-palette-backdrop.is-open {
    display: block !important;
    opacity: 1 !important;
  }
}

@media (min-width: 768px) {
  .tp-mobile-palette-fab {
    display: none !important;
  }
  #tp-preview-palette-sidebar.tp-preview-palette-responsive {
    position: relative !important;
    transform: none !important;
    box-shadow: none !important;
    max-height: none !important;
    border-radius: 0 !important;
  }
}

/* ========================================================================= */
/* MOBILE RESPONSIVE OPTIMIZATIONS & TOUCH SCROLLBARS                        */
/* ========================================================================= */
.tp-scroll-tabs,
#tp-nav-tabs {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
  -webkit-overflow-scrolling: touch !important;
}
.tp-scroll-tabs::-webkit-scrollbar,
#tp-nav-tabs::-webkit-scrollbar {
  display: none !important;
}

@media (max-width: 640px) {
  .tp-tab-btn {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.75rem !important;
    gap: 0.35rem !important;
  }
}

.tp-epvn-sec-btn {
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  font-size: 0.75rem !important;
  padding: 0.45rem 0.75rem !important;
  transition: all 0.15s ease-in-out !important;
}

.tp-epvn-sec-btn.active {
  background-color: #4f46e5 !important;
  color: #ffffff !important;
  border-color: #4f46e5 !important;
  box-shadow: 0 1px 3px 0 rgba(79, 70, 229, 0.3) !important;
}


/* ========================================================= */
/* STUDENT CLASSROOM (LỚP HỌC CỦA TÔI) THEME OVERRIDES       */
/* ========================================================= */
.hw-classroom-banner {
    background: linear-gradient(135deg, rgba(238, 242, 255, 0.9) 0%, #ffffff 50%, #f8fafc 100%) !important;
    border: 1px solid #e0e7ff !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05) !important;
}
:is(html.dark, html[data-theme="dark"], .dark) .hw-classroom-banner {
    background: linear-gradient(135deg, rgba(30, 27, 75, 0.7) 0%, rgba(15, 23, 42, 0.95) 100%) !important;
    border: 1px solid rgba(99, 102, 241, 0.3) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
}
:is(html.dark, html[data-theme="dark"], .dark) .hw-classroom-banner h2 {
    color: #ffffff !important;
}
:is(html.dark, html[data-theme="dark"], .dark) .hw-classroom-banner p {
    color: #94a3b8 !important;
}
:is(html.dark, html[data-theme="dark"], .dark) .hw-classroom-banner b,
:is(html.dark, html[data-theme="dark"], .dark) .hw-classroom-banner button {
    color: #818cf8 !important;
}
:is(html.dark, html[data-theme="dark"], .dark) .hw-code-pill {
    background-color: rgba(30, 27, 75, 0.6) !important;
    border: 1px solid rgba(99, 102, 241, 0.4) !important;
    color: #a5b4fc !important;
}
:is(html.dark, html[data-theme="dark"], .dark) .hw-assignment-card {
    background-color: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25) !important;
}
:is(html.dark, html[data-theme="dark"], .dark) .hw-assignment-card h3,
:is(html.dark, html[data-theme="dark"], .dark) .hw-assignment-card h4 {
    color: #f8fafc !important;
}
:is(html.dark, html[data-theme="dark"], .dark) .hw-assignment-source-badge,
:is(html.dark, html[data-theme="dark"], .dark) #student-classroom-container span.hw-bg-slate-100 {
    background-color: #1e293b !important;
    color: #cbd5e1 !important;
    border: 1px solid #334155 !important;
}

/* ========================================================================= */
/* UNIFIED LIGHT & DARK DESIGN SYSTEM — QUESTION BANK, CART & LMS MODALS     */
/* Explicit semantic classes immune to global [class*="hw-bg-slate-9*"]      */
/* ========================================================================= */
:root {
  --tp-qb-surface: #ffffff;
  --tp-qb-surface-alt: #f8fafc;
  --tp-qb-surface-hover: #f1f5f9;
  --tp-qb-border: #e2e8f0;
  --tp-qb-border-strong: #cbd5e1;
  --tp-qb-text: #0f172a;
  --tp-qb-text-sec: #334155;
  --tp-qb-text-muted: #475569;
  --tp-qb-indigo-bg: #eef2ff;
  --tp-qb-indigo-bd: #c7d2fe;
  --tp-qb-indigo-fg: #3730a3;
  --tp-qb-emerald-bg: #ecfdf5;
  --tp-qb-emerald-bd: #6ee7b7;
  --tp-qb-emerald-fg: #065f46;
  --tp-qb-amber-bg: #fef3c7;
  --tp-qb-amber-bd: #fcd34d;
  --tp-qb-amber-fg: #92400e;
  --tp-qb-blue-bg: #eff6ff;
  --tp-qb-blue-bd: #bfdbfe;
  --tp-qb-blue-fg: #1d4ed8;
  --tp-qb-purple-bg: #f5f3ff;
  --tp-qb-purple-fg: #6d28d9;
  --tp-qb-backdrop: rgba(15, 23, 42, 0.64);
}

html.dark,
html[data-theme="dark"],
body.dark {
  --tp-qb-surface: #0f172a;
  --tp-qb-surface-alt: #131c31;
  --tp-qb-surface-hover: #1e293b;
  --tp-qb-border: #1e293b;
  --tp-qb-border-strong: #334155;
  --tp-qb-text: #f8fafc;
  --tp-qb-text-sec: #e2e8f0;
  --tp-qb-text-muted: #94a3b8;
  --tp-qb-indigo-bg: rgba(99, 102, 241, 0.16);
  --tp-qb-indigo-bd: rgba(129, 140, 248, 0.42);
  --tp-qb-indigo-fg: #c7d2fe;
  --tp-qb-emerald-bg: rgba(16, 185, 129, 0.14);
  --tp-qb-emerald-bd: rgba(52, 211, 153, 0.42);
  --tp-qb-emerald-fg: #6ee7b7;
  --tp-qb-amber-bg: rgba(245, 158, 11, 0.16);
  --tp-qb-amber-bd: rgba(251, 191, 36, 0.36);
  --tp-qb-amber-fg: #fcd34d;
  --tp-qb-blue-bg: rgba(59, 130, 246, 0.16);
  --tp-qb-blue-bd: rgba(96, 165, 250, 0.36);
  --tp-qb-blue-fg: #93c5fd;
  --tp-qb-purple-bg: rgba(139, 92, 246, 0.16);
  --tp-qb-purple-fg: #c4b5fd;
  --tp-qb-backdrop: rgba(2, 6, 23, 0.82);
}

/* Fix Light/Dark default text inheritance on standalone modals & cards */
.hw-teacher-portal-page,
#tp-qb-branch-body,
#tp-mixed-cart-modal,
#tp-eps-builder-modal,
#tp-eps-preview-modal,
#tp-grading-modal,
#tp-group-modal,
#tp-class-modal,
#tp-invite-modal,
#tp-add-student-modal {
  color: var(--tp-qb-text);
}

.tp-qb-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--tp-qb-text-sec);
  margin-bottom: 0.3rem;
}

.tp-qb-muted {
  color: var(--tp-qb-text-muted);
}

.tp-qb-heading {
  color: var(--tp-qb-text);
  font-weight: 700;
}

/* Active Cart Button (+ Đã trong Giỏ) */
.tp-btn-cart-added {
  background-color: #059669 !important;
  color: #ffffff !important;
  border: 1px solid #047857 !important;
  box-shadow: 0 1px 3px rgba(5, 150, 105, 0.28);
}
.tp-btn-cart-added:hover {
  background-color: #047857 !important;
  color: #ffffff !important;
}

/* Series / Paper Code Badge */
.tp-qb-badge-code {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.625rem;
  font-weight: 800;
  background-color: var(--tp-qb-surface-hover);
  color: var(--tp-qb-text-sec);
  border: 1px solid var(--tp-qb-border);
}

/* Skill Badges */
.tp-skill-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.625rem;
  font-weight: 800;
  border: 1px solid transparent;
}
.tp-skill-pill.is-reading {
  background-color: var(--tp-qb-blue-bg);
  border-color: var(--tp-qb-blue-bd);
  color: var(--tp-qb-blue-fg);
}
.tp-skill-pill.is-listening {
  background-color: var(--tp-qb-amber-bg);
  border-color: var(--tp-qb-amber-bd);
  color: var(--tp-qb-amber-fg);
}
.tp-skill-pill.is-writing {
  background-color: var(--tp-qb-purple-bg);
  border-color: rgba(139, 92, 246, 0.35);
  color: var(--tp-qb-purple-fg);
}
.tp-skill-pill.is-vocab,
.tp-skill-pill.is-grammar,
.tp-skill-pill.is-round2 {
  background-color: var(--tp-qb-indigo-bg);
  border-color: var(--tp-qb-indigo-bd);
  color: var(--tp-qb-indigo-fg);
}

/* Explorer & Generator Question Cards */
.tp-qcard {
  background-color: var(--tp-qb-surface);
  border: 1px solid var(--tp-qb-border);
  border-radius: 1rem;
  padding: 1.125rem;
  color: var(--tp-qb-text);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}
:is(html.dark, html[data-theme="dark"], body.dark) .tp-qcard {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.tp-qcard-stimulus {
  padding: 0.55rem 0.75rem;
  border-radius: 0.625rem;
  background-color: var(--tp-qb-surface-alt);
  border: 1px solid var(--tp-qb-border);
  color: var(--tp-qb-text-sec);
  font-size: 0.75rem;
  line-height: 1.5;
}

.tp-qcard-title {
  color: var(--tp-qb-text);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.55;
}

.tp-qcard-img {
  max-height: 10rem;
  border-radius: 0.5rem;
  border: 1px solid var(--tp-qb-border-strong);
  background-color: #ffffff;
  padding: 0.25rem;
}

.tp-qcard-opt {
  padding: 0.45rem 0.65rem;
  border-radius: 0.5rem;
  border: 1px solid var(--tp-qb-border);
  background-color: var(--tp-qb-surface-alt);
  color: var(--tp-qb-text-sec);
  font-size: 0.75rem;
  line-height: 1.4;
}
.tp-qcard-opt.is-correct {
  background-color: var(--tp-qb-emerald-bg);
  border-color: var(--tp-qb-emerald-bd);
  color: var(--tp-qb-emerald-fg);
  font-weight: 700;
}

.tp-qcard-model-answer {
  padding: 0.55rem 0.75rem;
  border-radius: 0.5rem;
  background-color: var(--tp-qb-emerald-bg);
  border: 1px solid var(--tp-qb-emerald-bd);
  color: var(--tp-qb-emerald-fg);
  font-size: 0.75rem;
}

/* Curriculum Lesson Picker */
.tp-lesson-box {
  background-color: var(--tp-qb-surface-alt);
  border: 1px solid var(--tp-qb-border);
  border-radius: 0.75rem;
  padding: 0.5rem;
  max-height: 11rem;
  overflow-y: auto;
}
.tp-lesson-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.55rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  color: var(--tp-qb-text-sec);
  cursor: pointer;
  transition: background-color 0.12s ease;
}
.tp-lesson-item:hover {
  background-color: var(--tp-qb-surface-hover);
  color: var(--tp-qb-text);
}

/* Modal Backdrop & Shell (Mixed Cart, Builder, Preview) */
.tp-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 135;
  background: var(--tp-qb-backdrop) !important;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
}
@media (min-width: 640px) {
  .tp-modal-backdrop { padding: 1.5rem; }
}
.tp-modal-backdrop.hw-hidden {
  display: none !important;
}

.tp-modal-shell {
  width: 100%;
  max-width: 56rem;
  max-height: 92vh;
  background-color: var(--tp-qb-surface) !important;
  border: 1px solid var(--tp-qb-border-strong) !important;
  border-radius: 1rem;
  color: var(--tp-qb-text);
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.42);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tp-modal-head {
  padding: 1rem 1.25rem;
  background-color: var(--tp-qb-surface-alt);
  border-bottom: 1px solid var(--tp-qb-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.tp-modal-head h3 {
  color: var(--tp-qb-text);
  font-weight: 800;
  font-size: 1rem;
  margin: 0;
}
.tp-modal-head p {
  color: var(--tp-qb-text-muted);
  font-size: 0.75rem;
  margin: 0.15rem 0 0;
}

.tp-modal-close {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--tp-qb-text-muted);
  font-size: 1.35rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.tp-modal-close:hover {
  background-color: var(--tp-qb-surface-hover);
  color: var(--tp-qb-text);
  border-color: var(--tp-qb-border);
}

.tp-modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1 1 auto;
  background-color: var(--tp-qb-surface);
  color: var(--tp-qb-text);
}

.tp-modal-footer {
  padding: 0.9rem 1.25rem;
  background-color: var(--tp-qb-surface-alt);
  border-top: 1px solid var(--tp-qb-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.tp-class-checklist {
  max-height: 6.5rem;
  overflow-y: auto;
  padding: 0.55rem;
  border-radius: 0.75rem;
  border: 1px solid var(--tp-qb-border-strong);
  background-color: var(--tp-qb-surface-alt);
  color: var(--tp-qb-text);
}
.tp-class-checklist label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.35rem;
  border-radius: 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--tp-qb-text-sec);
  cursor: pointer;
}
.tp-class-checklist label:hover {
  background-color: var(--tp-qb-surface-hover);
}

.tp-cart-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.75rem;
  background-color: var(--tp-qb-surface-alt);
  border: 1px solid var(--tp-qb-border);
}
.tp-cart-item-meta {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--tp-qb-indigo-fg);
}
.tp-cart-item-text {
  font-size: 0.75rem;
  color: var(--tp-qb-text);
}

/* Floating Cart Bar (High Contrast in BOTH Light & Dark Mode) */
.tp-floating-cart-bar {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 125;
  width: min(calc(100% - 24px), 860px);
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background-color: #ffffff;
  color: #0f172a;
  border: 1.5px solid #4f46e5;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.2);
}
:is(html.dark, html[data-theme="dark"], body.dark) .tp-floating-cart-bar {
  background-color: #0f172a;
  color: #f8fafc;
  border-color: #6366f1;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.55);
}
.tp-floating-cart-bar.hw-hidden {
  display: none !important;
}
.tp-floating-cart-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.75rem;
  background-color: #4f46e5;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tp-floating-cart-title {
  font-size: 0.825rem;
  font-weight: 800;
  color: var(--tp-qb-text);
}
.tp-floating-cart-count {
  color: #059669;
  font-weight: 900;
}
:is(html.dark, html[data-theme="dark"], body.dark) .tp-floating-cart-count {
  color: #34d399;
}
.tp-floating-cart-sub {
  font-size: 0.7rem;
  color: var(--tp-qb-text-muted);
}
.tp-floating-cart-send {
  padding: 0.45rem 0.9rem;
  border-radius: 0.6rem;
  border: none;
  background-color: #059669;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.3);
}
.tp-floating-cart-send:hover {
  background-color: #047857;
}

/* Single-Exam Builder Palette Items */
.tp-builder-qitem {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  border-radius: 0.65rem;
  border: 1px solid var(--tp-qb-border-strong);
  background-color: var(--tp-qb-surface);
  color: var(--tp-qb-text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.14s ease;
}
.tp-builder-qitem.is-selected {
  border-color: var(--tp-qb-indigo-bd);
  background-color: var(--tp-qb-indigo-bg);
  color: var(--tp-qb-text);
}
.tp-builder-qitem-title {
  font-weight: 700;
  color: var(--tp-qb-text);
}
.tp-builder-qitem-tag {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--tp-qb-indigo-fg);
}
.tp-builder-qitem-snip {
  font-size: 0.7rem;
  color: var(--tp-qb-text-muted);
}

/* Preview Question Card & Options (Light & Dark Clean Surfaces) */
.tp-preview-card {
  max-width: 42rem;
  margin: 0 auto;
  background-color: var(--tp-qb-surface) !important;
  border: 1px solid var(--tp-qb-border) !important;
  border-radius: 1rem;
  padding: 1.5rem;
  color: var(--tp-qb-text);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}
.tp-preview-passage {
  padding: 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--tp-qb-border);
  background-color: var(--tp-qb-surface-alt) !important;
  color: var(--tp-qb-text);
}
.tp-preview-audio-box {
  padding: 0.85rem;
  border-radius: 0.75rem;
  border: 1px solid var(--tp-qb-amber-bd);
  background-color: var(--tp-qb-amber-bg) !important;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.tp-preview-img-box {
  text-align: center;
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid var(--tp-qb-border);
  background-color: #ffffff;
}
:is(html.dark, html[data-theme="dark"], body.dark) .tp-preview-img-box {
  background-color: #f8fafc;
}
.tp-preview-opt {
  padding: 0.85rem;
  border-radius: 0.75rem;
  border: 1px solid var(--tp-qb-border);
  background-color: var(--tp-qb-surface-alt) !important;
  color: var(--tp-qb-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.tp-preview-opt.is-correct {
  background-color: var(--tp-qb-emerald-bg) !important;
  border-color: var(--tp-qb-emerald-bd) !important;
  color: var(--tp-qb-emerald-fg) !important;
  font-weight: 700;
}
.tp-preview-opt-num {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  background-color: var(--tp-qb-surface);
  border: 1px solid var(--tp-qb-border-strong);
  color: var(--tp-qb-text-sec);
}
.tp-preview-opt.is-correct .tp-preview-opt-num {
  background-color: #059669;
  border-color: #047857;
  color: #ffffff;
}
.tp-preview-explain {
  padding: 1rem;
  border-radius: 0.75rem;
  background-color: var(--tp-qb-indigo-bg) !important;
  border: 1px solid var(--tp-qb-indigo-bd) !important;
  color: var(--tp-qb-indigo-fg) !important;
  font-size: 0.78rem;
  line-height: 1.55;
}
/* Override global app_shell Light/Dark [class*="hw-bg-slate-9*"] collisions on Builder & Preview modals */
html:not(.dark) #tp-eps-builder-modal,
html:not(.dark) #tp-eps-preview-modal {
  background: var(--tp-qb-backdrop) !important;
}
html:not(.dark) #tp-eps-builder-modal > div,
html:not(.dark) #tp-eps-preview-modal #tp-preview-question-pane > .tp-preview-card,
html:not(.dark) #tp-eps-preview-modal #tp-preview-palette-sidebar,
html:not(.dark) #tp-eps-preview-modal > div > .hw-border-b {
  background: var(--tp-qb-surface) !important;
  background-color: var(--tp-qb-surface) !important;
  color: var(--tp-qb-text) !important;
}
html:not(.dark) #tp-eps-preview-modal #tp-preview-question-pane {
  background: var(--tp-qb-surface-alt) !important;
  background-color: var(--tp-qb-surface-alt) !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) #tp-eps-builder-modal,
:is(html.dark, html[data-theme="dark"], body.dark) #tp-eps-preview-modal {
  background: var(--tp-qb-backdrop) !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) #tp-eps-builder-modal > div,
:is(html.dark, html[data-theme="dark"], body.dark) #tp-eps-preview-modal > div {
  background-color: var(--tp-qb-surface) !important;
  border-color: var(--tp-qb-border-strong) !important;
  color: var(--tp-qb-text) !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) #tp-eps-preview-modal > div > .hw-border-b,
:is(html.dark, html[data-theme="dark"], body.dark) #tp-eps-preview-modal #tp-preview-palette-sidebar {
  background-color: var(--tp-qb-surface) !important;
  border-color: var(--tp-qb-border) !important;
  color: var(--tp-qb-text) !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) #tp-eps-preview-modal #tp-preview-question-pane {
  background-color: #0b1120 !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) #tp-eps-builder-modal label,
:is(html.dark, html[data-theme="dark"], body.dark) #tp-eps-builder-modal h3,
:is(html.dark, html[data-theme="dark"], body.dark) #tp-eps-preview-modal h3,
:is(html.dark, html[data-theme="dark"], body.dark) #tp-eps-preview-modal #tp-preview-exam-title {
  color: var(--tp-qb-text) !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) #tp-eps-builder-modal .hw-bg-white,
:is(html.dark, html[data-theme="dark"], body.dark) #tp-eps-preview-modal .hw-bg-white {
  background-color: var(--tp-qb-surface) !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) #tp-eps-builder-modal .hw-border-b,
:is(html.dark, html[data-theme="dark"], body.dark) #tp-eps-builder-modal .hw-border-t {
  background-color: var(--tp-qb-surface-alt) !important;
  border-color: var(--tp-qb-border) !important;
}
#tp-eps-builder-modal label,
#tp-eps-preview-modal label {
  color: var(--tp-qb-text-sec);
}
#tp-eps-builder-modal .hw-bg-slate-50,
#tp-eps-builder-modal #builder-classes-list {
  background-color: var(--tp-qb-surface-alt) !important;
  border-color: var(--tp-qb-border) !important;
}
#tp-eps-preview-modal #tp-preview-palette button:not(.hw-bg-indigo-600) {
  background-color: var(--tp-qb-surface-alt) !important;
  border-color: var(--tp-qb-border-strong) !important;
  color: var(--tp-qb-text-sec) !important;
}
#tp-eps-preview-modal #tp-preview-palette button.hw-bg-indigo-600 {
  background-color: #4f46e5 !important;
  border-color: #4f46e5 !important;
  color: #ffffff !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) #tp-eps-preview-modal button[title="Đóng"],
:is(html.dark, html[data-theme="dark"], body.dark) #tp-eps-builder-modal > div > .hw-border-b > button,
#tp-eps-preview-modal button[title="Đóng"],
#tp-eps-builder-modal > div > .hw-border-b > button {
  color: var(--tp-qb-text-sec) !important;
}
