/* ==========================================================================
   BILIM HOME — "Жеңіл әрі түсінікті" дизайн-жүйесі
   ------------------------------------------------------------------------
   Мақсаты: ерекше білім беруді қажет ететін оқушыларға, олардың ата-анасы
   мен мұғалімдеріне арналған интерфейсті сабырлы, оқуға жеңіл және
   болжамды ету. Бұл файл styles.css-ті АЛМАСТЫРМАЙДЫ, тек оның үстіне
   қосымша қабат ретінде жүктеледі. Ешбір JS логикасына (ID, onclick,
   деректерді жүктеу) тиіспейді — тек көрініс (CSS) және таза UI
   көмекшілерін (accordion/tab/қолжетімділік виджеті) қамтамасыз етеді.
   ========================================================================== */

:root {
  --bh-radius-lg: 20px;
  --bh-radius-md: 14px;
  --bh-radius-sm: 10px;
  --bh-shadow-soft: 0 2px 10px -2px rgba(30, 41, 59, 0.08), 0 1px 3px rgba(30, 41, 59, 0.06);
  --bh-shadow-soft-hover: 0 8px 24px -6px rgba(30, 41, 59, 0.14);
  --bh-border: #e6eaf0;
  --bh-ink: #1f2937;
  --bh-ink-soft: #55606e;
  --bh-brand: #2563eb;
  --bh-brand-dark: #1d4ed8;
  --bh-brand-soft: #eef3ff;
  --bh-good: #059669;
  --bh-warn: #d97706;
  --bh-focus: #2563eb;
}

/* --------------------------------------------------------------------------
   1. Негізгі оқылым: сабырлы қаріп, анық жол аралығы
   -------------------------------------------------------------------------- */
.bh-page {
  color: var(--bh-ink);
  line-height: 1.55;
  letter-spacing: 0.005em;
}

.bh-page h1, .bh-page h2, .bh-page h3 {
  letter-spacing: -0.01em;
}

/* Барлық жерде пернетақтамен жүргенде анық фокус көрінеді (қолжетімділік) */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--bh-focus) !important;
  outline-offset: 2px !important;
  border-radius: 6px;
}

/* Пайдаланушының OS деңгейінде "қозғалысты азайту" қосылған болса, құрметтейміз */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   2. Тыныш карточка стилі — грейдиент/шыны эффектін жұмсартады
   -------------------------------------------------------------------------- */
.bh-card {
  background: #ffffff;
  border: 1px solid var(--bh-border);
  border-radius: var(--bh-radius-lg);
  box-shadow: var(--bh-shadow-soft);
}

.bh-card-flat {
  background: #f8fafc;
  border: 1px solid var(--bh-border);
  border-radius: var(--bh-radius-md);
}

/* Ескі glass-card / glow-effect тым тітіркендіргіш — жұмсартамыз, бірақ жоймаймыз */
.bh-page .glass-card {
  backdrop-filter: none;
  background: #ffffff;
}
.bh-page .glow-effect {
  box-shadow: 0 0 0 rgba(0,0,0,0);
}

.bh-hero {
  border-radius: var(--bh-radius-lg);
  box-shadow: var(--bh-shadow-soft);
}

/* Секция айырушы тақырып: үлкенірек, түсінікті иерархия */
.bh-section-title {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--bh-ink);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.bh-section-sub {
  color: var(--bh-ink-soft);
  font-size: 0.85rem;
}

/* --------------------------------------------------------------------------
   3. Навигация: үлкен түйме, анық белсенді күй
   -------------------------------------------------------------------------- */
.bh-nav-btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: 12px;
  font-weight: 600;
}
.bh-nav-btn.text-brand-600 {
  box-shadow: inset 0 0 0 1.5px rgba(37, 99, 235, 0.25);
}

/* Мобильді төменгі навигацияда түймелер үлкенірек болсын */
.bh-mobile-nav a, .bh-mobile-nav button {
  min-height: 48px;
  min-width: 48px;
}

/* --------------------------------------------------------------------------
   4. "Толығырақ көрсету" аккордеон — қосымша ақпаратты жасырады,
      бірінші қарауда экранды жеңілдетеді. Таза CSS/JS, деректі өзгертпейді.
   -------------------------------------------------------------------------- */
details.bh-accordion {
  background: #ffffff;
  border: 1px solid var(--bh-border);
  border-radius: var(--bh-radius-lg);
  overflow: hidden;
}
details.bh-accordion > summary {
  cursor: pointer;
  list-style: none;
  padding: 1rem 1.25rem;
  font-weight: 700;
  color: var(--bh-ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  user-select: none;
}
details.bh-accordion > summary::-webkit-details-marker { display: none; }
details.bh-accordion > summary .bh-accordion-arrow {
  transition: transform 0.2s ease;
  color: var(--bh-ink-soft);
}
details.bh-accordion[open] > summary .bh-accordion-arrow {
  transform: rotate(180deg);
}
details.bh-accordion > summary:hover { background: #f8fafc; }
details.bh-accordion > .bh-accordion-body {
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid var(--bh-border);
  padding-top: 1rem;
}

/* --------------------------------------------------------------------------
   5. Қойындылар (tabs) — мұғалім бетіндегі көп панельді бір-бірлеп көрсету
   -------------------------------------------------------------------------- */
.bh-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  border-bottom: 1px solid var(--bh-border);
  padding-bottom: 0.6rem;
}
.bh-tab-btn {
  min-height: 40px;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--bh-ink-soft);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.bh-tab-btn:hover { background: #f1f5f9; color: var(--bh-ink); }
.bh-tab-btn[aria-selected="true"] {
  background: var(--bh-brand-soft);
  color: var(--bh-brand-dark);
  border-color: rgba(37, 99, 235, 0.25);
}
.bh-tab-btn .bh-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.3em;
  padding: 0 0.35em;
  margin-left: 0.35em;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--bh-brand-dark);
  font-size: 0.75em;
}
.bh-tab-panel { display: none; }
.bh-tab-panel[hidden] { display: none !important; }
.bh-tab-panel.bh-tab-panel-active { display: block !important; }

/* --------------------------------------------------------------------------
   6. "Бүгін не істеу керек" фокус-карточка (student.html)
   -------------------------------------------------------------------------- */
.bh-focus-card {
  border: 2px solid rgba(37, 99, 235, 0.15);
  border-radius: var(--bh-radius-lg);
  background: linear-gradient(180deg, #ffffff 0%, #f7f9ff 100%);
}

/* --------------------------------------------------------------------------
   7. Қолжетімділік виджеті (assets/js/accessibility-widget.js жасайды)
   -------------------------------------------------------------------------- */
#bh-a11y-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: var(--bh-brand);
  color: #fff;
  border: none;
  box-shadow: 0 8px 20px -4px rgba(37, 99, 235, 0.45);
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#bh-a11y-toggle:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -4px rgba(37,99,235,0.55); }

#bh-a11y-panel {
  position: fixed;
  right: 18px;
  bottom: 84px;
  z-index: 200;
  width: min(320px, calc(100vw - 36px));
  background: #ffffff;
  border: 1px solid var(--bh-border);
  border-radius: var(--bh-radius-lg);
  box-shadow: 0 16px 40px -8px rgba(15, 23, 42, 0.25);
  padding: 1.1rem;
  display: none;
}
#bh-a11y-panel.bh-a11y-open { display: block; }
#bh-a11y-panel h4 {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--bh-ink);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.bh-a11y-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0;
  border-top: 1px solid #f1f5f9;
}
.bh-a11y-row:first-of-type { border-top: none; }
.bh-a11y-row span { font-size: 0.85rem; font-weight: 600; color: var(--bh-ink-soft); }
.bh-a11y-fontgroup { display: flex; gap: 0.3rem; }
.bh-a11y-fontgroup button {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--bh-border);
  background: #f8fafc;
  font-weight: 700;
  cursor: pointer;
  color: var(--bh-ink);
}
.bh-a11y-fontgroup button[aria-pressed="true"] {
  background: var(--bh-brand);
  color: #fff;
  border-color: var(--bh-brand);
}
.bh-a11y-switch {
  position: relative;
  width: 42px; height: 24px;
  border-radius: 999px;
  background: #cbd5e1;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
  flex-shrink: 0;
}
.bh-a11y-switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 999px;
  background: #fff;
  transition: transform 0.15s ease;
}
.bh-a11y-switch[aria-pressed="true"] { background: var(--bh-brand); }
.bh-a11y-switch[aria-pressed="true"]::after { transform: translateX(18px); }
#bh-a11y-reset {
  margin-top: 0.7rem;
  width: 100%;
  padding: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--bh-ink-soft);
  background: #f1f5f9;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
#bh-a11y-reset:hover { background: #e2e8f0; }

/* --------------------------------------------------------------------------
   8. Қолжетімділік режимдері (html элементіне қосылатын кластар)
   -------------------------------------------------------------------------- */
html.bh-font-lg { font-size: 18px; }
html.bh-font-xl { font-size: 20px; }

html.bh-dyslexia-font body,
html.bh-dyslexia-font input,
html.bh-dyslexia-font textarea,
html.bh-dyslexia-font select,
html.bh-dyslexia-font button {
  font-family: 'Lexend', 'Inter', sans-serif !important;
}

html.bh-motion-off *, html.bh-motion-off *::before, html.bh-motion-off *::after {
  animation: none !important;
  transition: none !important;
}
html.bh-motion-off .glass-card, html.bh-motion-off .glass {
  backdrop-filter: none !important;
}

html.bh-contrast body { background: #ffffff !important; }
html.bh-contrast .bh-card,
html.bh-contrast .glass-card,
html.bh-contrast [class*="bg-white"],
html.bh-contrast [class*="bg-slate-50"] {
  background: #ffffff !important;
  border: 2px solid #000000 !important;
  box-shadow: none !important;
}
html.bh-contrast body, html.bh-contrast p, html.bh-contrast span, html.bh-contrast div,
html.bh-contrast h1, html.bh-contrast h2, html.bh-contrast h3, html.bh-contrast h4,
html.bh-contrast li, html.bh-contrast td, html.bh-contrast th, html.bh-contrast label {
  color: #000000 !important;
}
html.bh-contrast [class*="text-white"] { color: #000000 !important; }
html.bh-contrast a, html.bh-contrast button {
  text-decoration-thickness: 2px;
}
html.bh-contrast [class*="bg-gradient-to-r"],
html.bh-contrast [class*="bg-gradient-to-br"] {
  background-image: none !important;
  background-color: #0f172a !important;
  color: #ffffff !important;
}
html.bh-contrast [class*="bg-gradient-to-r"] *,
html.bh-contrast [class*="bg-gradient-to-br"] * {
  color: #ffffff !important;
}

/* --------------------------------------------------------------------------
   9. Кірпіш экрандар (mobile) — түймелер бір-бірінен алшақ, саусаққа қолайлы
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .bh-section-title { font-size: 1rem; }
  #bh-a11y-toggle { right: 12px; bottom: 12px; width: 50px; height: 50px; font-size: 1.2rem; }
  #bh-a11y-panel { right: 12px; bottom: 72px; }
}

/* Page title banner (teacher + shared) */
.bh-page-banner {
  position: relative;
  overflow: hidden;
  padding: 1.35rem 1.5rem 1.5rem;
  border-radius: 1.6rem;
  background:
    radial-gradient(ellipse 80% 120% at 100% 0%, rgba(167, 139, 250, 0.28), transparent 55%),
    radial-gradient(ellipse 70% 100% at 0% 100%, rgba(56, 189, 248, 0.3), transparent 50%),
    linear-gradient(135deg, #e0f2fe 0%, #f8fafc 48%, #ede9fe 100%);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow:
    0 14px 36px rgba(56, 189, 248, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.bh-page-banner-title {
  position: relative;
  margin: 0;
  font-family: 'Lexend', 'Inter', sans-serif;
  font-size: clamp(1.55rem, 2.8vw, 2.15rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: #0b1f44;
  -webkit-text-stroke: 3.5px #ffffff;
  paint-order: stroke fill;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95),
    0 6px 16px rgba(15, 23, 42, 0.14);
}
.bh-page-banner-sub {
  position: relative;
  margin: 0.5rem 0 0;
  max-width: 36rem;
  font-family: 'Lexend', 'Inter', sans-serif;
  font-size: clamp(0.95rem, 1.4vw, 1.08rem);
  font-weight: 600;
  line-height: 1.45;
  color: #1e293b;
  -webkit-text-stroke: 2px #ffffff;
  paint-order: stroke fill;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}

.teacher-profile-wrap {
  z-index: 40;
}
.teacher-profile-menu {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  min-width: 10.5rem;
  padding: 0.35rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.9rem;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.12);
  z-index: 40;
}
.teacher-profile-menu-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 0.7rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  text-align: left;
}
.teacher-profile-menu-item:hover {
  background: #f1f5f9;
}
.teacher-profile-menu-item[onclick*="logout"],
.teacher-profile-menu-item#logout-btn {
  color: #e11d48;
}
.teacher-profile-menu-item[onclick*="logout"]:hover,
.teacher-profile-menu-item#logout-btn:hover {
  background: #fff1f2;
}

.parent-profile-wrap {
  position: relative;
}
.parent-profile-menu {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  min-width: 10.5rem;
  padding: 0.35rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.9rem;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.12);
  z-index: 40;
}
.parent-profile-menu.hidden {
  display: none !important;
}
.parent-profile-menu-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 0.7rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  text-align: left;
  background: transparent;
  border: none;
  cursor: pointer;
}
.parent-profile-menu-item:hover {
  background: #f1f5f9;
}
.parent-profile-menu-item[onclick*="logout"] {
  color: #e11d48;
}
.parent-profile-menu-item[onclick*="logout"]:hover {
  background: #fff1f2;
}

/* Оқушы бетінде төменгі навигациямен қабаттаспасын */
@media (max-width: 768px) {
  body.bh-page.pb-20 #bh-a11y-toggle,
  body.bh-page[class*="pb-20"] #bh-a11y-toggle {
    bottom: 76px;
  }
  body.bh-page.pb-20 #bh-a11y-panel,
  body.bh-page[class*="pb-20"] #bh-a11y-panel {
    bottom: 140px;
  }
}
