/* ==========================================================================
   AdhyayShree - Online Study & Examination Platform (Classes 6–12)
   Design System: Bootstrap 5 Enhanced with Accessible Typography & Responsive Spacing
   Managed by QuickB AI Solution Pvt. Ltd. (https://quickbaisolution.com/)
   Canonical Origin: https://adhyayshree.com
   ========================================================================== */

:root {
  /* Official Brand Palette: Deep Navy Blue & Saffron Orange */
  --as-navy: #15284b;               /* Primary Brand Navy */
  --as-navy-dark: #0d1a33;          /* Deepest Navy for headers/topbar */
  --as-navy-light: #203a6b;         /* Lighter Navy for secondary elements */
  --as-saffron: #f26522;            /* Vibrant Saffron Orange */
  --as-saffron-hover: #d85213;      /* Darkened Saffron for hover states */
  --as-saffron-light: #fff3ec;      /* Pale Saffron for badge/card highlights */
  --as-accent: #f59e0b;             /* Amber notice / stars */
  --as-success: #10b981;            /* Emerald 500 */
  --as-info: #0284c7;               /* Sky 600 */
  --as-dark: #0f172a;               /* Slate 900 */
  --as-light: #f8fafc;              /* Slate 50 background */
  --as-card-bg: #ffffff;
  --as-border: #e2e8f0;             /* Border subtle */
  --as-text-main: #1e293b;          /* Text Slate 800 */
  --as-text-muted: #64748b;         /* Text Slate 500 */

  /* Backward Compatibility Tokens */
  --bb-primary: var(--as-navy);
  --bb-primary-hover: var(--as-navy-dark);
  --bb-secondary: var(--as-saffron);
  --bb-accent: var(--as-accent);
  --bb-dark: var(--as-dark);
  --bb-light: var(--as-light);
  --bb-card-bg: var(--as-card-bg);
  --bb-border: var(--as-border);
  --bb-text-main: var(--as-text-main);
  --bb-text-muted: var(--as-text-muted);

  /* Typography & Layout Spacing */
  --as-font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --as-border-radius: 0.625rem;
  --as-box-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --as-box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --as-box-shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --as-transition: all 0.2s ease-in-out;
}

body {
  font-family: var(--as-font-sans);
  color: var(--as-text-main);
  background-color: var(--as-light);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1 0 auto;
}

/* Accessible focus ring */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--as-saffron);
  outline-offset: 2px;
}

/* ==========================================================================
   Brand Logo & Icon Styling (Responsive, No Stretch/Distortion)
   ========================================================================== */
.brand-logo-img {
  height: 42px;
  width: auto;
  max-width: 210px;
  object-fit: contain;
  display: block;
  transition: var(--as-transition);
}

.footer-logo-img {
  height: 46px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  display: block;
}

.login-brand-logo-img {
  height: 50px;
  width: auto;
  max-width: 230px;
  object-fit: contain;
  display: inline-block;
}

.admin-brand-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 6px;
  display: inline-block;
}

@media (max-width: 576px) {
  .brand-logo-img {
    height: 34px;
    max-width: 170px;
  }
  .footer-logo-img {
    height: 38px;
    max-width: 180px;
  }
}

/* ==========================================================================
   Navigation Styling
   ========================================================================== */
.navbar {
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
  transition: var(--as-transition);
}

.nav-link {
  font-weight: 500;
  color: var(--as-text-main);
  padding: 0.5rem 0.85rem !important;
  border-radius: 6px;
  transition: var(--as-transition);
}

.nav-link:hover, .nav-link.active {
  color: var(--as-saffron) !important;
  background-color: var(--as-saffron-light);
}

/* Cards & Badges */
.card {
  border: 1px solid var(--as-border);
  border-radius: var(--as-border-radius);
  background-color: var(--as-card-bg);
  box-shadow: var(--as-box-shadow-sm);
  transition: var(--as-transition);
}

.card-hover:hover {
  transform: translateY(-3px);
  box-shadow: var(--as-box-shadow-lg);
  border-color: #cbd5e1;
}

.badge-adhyayshree,
.badge-bihar {
  background-color: var(--as-saffron-light);
  color: var(--as-saffron);
  border: 1px solid #fed7aa;
  font-weight: 600;
  border-radius: 9999px;
  padding: 0.4rem 0.95rem;
}

/* ==========================================================================
   Hero Section Styling
   ========================================================================== */
.hero-section {
  background: linear-gradient(180deg, #f1f5f9 0%, #ffffff 100%);
  border-bottom: 1px solid var(--as-border);
  padding: 4.5rem 0 3.5rem;
}

/* ==========================================================================
   Buttons & Interactive Elements
   ========================================================================== */
.btn-primary-adhyayshree,
.btn-primary-bihar {
  background-color: var(--as-saffron);
  border-color: var(--as-saffron);
  color: #ffffff !important;
  font-weight: 600;
  border-radius: 8px;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  transition: var(--as-transition);
}

.btn-primary-adhyayshree:hover,
.btn-primary-bihar:hover {
  background-color: var(--as-saffron-hover);
  border-color: var(--as-saffron-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(242, 101, 34, 0.25);
}

.btn-outline-primary {
  color: var(--as-navy);
  border-color: var(--as-navy);
  font-weight: 600;
  border-radius: 8px;
  transition: var(--as-transition);
}

.btn-outline-primary:hover {
  background-color: var(--as-navy);
  border-color: var(--as-navy);
  color: #ffffff;
}

.btn-navy {
  background-color: var(--as-navy);
  border-color: var(--as-navy);
  color: #ffffff !important;
  font-weight: 600;
  border-radius: 8px;
  transition: var(--as-transition);
}

.btn-navy:hover {
  background-color: var(--as-navy-dark);
  border-color: var(--as-navy-dark);
}

/* ==========================================================================
   Footer & Attribution Credit
   ========================================================================== */
footer {
  background-color: var(--as-navy-dark);
  color: #94a3b8;
  font-size: 0.925rem;
}

footer a {
  color: #cbd5e1;
  text-decoration: none;
  transition: var(--as-transition);
}

footer a:hover {
  color: var(--as-saffron);
}

.footer-attribution {
  font-size: 0.85rem;
  color: #94a3b8;
}

.attribution-link {
  color: #ffffff !important;
  font-weight: 600;
  text-decoration: underline !important;
  text-underline-offset: 3px;
  transition: var(--as-transition);
}

.attribution-link:hover {
  color: var(--as-saffron) !important;
}

/* Empty States & Alert Enhancements */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--as-text-muted);
}

.empty-state i {
  font-size: 3rem;
  color: #cbd5e1;
  margin-bottom: 1rem;
}

/* ==========================================================================
   Admin Console Navigation & Dark Mode Design System
   ========================================================================== */
.admin-topbar {
  background-color: #0d1a33 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.admin-topbar .navbar-brand {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.admin-topbar .nav-link {
  color: #cbd5e1 !important;
  font-weight: 500;
  padding: 0.45rem 0.85rem !important;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--as-transition);
}

.admin-topbar .nav-link:hover {
  color: #ffffff !important;
  background-color: rgba(255, 255, 255, 0.08) !important;
}

.admin-topbar .nav-link.active {
  color: #ffffff !important;
  background-color: var(--as-saffron) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.admin-topbar .nav-link i {
  font-size: 1.05rem;
}

.admin-footer {
  background-color: #ffffff;
  border-color: #e2e8f0 !important;
  color: #64748b;
  transition: var(--as-transition);
}

/* ==========================================================================
   Bootstrap 5.3+ Dark Mode Integration (data-bs-theme="dark")
   ========================================================================== */
[data-bs-theme="dark"] {
  --as-navy: #1e3a8a;
  --as-navy-dark: #090f1d;
  --as-card-bg: #1e293b;
  --as-border: #334155;
  --as-text-main: #f1f5f9;
  --as-text-muted: #94a3b8;
  --as-light: #0f172a;
}

[data-bs-theme="dark"] body {
  background-color: #0f172a !important;
  color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .bg-light,
[data-bs-theme="dark"] .bg-body-tertiary {
  background-color: #1e293b !important;
  color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .text-dark {
  color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .text-muted {
  color: #94a3b8 !important;
}

[data-bs-theme="dark"] .card {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.25) !important;
}

[data-bs-theme="dark"] .admin-footer {
  background-color: #0b1324 !important;
  border-color: #1e293b !important;
  color: #94a3b8 !important;
}

[data-bs-theme="dark"] .admin-footer a {
  color: #cbd5e1 !important;
}

[data-bs-theme="dark"] .table {
  color: #f1f5f9 !important;
  border-color: #334155 !important;
}

[data-bs-theme="dark"] .table > :not(caption) > * > * {
  background-color: #1e293b !important;
  color: #f1f5f9 !important;
  border-bottom-color: #334155 !important;
}

[data-bs-theme="dark"] .table-light,
[data-bs-theme="dark"] .table-light th,
[data-bs-theme="dark"] .table-light td {
  background-color: #27354a !important;
  color: #f1f5f9 !important;
  border-color: #334155 !important;
}

[data-bs-theme="dark"] .table-hover > tbody > tr:hover > * {
  background-color: #28374d !important;
}

[data-bs-theme="dark"] .dropdown-menu {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6) !important;
}

[data-bs-theme="dark"] .dropdown-item {
  color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus {
  background-color: #334155 !important;
  color: #ffffff !important;
}

[data-bs-theme="dark"] .dropdown-divider {
  border-top-color: #334155 !important;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
  background-color: #0f172a !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
  background-color: #0f172a !important;
  border-color: var(--as-saffron) !important;
  color: #ffffff !important;
  box-shadow: 0 0 0 0.25rem rgba(242, 101, 34, 0.25) !important;
}

[data-bs-theme="dark"] .form-control::placeholder {
  color: #64748b !important;
}

[data-bs-theme="dark"] .modal-content {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer {
  border-color: #334155 !important;
}

[data-bs-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

[data-bs-theme="dark"] .border {
  border-color: #334155 !important;
}

[data-bs-theme="dark"] .border-bottom {
  border-bottom-color: #334155 !important;
}

[data-bs-theme="dark"] .border-top {
  border-top-color: #334155 !important;
}

/* ==========================================================================
   Summernote Dropdown Menus Architecture (Bootstrap 5 Integration)
   ========================================================================== */
.note-editor .note-btn-group {
  position: relative !important;
}

.note-editor .note-btn.dropdown-toggle::after {
  display: none !important;
}

.note-editor .dropdown-menu,
.note-editor .note-dropdown-menu {
  z-index: 1060 !important;
  min-width: 11rem;
  max-height: 320px;
  overflow-y: auto;
  padding: 0.5rem 0;
  margin: 0.15rem 0 0;
  font-size: 0.88rem;
  color: #1e293b;
  text-align: left;
  list-style: none;
  background-color: #ffffff;
  background-clip: padding-box;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
}

.note-editor .dropdown-menu.show,
.note-editor .note-dropdown-menu.show {
  display: block !important;
}

.note-editor .note-dropdown-menu .dropdown-item,
.note-editor .dropdown-menu .dropdown-item {
  display: block;
  width: 100%;
  padding: 0.35rem 0.85rem;
  clear: both;
  font-weight: 400;
  color: #1e293b;
  text-align: inherit;
  text-decoration: none;
  white-space: nowrap;
  background-color: transparent;
  border: 0;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

.note-editor .note-dropdown-menu .dropdown-item:hover,
.note-editor .dropdown-menu .dropdown-item:hover,
.note-editor .note-dropdown-menu .dropdown-item:focus,
.note-editor .dropdown-menu .dropdown-item:focus {
  background-color: var(--as-saffron-light);
  color: var(--as-saffron);
}

.note-editor .note-color .dropdown-menu,
.note-editor .note-color .note-dropdown-menu,
.note-editor .note-table.dropdown-menu,
.note-editor .note-table.note-dropdown-menu {
  min-width: 340px !important;
  max-height: none !important;
  overflow: visible !important;
  padding: 12px !important;
}

.note-editor .note-table.dropdown-menu,
.note-editor .note-table.note-dropdown-menu {
  min-width: 140px !important;
  padding: 8px !important;
}

.note-editor .note-color-palette {
  display: flex !important;
  gap: 16px;
  justify-content: space-between;
}

.note-editor .note-color-palette .note-color-reset {
  margin: 4px 0 8px;
  font-size: 0.8rem;
  padding: 2px 6px;
}

.note-editor .note-dimension-picker {
  padding: 8px !important;
}

/* Summernote WYSIWYG Editor Dark Mode Styling */
[data-bs-theme="dark"] .note-editor.note-frame {
  border-color: #334155 !important;
  background-color: #0f172a !important;
}

[data-bs-theme="dark"] .note-toolbar {
  background-color: #1e293b !important;
  border-bottom: 1px solid #334155 !important;
}

[data-bs-theme="dark"] .note-btn {
  background-color: #27354a !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .note-btn:hover,
[data-bs-theme="dark"] .note-btn:focus {
  background-color: #334155 !important;
  color: #ffffff !important;
  border-color: #475569 !important;
}

[data-bs-theme="dark"] .note-btn.active {
  background-color: var(--as-saffron) !important;
  border-color: var(--as-saffron) !important;
  color: #ffffff !important;
}

[data-bs-theme="dark"] .note-editable {
  background-color: #0f172a !important;
  color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .note-editable p {
  color: #f1f5f9;
}

[data-bs-theme="dark"] .note-statusbar {
  background-color: #1e293b !important;
  border-top: 1px solid #334155 !important;
}

[data-bs-theme="dark"] .note-statusbar .note-resizebar .note-icon-bar {
  border-top: 1px solid #64748b !important;
}

[data-bs-theme="dark"] .note-editor .dropdown-menu,
[data-bs-theme="dark"] .note-editor .note-dropdown-menu,
[data-bs-theme="dark"] .note-modal-content {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6) !important;
}

[data-bs-theme="dark"] .note-editor .note-dropdown-menu .dropdown-item,
[data-bs-theme="dark"] .note-editor .dropdown-menu .dropdown-item,
[data-bs-theme="dark"] .note-dropdown-item {
  color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .note-editor .note-dropdown-menu .dropdown-item:hover,
[data-bs-theme="dark"] .note-editor .dropdown-menu .dropdown-item:hover,
[data-bs-theme="dark"] .note-dropdown-item:hover {
  background-color: #334155 !important;
  color: #ffffff !important;
}

[data-bs-theme="dark"] .note-editor .note-dropdown-menu .dropdown-header,
[data-bs-theme="dark"] .note-editor .dropdown-menu .dropdown-header {
  color: #94a3b8 !important;
}

[data-bs-theme="dark"] .note-editor .dropdown-divider {
  border-top-color: #334155 !important;
}

[data-bs-theme="dark"] .note-modal-header,
[data-bs-theme="dark"] .note-modal-footer {
  border-color: #334155 !important;
}

[data-bs-theme="dark"] .note-form-label {
  color: #e2e8f0 !important;
}

/* ==========================================================================
   Student Study Content Typography & Layout
   ========================================================================== */
.study-content-body {
  font-size: 1.05rem;
  line-height: 1.65;
  color: #1e293b;
  word-wrap: break-word;
}

.study-content-body p {
  margin-bottom: 1rem;
}

.study-content-body h1,
.study-content-body h2,
.study-content-body h3,
.study-content-body h4,
.study-content-body h5,
.study-content-body h6 {
  font-weight: 700;
  color: #0f172a;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.study-content-body table {
  width: 100%;
  margin-bottom: 1.5rem;
  border-collapse: collapse;
}

.study-content-body table th,
.study-content-body table td {
  padding: 0.65rem 0.85rem;
  border: 1px solid #cbd5e1;
}

.study-content-body table th {
  background-color: #f1f5f9;
  font-weight: 600;
  color: #0f172a;
}

.study-content-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--as-border-radius);
  margin: 1rem 0;
  box-shadow: var(--as-box-shadow-sm);
}

.study-content-body blockquote {
  border-left: 4px solid var(--as-saffron);
  padding: 0.75rem 1.25rem;
  background-color: #f8fafc;
  border-radius: 0 6px 6px 0;
  margin: 1.25rem 0;
  color: #475569;
}

.study-content-body pre {
  background-color: #0f172a;
  color: #f8fafc;
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1rem 0;
}

.study-content-body code {
  color: #e11d48;
  font-size: 0.9em;
}

.study-content-body pre code {
  color: #38bdf8;
}

/* ==========================================================================
   Chapter Questions & Answers System Styling
   ========================================================================== */
.category-nav-sticky {
  position: sticky;
  top: 70px;
  z-index: 1020;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

[data-bs-theme="dark"] .category-nav-sticky {
  background-color: rgba(15, 23, 42, 0.95);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.question-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background-color: #ffffff;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.question-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

[data-bs-theme="dark"] .question-card {
  background-color: #1e293b;
  border-color: #334155;
}

[data-bs-theme="dark"] .question-card:hover {
  border-color: #475569;
}

/* MCQ Options Styling */
.mcq-option-card {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  background-color: #f8fafc;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  user-select: none;
}

.mcq-option-card:hover {
  background-color: #f1f5f9;
  border-color: #94a3b8;
}

.mcq-option-card .option-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: #ffffff;
  border: 1.5px solid #cbd5e1;
  font-weight: 700;
  font-size: 0.85rem;
  margin-right: 0.75rem;
  flex-shrink: 0;
  color: #475569;
}

/* Correct and Wrong MCQ States */
.mcq-option-card.is-correct {
  background-color: #ecfdf5 !important;
  border-color: #10b981 !important;
  color: #065f46 !important;
}

.mcq-option-card.is-correct .option-marker {
  background-color: #10b981 !important;
  border-color: #10b981 !important;
  color: #ffffff !important;
}

.mcq-option-card.is-wrong {
  background-color: #fef2f2 !important;
  border-color: #ef4444 !important;
  color: #991b1b !important;
}

.mcq-option-card.is-wrong .option-marker {
  background-color: #ef4444 !important;
  border-color: #ef4444 !important;
  color: #ffffff !important;
}

[data-bs-theme="dark"] .mcq-option-card {
  background-color: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

[data-bs-theme="dark"] .mcq-option-card:hover {
  background-color: #1e293b;
  border-color: #475569;
}

[data-bs-theme="dark"] .mcq-option-card .option-marker {
  background-color: #1e293b;
  border-color: #475569;
  color: #cbd5e1;
}

[data-bs-theme="dark"] .mcq-option-card.is-correct {
  background-color: rgba(16, 185, 129, 0.15) !important;
  border-color: #10b981 !important;
  color: #6ee7b7 !important;
}

[data-bs-theme="dark"] .mcq-option-card.is-wrong {
  background-color: rgba(239, 68, 68, 0.15) !important;
  border-color: #ef4444 !important;
  color: #fca5a5 !important;
}

/* Answer Callout Containers */
.answer-reveal-card {
  border-radius: 8px;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
}

[data-bs-theme="dark"] .answer-reveal-card {
  background-color: #0f172a;
  border-color: #334155;
}

.blank-highlight {
  display: inline-block;
  min-width: 60px;
  border-bottom: 2px dashed #0284c7;
  padding: 0 4px;
  color: #0284c7;
  font-weight: 700;
}

/* ==========================================================================
   Mobile Responsive & Horizontal Overflow Prevention (Phase 1 Fixes)
   Ensures zero unintended horizontal scrolling on 320px, 375px, 425px, 768px+
   without masking broken layouts with overflow-x: hidden shortcuts.
   ========================================================================== */

/* 1. Global Box Sizing & Fluid Media */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  max-width: 100%;
}

img, svg, video, canvas, audio, iframe, embed, object {
  max-width: 100%;
  height: auto;
}

/* 2. Text & Content Overflow Protection */
body, p, h1, h2, h3, h4, h5, h6, li, dt, dd, span, a, td, th {
  overflow-wrap: anywhere;
  word-break: normal;
}

/* 3. Bootstrap Badge Wrapping Fix
   Default Bootstrap .badge has white-space: nowrap, blowing out mobile screens */
.badge {
  white-space: normal !important;
  text-align: left;
  line-height: 1.35;
  display: inline-block;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: normal;
}

/* 4. Table Responsive Layout in Study Content */
.study-content-body table {
  width: 100% !important;
  max-width: 100%;
  margin-bottom: 1rem;
  border-collapse: collapse;
}

@media (max-width: 768px) {
  .study-content-body table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100% !important;
  }
}

/* 5. Preformatted Code Blocks */
pre {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  -webkit-overflow-scrolling: touch;
  padding: 0.75rem 1rem;
  border-radius: 8px;
}

code {
  overflow-wrap: anywhere;
}

/* 6. Question Card & Header Responsive Layout */
.question-card {
  min-width: 0;
  overflow: visible;
}

.question-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.question-badge-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  min-width: 0;
  flex: 1 1 auto;
}

.answer-toggle-btn {
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 36px;
}

/* 7. MCQ Option Cards Responsive Fixes */
.mcq-option-card {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.mcq-option-card .option-marker {
  flex-shrink: 0;
}

.mcq-option-card .option-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* 8. Mobile-First Card Padding & Spacing */
@media (max-width: 576px) {
  .card.p-4 {
    padding: 1rem !important;
  }
  .card.p-5 {
    padding: 1.25rem !important;
  }
  .breadcrumb {
    flex-wrap: wrap;
    font-size: 0.8rem;
  }
  .category-nav-sticky {
    top: 56px;
    padding: 0.5rem !important;
  }
  .category-nav-sticky .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
  }
}

/* 9. Touch-friendly Interactive Elements on Mobile */
@media (max-width: 768px) {
  .btn:not(.btn-sm),
  .form-select,
  .form-control {
    min-height: 44px;
  }
  .btn-sm {
    min-height: 36px;
    padding: 0.35rem 0.65rem;
  }
  .nav-link {
    padding-top: 0.6rem !important;
    padding-bottom: 0.6rem !important;
  }
}

