/* ============================================================
   style.css — PQS Study With Love
   Fully Responsive: Mobile / Tablet / Desktop
   ============================================================ */

/* ---- Google Font ---- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---- CSS Variables ---- */
:root {
  --primary:   #a65330;
  --orange:    #f38820;
  --dark:      #1e293b;
  --text:      #374151;
  --muted:     #6b7280;
  --bg:        #f8fafc;
  --white:     #ffffff;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);
  --transition: all 0.25s ease;
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background-color: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }

/* Neutralize MS Word inline relative wrapper spans (robustly matches both "position:relative" and "position: relative") */
.question-text span[style*="relative"],
.option-text span[style*="relative"],
.lesson-body span[style*="relative"],
.explanation span[style*="relative"],
.theory-section span[style*="relative"] {
    position: static !important;
    top: auto !important;
    vertical-align: baseline !important;
}

/* Định nghĩa quy tắc hiển thị chuẩn cho Công thức Toán ở tất cả mọi nơi */
.math-formula {
    vertical-align: middle !important;
    display: inline-block !important;
    position: static !important;
    margin: 0 4px !important;
    max-width: 100% !important;
    height: auto !important;
}

/* Điều chỉnh vị trí của MathJax inline để khớp baseline và thẳng hàng hoàn hảo với chữ xung quanh */
mjx-container[jax="CHTML"]:not([display="true"]),
mjx-container[jax="SVG"]:not([display="true"]),
.MathJax {
    position: relative;
    top: -0.08em;
}

/* Kéo các ảnh inline thông thường không có class (math-formula) khớp baseline thẳng hàng */
.question-text img:not(.math-formula):not(.img-illustration), 
.lesson-body img:not(.math-formula):not(.img-illustration),
.option-text img:not(.math-formula):not(.img-illustration),
.explanation img:not(.math-formula):not(.img-illustration) {
    vertical-align: middle;
    position: relative;
    top: -0.06em; 
}

/* Các ảnh minh họa lớn (trong figure, class img-illustration hoặc căn giữa) hiển thị tĩnh chuẩn */
.img-illustration,
.question-text figure img, 
.lesson-body figure img, 
.question-text p.text-center img, 
.lesson-body p.text-center img {
    vertical-align: top !important;
    position: static !important;
    top: auto !important;
    display: block !important;
    margin: 15px auto !important;
    max-width: 100% !important;
    height: auto !important;
}

a { transition: var(--transition); }

/* ================================================================
   NAVBAR
   ================================================================ */
.navbar {
  background: var(--white) !important;
  border-bottom: 3px solid var(--orange);
  padding: 0.4rem 0;
  transition: box-shadow 0.3s;
}
.navbar.scrolled { box-shadow: var(--shadow-md); }

/* Logo */
.navbar-brand .logo-text-main {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 1;
}
.navbar-brand .logo-text-sub {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--primary);
}

/* Nav links */
.navbar .nav-link {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text) !important;
  padding: 0.5rem 0.65rem !important;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.navbar .nav-link:hover,
.navbar .nav-link.active-link {
  color: var(--orange) !important;
  background: rgba(243,136,32,0.08);
}

/* Dropdown */
.navbar .dropdown-menu {
  border: none;
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  min-width: 210px;
  animation: dropIn 0.2s ease;
}
@keyframes dropIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.navbar .dropdown-item {
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.9rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  transition: var(--transition);
}
.navbar .dropdown-item:hover {
  background: rgba(243,136,32,0.09);
  color: var(--orange);
}

/* Special buttons in nav */
.btn-nopbai {
  background: linear-gradient(90deg, var(--orange), var(--primary)) !important;
  color: white !important;
  border-radius: 50px !important;
  padding: 0.4rem 1rem !important;
  font-weight: 700 !important;
  font-size: 0.85rem !important;
}
.btn-nopbai:hover { opacity: 0.88; transform: translateY(-1px); }

.btn-login {
  background: var(--dark) !important;
  color: white !important;
  border-radius: 50px !important;
  padding: 0.4rem 1rem !important;
  font-size: 0.85rem !important;
}
.btn-login:hover { background: #334155 !important; }

/* Mobile navbar collapse */
@media (max-width: 1199.98px) {
  .navbar .nav-link { padding: 0.6rem 0.8rem !important; }
  .navbar-collapse {
    background: var(--white);
    border-top: 1px solid #f0f0f0;
    padding: 0.75rem 0;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
  }
  .navbar .dropdown-menu {
    box-shadow: none;
    border: 1px solid #f0f0f0;
  }
  .navbar .navbar-nav { gap: 0 !important; }
  .btn-nopbai, .btn-login { margin-left: 0.65rem; width: fit-content; }
}

/* ================================================================
   HERO SECTION
   ================================================================ */
.hero-section {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  padding: 5rem 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero-section .hero-badge {
  background: rgba(243,136,32,0.15);
  color: var(--orange);
  border: 1px solid rgba(243,136,32,0.3);
  border-radius: 50px;
  padding: 0.4rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 700;
  display: inline-block;
  margin-bottom: 1.25rem;
}
.hero-section h1 { color: white; font-weight: 800; }
.hero-section h2 { color: var(--orange); }
.hero-section p  { color: rgba(255,255,255,0.75); }

@media (max-width: 767.98px) {
  .hero-section { padding: 3.5rem 0; }
  .hero-section h1 { font-size: 1.9rem !important; }
  .hero-section h2 { font-size: 1.3rem !important; }
  .hero-section p  { font-size: 0.95rem; }
}

/* ================================================================
   COURSE CARDS
   ================================================================ */
.course-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  height: 100%;
}
.course-card:hover {
  transform: translateY(-7px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(243,136,32,0.2);
}
.course-icon { font-size: 2.8rem; margin-bottom: 1rem; }

/* ================================================================
   BLOG / NEWS CARDS
   ================================================================ */
.blog-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
  border: none;
}
.blog-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.blog-card img { height: 200px; object-fit: cover; width: 100%; }

/* ================================================================
   SECTIONS & CONTAINERS
   ================================================================ */
section { padding: 4rem 0; }

@media (max-width: 767.98px) {
  section { padding: 2.5rem 0; }
  .container { padding-left: 1rem; padding-right: 1rem; }
  h2 { font-size: 1.5rem !important; }
  h3 { font-size: 1.2rem !important; }
}

/* ================================================================
   LESSON PAGE
   ================================================================ */
.lesson-container { padding-top: 2rem; padding-bottom: 3rem; }

.theory-section {
  background: var(--white);
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.practice-section {
  position: sticky;
  top: 75px;
}
.iframe-container {
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.iframe-container iframe { width: 100%; border: none; display: block; }

/* Stack lesson layout on mobile */
@media (max-width: 991.98px) {
  .practice-section { position: static; margin-top: 2rem; }
  .theory-section { padding: 1.25rem; }
  .iframe-container iframe { min-height: 340px; }
}

/* ================================================================
   CODE BLOCKS
   ================================================================ */
pre {
  background: var(--dark);
  color: #a3e635;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.7;
}
code { font-family: 'Courier New', monospace; }

/* ================================================================
   FORMS
   ================================================================ */
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border: 1.5px solid #e5e7eb;
  font-size: 0.95rem;
  transition: var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(243,136,32,0.15);
}

/* ================================================================
   FOOTER
   ================================================================ */
.footer {
  background: #1a252f;
  color: #ecf0f1;
  padding-top: 3rem;
  padding-bottom: 1.5rem;
}
.footer a { transition: var(--transition); }
.footer a:hover { color: var(--orange) !important; }

@media (max-width: 767.98px) {
  .footer .row > div { margin-bottom: 2rem; }
  .footer h5 { font-size: 1rem; }
}

/* ================================================================
   UTILITY / REUSABLE
   ================================================================ */
.btn-primary-custom {
  background: linear-gradient(90deg, var(--orange), var(--primary));
  color: white;
  padding: 0.65rem 1.8rem;
  border-radius: 50px;
  font-weight: 700;
  border: none;
  transition: var(--transition);
}
.btn-primary-custom:hover {
  opacity: 0.9;
  transform: translateY(-2px);
  color: white;
}

.section-title {
  color: var(--primary);
  font-weight: 800;
  position: relative;
}

/* Card hover lift */
.card-lift { transition: var(--transition); }
.card-lift:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }

/* Badges */
.badge { font-weight: 600; letter-spacing: 0.3px; }

/* Scrollbar thin */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: var(--orange); border-radius: 4px; }

/* ================================================================
   ACCORDION (Lesson roadmaps)
   ================================================================ */
.accordion-button:not(.collapsed) {
  background: rgba(243,136,32,0.08);
  color: var(--primary);
  font-weight: 700;
}
.accordion-button:focus { box-shadow: none; }
.accordion-item { border-radius: var(--radius-sm) !important; margin-bottom: 0.5rem; }

/* ================================================================
   NAVBAR SCROLL SHRINK (JS supported)
   ================================================================ */
.navbar.navbar-shrink { padding: 0.2rem 0; }
