/* ========================================================
   LiveClass AI - High Contrast & Eye-Friendly Stylesheet
   ======================================================== */

.hidden {
  display: none !important;
}

/* Root & Theme Variables */
:root {
  --font-family: 'Prompt', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* ========================================================
   1. LIGHT THEME (พื้นสีขาว ตัวหนังสือสีดำ สบายตา อ่านง่าย คมชัด)
   ======================================================== */
html.theme-light,
html:not(.theme-dark) {
  color-scheme: light;
}

html.theme-light body {
  background-color: #f8fafc !important; /* Soft warm paper white */
  color: #0f172a !important; /* Crisp black/slate text */
}

/* Header & Toolbars */
html.theme-light header {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04) !important;
}

html.theme-light header h1 {
  color: #0f172a !important;
}

html.theme-light section {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
}

/* Main workspace containers & panels */
html.theme-light .lg\:col-span-7,
html.theme-light .lg\:col-span-5 {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05) !important;
}

html.theme-light .bg-slate-900,
html.theme-light .bg-slate-900\/60,
html.theme-light .bg-slate-900\/80,
html.theme-light .bg-slate-900\/90,
html.theme-light .bg-slate-900\/95 {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
}

html.theme-light .bg-slate-950,
html.theme-light .bg-slate-950\/40,
html.theme-light .bg-slate-950\/60,
html.theme-light .bg-slate-950\/80 {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

/* Slate Buttons & Neutral Controls */
html.theme-light .bg-slate-800,
html.theme-light .bg-slate-800\/60,
html.theme-light .bg-slate-800\/80 {
  background-color: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html.theme-light .bg-slate-800:hover,
html.theme-light .hover\:bg-slate-700:hover {
  background-color: #e2e8f0 !important;
  color: #000000 !important;
}

/* Text Colors */
html.theme-light .text-white,
html.theme-light .text-slate-100,
html.theme-light .text-slate-200 {
  color: #0f172a !important; /* Black font for maximum clarity */
}

html.theme-light .text-slate-300 {
  color: #1e293b !important;
}

html.theme-light .text-slate-400 {
  color: #475569 !important; /* High-contrast readable gray */
}

html.theme-light .text-slate-500 {
  color: #64748b !important;
}

html.theme-light .border-slate-800,
html.theme-light .border-slate-700,
html.theme-light .border-slate-700\/60,
html.theme-light .border-slate-700\/80 {
  border-color: #e2e8f0 !important;
}

/* Inputs, Selects, and Dropdowns */
html.theme-light input,
html.theme-light select,
html.theme-light textarea {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html.theme-light input::placeholder,
html.theme-light textarea::placeholder {
  color: #94a3b8 !important;
}

html.theme-light #demoMenuDropdown {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.08) !important;
}

html.theme-light #demoMenuDropdown button {
  color: #0f172a !important;
  border-color: #f1f5f9 !important;
}

html.theme-light #demoMenuDropdown button:hover {
  background-color: #f1f5f9 !important;
}

/* Visualizer & VU Meter */
html.theme-light #visualizerContainer {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

html.theme-light #visualizerContainer .w-16.h-2 {
  background-color: #e2e8f0 !important;
  border-color: #cbd5e1 !important;
}

/* File Upload Drawer */
html.theme-light #fileUploadSection {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

html.theme-light #fileUploadSection label {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
}

html.theme-light #filePlayerContainer {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

/* Interim Live Speaking Indicator */
html.theme-light #interimContainer {
  background: linear-gradient(to right, #f0f9ff, #ffffff) !important;
  border-color: #bae6fd !important;
}

html.theme-light #interimEnglish {
  color: #000000 !important;
  font-size: 1.05rem !important;
  font-weight: 600 !important;
}

/* Transcript Cards (รายการข้อความและคำแปล) */
html.theme-light div[id^="transcript-"] {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04) !important;
}

html.theme-light div[id^="transcript-"]:hover {
  border-color: #cbd5e1 !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.06) !important;
}

/* English Text in Transcripts: Black & Crisp */
html.theme-light div[id^="transcript-"] .text-slate-100,
html.theme-light div[id^="transcript-"] .font-medium.text-slate-100 {
  color: #000000 !important;
  font-size: 1.05rem !important;
  font-weight: 600 !important;
  line-height: 1.5 !important;
}

/* Thai Phonetics Reading Box (คำอ่านไทย: พื้นเขียวอ่อน ตัวหนังสือเขียวเข้ม ชัดเจน สบายตา) */
html.theme-light .bg-emerald-950\/50,
html.theme-light .bg-emerald-950\/60,
html.theme-light .bg-emerald-950\/70,
html.theme-light #interimPhoneticsBox,
html.theme-light #latestQuestionPhoneticsBox {
  background-color: #ecfdf5 !important;
  border-color: #6ee7b7 !important;
}

html.theme-light .bg-emerald-950\/50 span,
html.theme-light .bg-emerald-950\/60 span,
html.theme-light .bg-emerald-950\/70 span,
html.theme-light .text-emerald-100,
html.theme-light .text-emerald-200,
html.theme-light .text-emerald-300 {
  color: #064e3b !important;
  font-weight: 700 !important;
}

/* Karaoke English Reading Box (คาราโอเกะ: พื้นม่วงอ่อน ตัวหนังสือม่วงเข้ม คมชัด) */
html.theme-light .bg-fuchsia-950\/30,
html.theme-light .bg-fuchsia-950\/40,
html.theme-light .bg-fuchsia-950\/50,
html.theme-light #interimKaraokeBox,
html.theme-light #latestQuestionKaraokeBox {
  background-color: #fdf4ff !important;
  border-color: #f0abfc !important;
}

html.theme-light .bg-fuchsia-950\/30 span,
html.theme-light .bg-fuchsia-950\/40 span,
html.theme-light .bg-fuchsia-950\/50 span,
html.theme-light .text-fuchsia-100,
html.theme-light .text-fuchsia-200,
html.theme-light .text-fuchsia-300 {
  color: #581c87 !important;
  font-weight: 700 !important;
}

/* Thai Translation Box (แปลไทย: พื้นฟ้าอ่อน ตัวหนังสือน้ำเงินเข้ม ชัดเจน) */
html.theme-light .bg-cyan-950\/20,
html.theme-light .bg-cyan-950\/30,
html.theme-light .bg-cyan-950\/60,
html.theme-light #interimThaiBox,
html.theme-light #latestQuestionThaiBox {
  background-color: #f0f9ff !important;
  border-color: #bae6fd !important;
}

html.theme-light .bg-cyan-950\/20 span,
html.theme-light .bg-cyan-950\/30 span,
html.theme-light .bg-cyan-950\/60 span,
html.theme-light .text-cyan-100,
html.theme-light .text-cyan-200,
html.theme-light .text-cyan-300 {
  color: #0c4a6e !important;
  font-weight: 600 !important;
}

/* Teacher Question Detected Card */
html.theme-light .question-detected-card,
html.theme-light .bg-gradient-to-r.from-amber-950\/30 {
  background: linear-gradient(to right, #fffbeb, #ffffff) !important;
  border-color: #f59e0b !important;
}

html.theme-light .text-amber-300,
html.theme-light .text-amber-200,
html.theme-light .text-amber-400 {
  color: #78350f !important;
}

html.theme-light #latestQuestionBox {
  background-color: #fffbeb !important;
  border-color: #fde68a !important;
  color: #000000 !important;
  font-size: 1.05rem !important;
  font-weight: 600 !important;
}

/* AI Suggested Answers Cards */
html.theme-light #answersContainer > div {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05) !important;
}

html.theme-light #answersContainer > div .bg-slate-950\/80 {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #000000 !important;
  font-size: 1.05rem !important;
  font-weight: 700 !important;
}

/* Modals (หน้าต่างป๊อปอัปทั้งหมด: พื้นขาว ตัวหนังสือดำ ชัดเจน) */
html.theme-light #settingsModal > div,
html.theme-light #tabAudioGuideModal > div,
html.theme-light #externalMicGuideModal > div,
html.theme-light #micTestModal > div {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15) !important;
}

html.theme-light #settingsModal h3,
html.theme-light #tabAudioGuideModal h3,
html.theme-light #externalMicGuideModal h3,
html.theme-light #micTestModal h3 {
  color: #0f172a !important;
}

html.theme-light #micTestModal .bg-slate-950 {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

html.theme-light #testModalSpeechResult {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

/* Custom Scrollbars in Light Mode */
html.theme-light ::-webkit-scrollbar-track {
  background: #f1f5f9;
}
html.theme-light ::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
html.theme-light ::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ========================================================
   2. DARK THEME (สำหรับผู้ใช้ที่ต้องการเปิดใช้งานตอนกลางคืน)
   ======================================================== */
html.theme-dark {
  color-scheme: dark;
}

html.theme-dark ::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
}
html.theme-dark ::-webkit-scrollbar-thumb {
  background: rgba(51, 65, 85, 0.8);
  border-radius: 9999px;
}
html.theme-dark ::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 1);
}

/* Animations & Effects */
@keyframes questionGlow {
  0%, 100% {
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.25), inset 0 0 10px rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.7);
  }
  50% {
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.45), inset 0 0 15px rgba(245, 158, 11, 0.2);
    border-color: rgba(251, 191, 36, 1);
  }
}

.question-detected-card {
  animation: questionGlow 2s infinite ease-in-out;
}

@keyframes fadeInSlideUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-entry {
  animation: fadeInSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Selection Highlight */
html.theme-light ::selection {
  background-color: #38bdf8;
  color: #000000;
}

/* ========================================================
   3. DYNAMIC FONTS & FONT SIZES
   ======================================================== */
:root {
  --app-font: 'Prompt', sans-serif;
  --transcript-font-size: 16px;
}

body, html, 
body input, body button, body select, body textarea,
#transcriptList, #answersContainer, #mainWorkspace, .font-sans {
  font-family: var(--app-font) !important;
}

/* Font Class Overrides */
.font-prompt { font-family: 'Prompt', sans-serif !important; }
.font-sarabun { font-family: 'Sarabun', sans-serif !important; }
.font-kanit { font-family: 'Kanit', sans-serif !important; }
.font-mitr { font-family: 'Mitr', sans-serif !important; }
.font-chakra { font-family: 'Chakra Petch', sans-serif !important; }
.font-inter { font-family: 'Inter', sans-serif !important; }
.font-roboto { font-family: 'Roboto', sans-serif !important; }

/* Dynamic Font Sizing for Transcripts and Answers */
#transcriptList .transcript-english-text,
#transcriptList div[id^="transcript-"] .text-slate-100,
#transcriptList div[id^="transcript-"] .font-medium.text-slate-100 {
  font-size: var(--transcript-font-size) !important;
  line-height: 1.55 !important;
}

#transcriptList .phonetics-thai-text,
#transcriptList .phonetics-row {
  font-size: calc(var(--transcript-font-size) * 0.88) !important;
}

#transcriptList .thai-content {
  font-size: calc(var(--transcript-font-size) * 0.94) !important;
}

/* Bookmark Star Animation */
.bookmark-star-btn.bookmarked i,
.bookmark-star-btn.bookmarked svg {
  fill: #f59e0b !important;
  color: #f59e0b !important;
}

/* Layout Transition */
#leftPaneContainer, #rightPaneContainer {
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* PDF Print Document Styling */
.pdf-document {
  font-family: 'Sarabun', 'Prompt', sans-serif;
  color: #0f172a;
  background-color: #ffffff;
  padding: 24px;
  max-width: 800px;
  margin: 0 auto;
}
.pdf-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
}
.pdf-table th {
  background-color: #f1f5f9;
  color: #0f172a;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 2px solid #cbd5e1;
  font-size: 11px;
}
.pdf-table td {
  padding: 10px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 11px;
  vertical-align: top;
}

