/*
 * HindiNotesPoint — Standard Design System v1.0
 * All selectors scoped under .np-wrapper to prevent conflicts with frontend.css
 */

/* ── DETAIL LAYOUT (sidebar + content) ───────────────────────── */
.detail-layout {
  display: flex;
  align-items: flex-start;
  max-width: 1200px;
  margin: 0 auto;
  padding-top: var(--nav-h, 68px);
  min-height: calc(100vh - var(--nav-h, 68px));
}

/* ── SIDEBAR ──────────────────────────────────────────────────── */
.detail-sidebar {
  width: 260px;
  flex-shrink: 0;
  position: sticky;
  top: var(--nav-h, 68px);
  height: calc(100vh - var(--nav-h, 68px));
  overflow-y: auto;
  border-right: 1px solid #e2e0f0;
  background: #ffffff;
  scrollbar-width: thin;
  scrollbar-color: #e2e0f0 transparent;
}
.detail-sidebar::-webkit-scrollbar { width: 4px; }
.detail-sidebar::-webkit-scrollbar-thumb { background: #e2e0f0; border-radius: 4px; }

.sidebar-inner { padding: 1.5rem 0 2rem; }

.sidebar-heading {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.08em; color: #9491b4;
  padding: 0 1.2rem 1rem; border-bottom: 1px solid #e2e0f0;
  margin-bottom: 0.5rem;
}
.sidebar-heading span:nth-child(2) { flex: 1; }
.sidebar-icon { font-size: 16px; }

.sidebar-close {
  display: none;
  background: #f1f0fa; border: none; border-radius: 6px;
  width: 26px; height: 26px; font-size: 14px; color: #5b5780;
  cursor: pointer; align-items: center; justify-content: center;
  flex-shrink: 0; line-height: 1;
}
.sidebar-close:hover { background: #e0e7ff; color: #4f46e5; }

.sidebar-nav { display: flex; flex-direction: column; }

.sidebar-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 1.2rem; text-decoration: none;
  color: #5b5780; font-size: 13px; line-height: 1.5;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.sidebar-item:hover {
  background: #f8f7ff; color: #4f46e5; border-left-color: #c7d2fe;
}
.sidebar-item.active {
  background: #e0e7ff; color: #3730a3; font-weight: 700;
  border-left-color: #4f46e5;
}
.sidebar-num {
  flex-shrink: 0; min-width: 20px; height: 20px;
  background: #e0e7ff; color: #4f46e5;
  border-radius: 5px; font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace; margin-top: 1px;
}
.sidebar-item.active .sidebar-num { background: #4f46e5; color: #fff; }
.sidebar-title { flex: 1; }

/* ── MAIN CONTENT ─────────────────────────────────────────────── */
.detail-main { flex: 1; min-width: 0; }

.sidebar-toggle { display: none; }

/* ── WRAPPER ─────────────────────────────────────────────────── */
.np-wrapper {
  max-width: 780px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  font-family: 'Noto Sans Devanagari', 'Baloo 2', sans-serif;
  color: #1e1b4b;
  line-height: 1.7;
  background: #f8f7ff;
}
/* Content stored in DB uses .wrapper as its root — neutralise its top padding
   since .np-wrapper (blade) already provides the outer spacing */
.np-wrapper > .wrapper { padding-top: 0 !important; }

/* ── AD PLACEMENTS ────────────────────────────────────────────── */
.ad-wrap {
  overflow: hidden;
  text-align: center;
  background: #f8f7ff;
  min-height: 0;
  max-height: 120px;
}
.ad-top    { padding: 0.5rem 1rem; border-bottom: 1px solid #e2e0f0; }
.ad-mid    { margin: 2rem 0; max-height: 280px; }
.ad-bottom { padding: 0.5rem 1.5rem; border-top: 1px solid #e2e0f0; }

/* Hide ad container completely when ins has no content */
.ad-wrap:empty,
.ad-wrap ins[style*="display: none"],
.ad-wrap ins:not([data-ad-status]) { display: none; }

.ad-sidebar {
  padding: 0.8rem 1rem;
  text-align: center;
  max-height: 280px;
  overflow: hidden;
}
.ad-sidebar-top {
  border-bottom: 1px solid #e2e0f0;
  margin-bottom: 0.5rem;
}
.ad-sidebar-bottom {
  border-top: 1px solid #e2e0f0;
  margin-top: 1rem;
}

/* ── MOBILE ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .detail-layout { flex-direction: column; padding-top: var(--nav-h, 68px); }

  .detail-sidebar {
    position: fixed; top: var(--nav-h, 68px); left: -260px;
    height: calc(100vh - var(--nav-h, 68px)); z-index: 200;
    box-shadow: 4px 0 16px rgba(0,0,0,0.12);
    transition: left 0.25s ease;
    width: 260px;
  }
  .detail-sidebar.sidebar-open { left: 0; }

  .sidebar-close { display: flex; }

  .sidebar-toggle {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; padding: 0.75rem 1rem;
    background: #ffffff; border: none; border-bottom: 1px solid #e2e0f0;
    font-family: inherit; font-size: 13px; font-weight: 700; color: #1e1b4b;
    cursor: pointer; position: sticky; top: var(--nav-h, 68px); z-index: 10;
  }
  .sidebar-toggle.active { background: #e0e7ff; color: #3730a3; }
  .toggle-count {
    font-size: 11px; font-weight: 600; color: #9491b4;
    background: #f1f0fa; padding: 2px 8px; border-radius: 10px;
  }
  /* Remove top padding — content's .wrapper already adds its own */
  .np-wrapper { padding: 0 1rem 3rem; }
}

/* ── HERO ─────────────────────────────────────────────────────── */
.np-wrapper .hero {
  display: block !important;
  background: #1c1917 !important;
  border-radius: 18px;
  padding: 2.5rem 2rem !important;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
  min-height: auto !important;
}
.np-wrapper .hero::before {
  content: attr(data-symbol);
  position: absolute; right: -10px; top: 50%; transform: translateY(-50%);
  font-size: 100px; font-family: 'JetBrains Mono', monospace;
  color: rgba(255,255,255,0.04); font-weight: 700;
  pointer-events: none; user-select: none;
}
.np-wrapper .badge {
  display: inline-block;
  font-size: 11px; padding: 4px 12px; border-radius: 20px;
  margin-bottom: 12px; letter-spacing: 0.6px; text-transform: uppercase;
}
.np-wrapper .hero h1 {
  color: #fff !important;
  font-size: 24px !important;
  font-weight: 700 !important;
  line-height: 1.35 !important;
  margin-bottom: 10px !important;
}
.np-wrapper .hero p {
  color: rgba(255,255,255,0.62);
  font-size: 14px; line-height: 1.8; max-width: 560px;
}
.np-wrapper .hero-meta { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.np-wrapper .meta-tag {
  background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.72);
  font-size: 11px; padding: 5px 11px; border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.13);
}

/* ── FUNCTION PILL NAV ─────────────────────────────────────────── */
.np-wrapper .fn-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 1.8rem; }
.np-wrapper .fn-pill {
  background: #ffffff; border: 1px solid #e2e0f0; border-radius: 20px;
  padding: 6px 14px; font-family: 'JetBrains Mono', monospace;
  font-size: 12px; font-weight: 700; color: #4f46e5;
  text-decoration: none; display: inline-block;
}
.np-wrapper .fn-pill:hover { background: #e0e7ff; border-color: #4f46e5; }

/* ── STATS ─────────────────────────────────────────────────────── */
.np-wrapper .stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 1.8rem;
}
.np-wrapper .stat-card {
  background: #ffffff; border: 1px solid #e2e0f0;
  border-radius: 12px; padding: 1rem; text-align: center;
}
.np-wrapper .stat-num {
  display: block; font-size: 18px; font-weight: 700;
  color: #4f46e5; margin-bottom: 4px;
  font-family: 'JetBrains Mono', monospace;
}
.np-wrapper .stat-label { font-size: 11px; color: #5b5780; }

/* ── TOC ───────────────────────────────────────────────────────── */
.np-wrapper .toc {
  background: #ffffff; border: 1px solid #e2e0f0;
  border-radius: 12px; padding: 1.2rem 1.5rem; margin-bottom: 1.8rem;
}
.np-wrapper .toc h3 { font-size: 14px; font-weight: 700; color: #1e1b4b; margin-bottom: 12px; }
.np-wrapper .toc ol { padding-left: 20px; column-count: 2; column-gap: 24px; }
.np-wrapper .toc li { font-size: 13px; color: #4f46e5; line-height: 2.1; }
@media (max-width: 520px) { .np-wrapper .toc ol { column-count: 1; } }

/* ── SECTION ───────────────────────────────────────────────────── */
.np-wrapper .section {
  margin-bottom: 2.2rem !important;
  padding: 0 !important;
  max-width: none !important;
}
.np-wrapper .section-header {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  text-align: left !important;
  margin-bottom: 14px !important;
}
.np-wrapper .section-num {
  width: 30px; height: 30px; background: #e0e7ff; color: #3730a3;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.np-wrapper .section-title {
  font-size: 18px !important; font-weight: 700 !important;
  color: #1e1b4b !important; text-align: left !important;
}

/* ── FUNCTION HEADER CARD ──────────────────────────────────────── */
.np-wrapper .fn-header {
  background: #ffffff; border: 1px solid #e2e0f0; border-radius: 12px;
  padding: 1.2rem 1.4rem; margin-bottom: 12px;
  display: flex; align-items: flex-start; gap: 14px;
}
.np-wrapper .fn-icon {
  width: 48px; height: 48px; border-radius: 8px; background: #e0e7ff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 700;
  color: #4f46e5; flex-shrink: 0; text-align: center; line-height: 1.3;
}
.np-wrapper .fn-meta h3 {
  font-size: 16px; font-weight: 700; color: #1e1b4b;
  margin-bottom: 4px; font-family: 'JetBrains Mono', monospace;
}
.np-wrapper .fn-meta p  { font-size: 13px; color: #5b5780; line-height: 1.7; }
.np-wrapper .fn-tags    { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.np-wrapper .fn-tag     { font-size: 11px; padding: 2px 9px; border-radius: 20px; font-weight: 600; }
.np-wrapper .tag-blue   { background: #dbeafe; color: #1d4ed8; }
.np-wrapper .tag-green  { background: #dcfce7; color: #15803d; }
.np-wrapper .tag-amber  { background: #fef9c3; color: #92400e; }
.np-wrapper .tag-purple { background: #ede9fe; color: #6d28d9; }
.np-wrapper .tag-red    { background: #fee2e2; color: #b91c1c; }
.np-wrapper .tag-sky    { background: #e0f2fe; color: #0369a1; }
.np-wrapper .tag-rose   { background: #ffe4e6; color: #be123c; }

/* ── CARD ──────────────────────────────────────────────────────── */
.np-wrapper .card {
  background: #ffffff; border: 1px solid #e2e0f0;
  border-radius: 12px; padding: 1.2rem 1.4rem; margin-bottom: 12px;
}

/* ── SYNTAX BOX (dark purple) ──────────────────────────────────── */
.np-wrapper .syntax-box {
  background: #1e1b4b; border-radius: 8px; padding: 10px 14px; margin: 10px 0;
  font-family: 'JetBrains Mono', monospace; font-size: 13px;
  color: #e0e7ff; line-height: 1.9;
}
.np-wrapper .syntax-box .s-fn    { color: #86efac; }
.np-wrapper .syntax-box .s-param { color: #fde68a; }
.np-wrapper .syntax-box .s-type  { color: #c084fc; }
.np-wrapper .syntax-box .s-ret   { color: #fb923c; }
.np-wrapper .syntax-box .s-kw    { color: #c084fc; }
.np-wrapper .syntax-box .s-cm    { color: #475569; }

/* ── ALERT BOXES ──────────────────────────────────────────────── */
.np-wrapper .def-box {
  background: #f1f0fa; border-left: 4px solid #4f46e5;
  border-radius: 0 12px 12px 0; padding: 1rem 1.3rem; margin-bottom: 12px;
}
.np-wrapper .def-box p      { font-size: 14px; color: #5b5780; line-height: 1.9; }
.np-wrapper .def-box strong { color: #1e1b4b; }

.np-wrapper .tip-box {
  background: #fffbeb; border-left: 4px solid #f59e0b;
  border-radius: 0 8px 8px 0; padding: 10px 14px; margin: 12px 0;
  font-size: 13px; color: #92400e; line-height: 1.8;
}
.np-wrapper .tip-box strong { color: #78350f; }

.np-wrapper .info-box {
  background: #eff6ff; border-left: 4px solid #3b82f6;
  border-radius: 0 8px 8px 0; padding: 10px 14px; margin: 12px 0;
  font-size: 13px; color: #1d4ed8; line-height: 1.8;
}
.np-wrapper .info-box strong { color: #1e3a8a; }

.np-wrapper .danger-box {
  background: #fef2f2; border-left: 4px solid #ef4444;
  border-radius: 0 8px 8px 0; padding: 10px 14px; margin: 12px 0;
  font-size: 13px; color: #dc2626; line-height: 1.8;
}
.np-wrapper .danger-box strong { color: #991b1b; }

.np-wrapper .success-box {
  background: #f0fdf4; border-left: 4px solid #22c55e;
  border-radius: 0 8px 8px 0; padding: 10px 14px; margin: 12px 0;
  font-size: 13px; color: #15803d; line-height: 1.8;
}
.np-wrapper .success-box strong { color: #14532d; }

/* ── PROSE & HIGHLIGHT ─────────────────────────────────────────── */
.np-wrapper .prose { font-size: 14px; color: #5b5780; line-height: 1.9; margin-bottom: 12px; }
.np-wrapper .prose strong { color: #1e1b4b; }

.np-wrapper .highlight-text {
  font-size: 14px; color: #1e1b4b; font-weight: 500;
  border-left: 4px solid #4f46e5; padding: 10px 14px;
  background: #e0e7ff; border-radius: 0 8px 8px 0; margin: 14px 0; line-height: 1.9;
}

/* ── CODE BLOCK ────────────────────────────────────────────────── */
.np-wrapper .code-block {
  background: #0f172a; border-radius: 12px;
  padding: 1.2rem 1.4rem; margin: 12px 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; line-height: 1.9; overflow-x: auto;
}
.np-wrapper .code-block .tag  { color: #7dd3fc; }
.np-wrapper .code-block .fn   { color: #86efac; }
.np-wrapper .code-block .str  { color: #fca5a5; }
.np-wrapper .code-block .var  { color: #fde68a; }
.np-wrapper .code-block .cm   { color: #475569; }
.np-wrapper .code-block .kw   { color: #c084fc; }
.np-wrapper .code-block .num  { color: #fb923c; }
.np-wrapper .code-block .op   { color: #94a3b8; }
.np-wrapper .code-block .bool { color: #34d399; }
.np-wrapper .code-block .con  { color: #f9a8d4; }

.np-wrapper .code-label {
  display: inline-block; background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.4); font-size: 10px; padding: 2px 8px;
  border-radius: 4px; margin-bottom: 10px; letter-spacing: 0.5px;
}

/* ── INLINE CODE ───────────────────────────────────────────────── */
.np-wrapper .syntax-tag {
  background: #f1f5f9; color: #475569; padding: 2px 7px;
  border-radius: 5px; font-family: 'JetBrains Mono', monospace;
  font-size: 12px; border: 1px solid #cbd5e1; display: inline-block; margin: 2px;
}

/* ── PARAMS TABLE ──────────────────────────────────────────────── */
.np-wrapper .param-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 10px 0; }
.np-wrapper .param-table th {
  background: #f1f0fa; padding: 8px 12px; text-align: left;
  font-weight: 700; color: #1e1b4b; font-size: 12px; border: 1px solid #e2e0f0;
}
.np-wrapper .param-table td {
  padding: 9px 12px; border: 1px solid #e2e0f0; color: #5b5780; line-height: 1.7; vertical-align: top;
}
.np-wrapper .param-table td:first-child {
  font-family: 'JetBrains Mono', monospace; font-weight: 700; color: #4f46e5; white-space: nowrap;
}
.np-wrapper .param-table .required { color: #dc2626; font-size: 11px; font-weight: 700; }
.np-wrapper .param-table .optional { color: #16a34a; font-size: 11px; font-weight: 700; }

/* ── DO / DON'T ────────────────────────────────────────────────── */
.np-wrapper .do-dont { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
@media (max-width: 520px) { .np-wrapper .do-dont { grid-template-columns: 1fr; } }
.np-wrapper .do-box   { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 12px; padding: 12px 14px; }
.np-wrapper .dont-box { background: #fef2f2; border: 1px solid #fecaca; border-radius: 12px; padding: 12px 14px; }
.np-wrapper .do-box h4   { color: #15803d; font-size: 12px; font-weight: 700; margin-bottom: 8px; }
.np-wrapper .dont-box h4 { color: #dc2626; font-size: 12px; font-weight: 700; margin-bottom: 8px; }

/* ── REF TABLE ─────────────────────────────────────────────────── */
.np-wrapper .table-wrap { overflow-x: auto; margin-top: 10px; }
.np-wrapper .ref-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 400px; }
.np-wrapper .ref-table thead tr { background: #1e1b4b; }
.np-wrapper .ref-table thead th { padding: 11px 14px; text-align: left; font-weight: 700; color: #e0e7ff; font-size: 12px; }
.np-wrapper .ref-table tbody td { padding: 10px 14px; border-bottom: 1px solid #e2e0f0; color: #5b5780; line-height: 1.7; vertical-align: top; }
.np-wrapper .ref-table tbody tr:last-child td { border-bottom: none; }
.np-wrapper .ref-table tbody tr:hover td { background: #f1f0fa; }
.np-wrapper .ref-table td:first-child { font-family: 'JetBrains Mono', monospace; font-weight: 700; color: #4f46e5; white-space: nowrap; }

/* ── FAQ ───────────────────────────────────────────────────────── */
.np-wrapper .faq-item { border-bottom: 1px solid #e2e0f0; padding: 14px 0; }
.np-wrapper .faq-item:last-child { border-bottom: none; }
.np-wrapper .faq-q { font-size: 14px; font-weight: 700; color: #1e1b4b; margin-bottom: 6px; }
.np-wrapper .faq-a { font-size: 13px; color: #5b5780; line-height: 1.9; }

/* ── KEY POINTS ────────────────────────────────────────────────── */
.np-wrapper .key-point { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.np-wrapper .dot { width: 7px; height: 7px; background: #4f46e5; border-radius: 50%; flex-shrink: 0; margin-top: 8px; }
.np-wrapper .key-point p { font-size: 13px; color: #5b5780; line-height: 1.9; }
.np-wrapper .key-point p strong { color: #1e1b4b; }

/* ── CHAPTER NAV ───────────────────────────────────────────────── */
/* hide the hardcoded nav from stored HTML; show only the dynamic Blade one */
.np-wrapper .chapter-nav:not(.chapter-nav-dynamic) { display: none !important; }

.np-wrapper .chapter-nav {
  display: flex; gap: 12px; margin-top: 14px; align-items: stretch;
}
.np-wrapper .chapter-nav .nav-card        { flex: 1; max-width: calc(50% - 6px); }
.np-wrapper .chapter-nav .nav-card-next   { margin-left: auto; }
@media (max-width: 480px) {
  .np-wrapper .chapter-nav                { flex-direction: column; }
  .np-wrapper .chapter-nav .nav-card      { max-width: 100%; }
  .np-wrapper .chapter-nav .nav-card-next { margin-left: 0; }
}

.np-wrapper .nav-card {
  background: #ffffff; border: 1px solid #e2e0f0;
  border-radius: 12px; padding: 12px 16px; text-decoration: none; display: block;
}
.np-wrapper .nav-card:hover { border-color: #4f46e5; }
.np-wrapper .nav-label { font-size: 11px; color: #9491b4; margin-bottom: 4px; }
.np-wrapper .nav-title { font-size: 13px; font-weight: 700; color: #4f46e5; }

/* ── DIVIDER & FOOTER BAR ──────────────────────────────────────── */
.np-wrapper .divider { border: none; border-top: 1px solid #e2e0f0; margin: 1.8rem 0; }
.np-wrapper .footer-bar {
  background: #ffffff; border: 1px solid #e2e0f0;
  border-radius: 12px; padding: 14px 18px; text-align: center; margin-top: 14px;
}
.np-wrapper .footer-bar p    { font-size: 13px; color: #5b5780; }
.np-wrapper .footer-bar span { font-weight: 700; color: #4f46e5; }
.np-wrapper .footer-bar .sub { margin-top: 4px; font-size: 11px; color: #9491b4; }

/* ── RESPONSIVE ────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .np-wrapper .hero h1    { font-size: 20px !important; }
  .np-wrapper .section-title { font-size: 16px !important; }
  .np-wrapper .stats-grid { grid-template-columns: 1fr 1fr; }
  .np-wrapper { padding-top: calc(var(--nav-h, 68px) + 1rem); }
}
