/* ==========================================================================
   NIELIT O Level M1-R5.1 (IT Tools & Network Basics) Shared Stylesheet
   ========================================================================== */
:root {
  --m1-navy: #1c1c6e;
  --m1-navy-deep: #0a0a3c;
  --m1-sky: #5ab4e1;
  --m1-gold: #e1b41e;
  --m1-accent: #1c1c6e;
  --m1-accent-dark: #141464;
  --m1-accent-soft: #eef2ff;
  --m1-border: #e2e8f4;
  --m1-surface: #ffffff;
  --m1-subtle: #f8faff;
  --m1-ink: #1a2035;
  --m1-muted: #475569;
  --m1-nav-h: 64px;
}

.m1-theme-hub   { --m1-accent: #1c1c6e; --m1-accent-dark: #0a0a3c; --m1-accent-soft: #eef2ff; }
.m1-theme-u1    { --m1-accent: #0f766e; --m1-accent-dark: #115e59; --m1-accent-soft: #f0fdfa; }
.m1-theme-u2    { --m1-accent: #4338ca; --m1-accent-dark: #312e81; --m1-accent-soft: #eef2ff; }
.m1-theme-u3    { --m1-accent: #0284c7; --m1-accent-dark: #0369a1; --m1-accent-soft: #f0f9ff; }
.m1-theme-u4    { --m1-accent: #059669; --m1-accent-dark: #047857; --m1-accent-soft: #ecfdf5; }
.m1-theme-u5    { --m1-accent: #d97706; --m1-accent-dark: #b45309; --m1-accent-soft: #fffbeb; }
.m1-theme-u6    { --m1-accent: #2563eb; --m1-accent-dark: #1d4ed8; --m1-accent-soft: #eff6ff; }
.m1-theme-u7    { --m1-accent: #7c3aed; --m1-accent-dark: #5b21b6; --m1-accent-soft: #f5f3ff; }
.m1-theme-u8    { --m1-accent: #0d9488; --m1-accent-dark: #0f766e; --m1-accent-soft: #f0fdfa; }
.m1-theme-u9    { --m1-accent: #be123c; --m1-accent-dark: #881337; --m1-accent-soft: #fff1f2; }
.m1-theme-pyq   { --m1-accent: #b45309; --m1-accent-dark: #78350f; --m1-accent-soft: #fffbeb; }

/* ── Hero ── */
.m1-hero {
  background: linear-gradient(135deg, var(--m1-navy-deep) 0%, var(--m1-accent-dark) 52%, var(--m1-accent) 100%);
  color: #ffffff;
  padding: 2.35rem 0 2.1rem;
  border-bottom: 3px solid var(--m1-gold);
  position: relative;
  overflow: hidden;
}
.m1-hero::after {
  content: '';
  position: absolute;
  top: -70px;
  right: -70px;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(225, 180, 30, 0.16), transparent 70%);
  pointer-events: none;
}
.m1-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  margin-bottom: 0.9rem;
  color: rgba(255, 255, 255, 0.78);
}
.m1-breadcrumb a {
  color: #e2e8f0;
  text-decoration: none;
}
.m1-breadcrumb a:hover {
  color: var(--m1-gold);
  text-decoration: underline;
}
.m1-hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}
.m1-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.28rem 0.72rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #ffffff;
}
.m1-pill-badge.gold {
  background: rgba(225, 180, 30, 0.18);
  border-color: rgba(225, 180, 30, 0.52);
  color: #fef08a;
}
.m1-hero h1 {
  font-size: clamp(1.55rem, 3.2vw, 2.35rem);
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.6rem;
  line-height: 1.22;
}
.m1-hero-sub {
  font-size: 0.96rem;
  color: rgba(255, 255, 255, 0.88);
  max-width: 780px;
  line-height: 1.65;
  margin-bottom: 1.1rem;
}
.m1-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1.15rem;
}
.m1-stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}
.m1-stat-box {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  min-width: 0;
}
.m1-stat-box .stat-label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.72);
}
.m1-stat-box .stat-value {
  display: block;
  font-size: 0.96rem;
  font-weight: 800;
  color: #ffffff;
  margin-top: 2px;
}

/* ── Sticky Quick Nav ── */
.m1-quick-nav-bar {
  position: sticky;
  top: var(--m1-nav-h, 64px);
  z-index: 1020;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--m1-border);
  box-shadow: 0 3px 12px rgba(20, 20, 100, 0.06);
  padding: 0.48rem 0;
}
.m1-quick-nav-scroll {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
}
.m1-quick-nav-scroll::-webkit-scrollbar { display: none; }
.m1-quick-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 0.34rem 0.82rem;
  border-radius: 999px;
  font-size: 0.77rem;
  font-weight: 700;
  color: var(--m1-ink);
  background: #f1f5f9;
  border: 1px solid var(--m1-border);
  text-decoration: none;
  transition: all 0.18s ease;
}
.m1-quick-pill:hover,
.m1-quick-pill.active {
  background: var(--m1-accent);
  border-color: var(--m1-accent);
  color: #ffffff;
}

/* ── Content Cards & Section Framing ── */
.m1-main-shell {
  padding-top: 1.75rem;
  padding-bottom: 2.5rem;
}
.m1-section {
  background: #ffffff;
  border: 1px solid var(--m1-border);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.45rem;
  box-shadow: 0 3px 14px rgba(20, 20, 100, 0.04);
  scroll-margin-top: calc(var(--m1-nav-h, 64px) + 58px);
}
.m1-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1.5px solid var(--m1-border);
}
.m1-section-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}
.m1-num-badge {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--m1-navy), var(--m1-accent));
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.m1-section h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--m1-ink);
  margin: 0;
  line-height: 1.3;
}
.m1-section h3 {
  font-size: 1.04rem;
  font-weight: 700;
  color: var(--m1-accent-dark);
  margin: 1.15rem 0 0.55rem;
}
.m1-ref-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--m1-accent-soft);
  color: var(--m1-accent-dark);
  border: 1px solid rgba(28, 28, 110, 0.14);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  white-space: nowrap;
}
.m1-lead-box {
  background: var(--m1-accent-soft);
  border-left: 4px solid var(--m1-accent);
  border-radius: 0 10px 10px 0;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  color: #1e293b;
  margin-bottom: 1rem;
}
.m1-exam-tip,
.m1-tip-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 4px solid var(--m1-gold);
  border-radius: 0 10px 10px 0;
  padding: 0.8rem 1rem;
  font-size: 0.86rem;
  color: #78350f;
  margin: 0.95rem 0;
}
.m1-compare {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 0.9rem;
  margin: 0.85rem 0 1rem;
}
.m1-compare-col {
  background: #f8fafc;
  border: 1px solid var(--m1-border);
  border-radius: 12px;
  padding: 0.95rem 1rem;
  min-width: 0;
}
.m1-compare-col h4 {
  font-size: 0.94rem;
  font-weight: 800;
  color: var(--m1-navy);
  margin: 0.45rem 0 0.45rem;
}
.m1-compare-col ul {
  padding-left: 1.15rem;
  margin: 0;
  font-size: 0.84rem;
  color: #334155;
  line-height: 1.55;
}
.badge-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Grids & Pointers ── */
.m1-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
  gap: 0.85rem;
  margin: 0.85rem 0 1rem;
}
.m1-card {
  background: #f8fafc;
  border: 1px solid var(--m1-border);
  border-top: 3px solid var(--m1-accent);
  border-radius: 12px;
  padding: 0.95rem 1rem;
  min-width: 0;
  overflow-wrap: anywhere;
}
.m1-card h4 {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--m1-navy);
  margin: 0 0 0.4rem;
}
.m1-card p,
.m1-card ul {
  font-size: 0.84rem;
  color: #334155;
  margin: 0;
  line-height: 1.55;
}
.m1-card ul { padding-left: 1.1rem; margin-top: 0.3rem; }
.m1-pointer-list,
.m1-list {
  list-style: none;
  padding: 0;
  margin: 0.65rem 0;
  display: grid;
  gap: 0.45rem;
}
.m1-pointer-list li,
.m1-list li {
  background: #f8fafc;
  border: 1px solid var(--m1-border);
  border-radius: 10px;
  padding: 0.6rem 0.85rem;
  font-size: 0.87rem;
  color: #1e293b;
  overflow-wrap: anywhere;
}

/* ── Tables ── */
.m1-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--m1-border);
  border-radius: 12px;
  margin: 0.9rem 0 1.1rem;
  background: #ffffff;
}
.m1-table {
  display: table !important;
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 0;
}
.m1-table th {
  background: var(--m1-navy);
  color: #ffffff;
  font-weight: 700;
  padding: 0.68rem 0.85rem;
  text-align: left;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}
.m1-table td {
  padding: 0.64rem 0.85rem;
  border-bottom: 1px solid var(--m1-border);
  color: #1e293b;
  vertical-align: top;
}
.m1-table tr:nth-child(even) td {
  background: #f8faff;
}
.m1-table tr:last-child td { border-bottom: 0; }

/* ── Code / CLI / Formula Blocks ── */
.m1-code-box {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin: 0.85rem 0;
  overflow-x: auto;
  position: relative;
}
.m1-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  margin-bottom: 0.45rem;
  font-weight: 700;
}
.m1-code-box pre {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.55;
  color: #f8fafc;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ── SVG Infographic Containers ── */
.diagram-figure {
  background: #ffffff;
  border: 1px solid var(--m1-border);
  border-radius: 14px;
  padding: 0.9rem;
  margin: 1rem 0 1.2rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.diagram-figure svg {
  width: 100%;
  height: auto;
  display: block;
}
.diagram-caption {
  font-size: 0.78rem;
  color: var(--m1-muted);
  margin-top: 0.55rem;
  text-align: center;
  font-weight: 600;
}

/* ── Interactive Mindmap ── */
.mindmap-shell {
  background: #f8faff;
  border: 1px solid var(--m1-border);
  border-radius: 16px;
  padding: 1.15rem;
  margin: 1rem 0;
}
.mindmap-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}
.mindmap-root-node {
  background: linear-gradient(135deg, var(--m1-navy-deep), var(--m1-accent));
  color: #ffffff;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  text-align: center;
  margin-bottom: 0.9rem;
}
.mindmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 0.75rem;
}
.mindmap-branch {
  background: #ffffff;
  border: 1px solid var(--m1-border);
  border-radius: 12px;
  overflow: hidden;
  min-width: 0;
}
.mindmap-branch[data-tone="sky"]    { border-top: 3px solid #0284c7; }
.mindmap-branch[data-tone="emerald"]{ border-top: 3px solid #059669; }
.mindmap-branch[data-tone="gold"]   { border-top: 3px solid #d97706; }
.mindmap-branch[data-tone="violet"] { border-top: 3px solid #7c3aed; }
.mindmap-branch[data-tone="rose"]   { border-top: 3px solid #e11d48; }
.mindmap-branch[data-tone="navy"]   { border-top: 3px solid #1c1c6e; }
.mindmap-branch-head {
  width: 100%;
  background: #f8fafc;
  border: 0;
  border-bottom: 1px solid var(--m1-border);
  padding: 0.65rem 0.85rem;
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--m1-ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  text-align: left;
  cursor: pointer;
}
.mindmap-branch.is-collapsed .mindmap-branch-head { border-bottom: 0; }
.mindmap-branch.is-collapsed .mindmap-branch-body { display: none; }
.mindmap-branch-body ul {
  list-style: disc;
  margin: 0;
  padding: 0.7rem 0.9rem 0.75rem 1.7rem;
  font-size: 0.8rem;
  color: #334155;
}
.mindmap-branch-body li { margin-bottom: 0.25rem; }

/* ── Interactive Chapter MCQ & PYQ Sets ── */
.quiz-wrapper {
  background: #ffffff;
  border: 1px solid var(--m1-border);
  border-radius: 16px;
  padding: 1.25rem;
  margin: 1rem 0;
}
.quiz-header-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.85rem;
  margin-bottom: 1rem;
  border-bottom: 1.5px solid var(--m1-border);
}
.quiz-card {
  border: 1px solid var(--m1-border);
  border-radius: 12px;
  padding: 0.95rem 1rem;
  margin-bottom: 0.85rem;
  background: #fafcff;
}
.quiz-q {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--m1-ink);
  margin-bottom: 0.65rem;
}
.quiz-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}
.quiz-option {
  text-align: left;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  padding: 0.55rem 0.75rem;
  font-size: 0.83rem;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.16s ease;
  min-height: 40px;
}
.quiz-option:hover:not(:disabled) {
  border-color: var(--m1-accent);
  background: var(--m1-accent-soft);
}
.quiz-option.is-correct {
  background: #dcfce7 !important;
  border-color: #16a34a !important;
  color: #14532d !important;
  font-weight: 700;
}
.quiz-option.is-wrong {
  background: #fee2e2 !important;
  border-color: #dc2626 !important;
  color: #7f1d1d !important;
}
.quiz-explain {
  display: none;
  margin-top: 0.65rem;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  font-size: 0.81rem;
  color: #0c4a6e;
}
.quiz-explain.show { display: block; }

/* ── PYQ Archive Controls & Cards ── */
.pyq-filter-bar {
  background: #ffffff;
  border: 1px solid var(--m1-border);
  border-radius: 14px;
  padding: 1rem 1.15rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 10px rgba(20, 20, 100, 0.04);
}
.pyq-card {
  background: #ffffff;
  border: 1px solid var(--m1-border);
  border-radius: 14px;
  padding: 1rem 1.15rem;
  margin-bottom: 0.9rem;
  transition: border-color 0.18s ease;
}
.pyq-card:hover { border-color: rgba(28, 28, 110, 0.35); }
.pyq-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}
.pyq-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}
.pyq-tag.cycle { background: #fef3c7; color: #92400e; }
.pyq-tag.unit  { background: #e0e7ff; color: #3730a3; }
.pyq-opts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0.6rem 0;
}
.pyq-opt-item {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  font-size: 0.83rem;
  color: #1e293b;
}
.pyq-card.show-ans .pyq-opt-item.is-ans {
  background: #dcfce7;
  border-color: #16a34a;
  color: #14532d;
  font-weight: 700;
}
.pyq-ans-box {
  display: none;
  margin-top: 0.65rem;
  padding: 0.65rem 0.85rem;
  border-radius: 9px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  font-size: 0.83rem;
  color: #064e3b;
}
.pyq-card.show-ans .pyq-ans-box { display: block; }

/* ── Unit Pager & Sidebar ── */
.m1-pager-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.m1-pager-card {
  display: block;
  background: #ffffff;
  border: 1px solid var(--m1-border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  text-decoration: none;
  color: var(--m1-ink);
  transition: all 0.18s ease;
}
.m1-pager-card:hover {
  border-color: var(--m1-accent);
  box-shadow: 0 6px 18px rgba(28, 28, 110, 0.08);
  color: var(--m1-navy);
}
.m1-sidebar-sticky {
  position: sticky;
  top: calc(var(--m1-nav-h, 64px) + 56px);
}
.m1-sidebar-card {
  background: #ffffff;
  border: 1px solid var(--m1-border);
  border-radius: 16px;
  padding: 1.15rem;
  margin-bottom: 1rem;
  box-shadow: 0 3px 14px rgba(20, 20, 100, 0.04);
}
.m1-side-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--m1-border);
  background: #f8fafc;
  color: #1e293b;
  font-size: 0.81rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.16s ease;
}
.m1-side-link:hover,
.m1-side-link.active {
  background: var(--m1-accent-soft);
  border-color: var(--m1-accent);
  color: var(--m1-navy);
}
.m1-unit-pill {
  min-width: 28px;
  height: 22px;
  border-radius: 6px;
  background: #64748b;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.m1-side-link.active .m1-unit-pill {
  background: var(--m1-accent);
}

/* ── Mobile Responsive Refinements ── */
@media (max-width: 991.98px) {
  .m1-sidebar-sticky { position: static; top: auto; }
}
@media (max-width: 767.98px) {
  .m1-hero { padding: 1.65rem 0 1.5rem; }
  .m1-stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .m1-section { padding: 1.05rem; border-radius: 14px; }
  .quiz-options, .pyq-opts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 575.98px) {
  .m1-card-grid, .mindmap-grid { grid-template-columns: 1fr; }
  .diagram-figure svg { min-width: 540px; }
}
@media print {
  .navbar-glass, .ng-topbar, .m1-quick-nav-bar, aside, footer, .btn, .pyq-filter-bar, .ng-floating-widget, #moveToTopBtn {
    display: none !important;
  }
  .pyq-card .pyq-ans-box { display: block !important; }
  .col-lg-8 { width: 100% !important; max-width: 100% !important; flex: 0 0 100% !important; }
  .m1-section, .pyq-card { box-shadow: none !important; break-inside: avoid; }
}
