/* ═══════════════════════════════════════════════
   Audit Notes Plugin — CSS
   CSS variables scoped to #an-app
═══════════════════════════════════════════════ */
#an-app {
  --an-bg:    #0f1117;
  --an-surf:  #171b26;
  --an-txt:   #f0f2f8;
  --an-ac:    #14b8a6;
  --an-al:    #5eead4;
  --an-gold:  #fbbf24;
  --an-brd:   rgba(255,255,255,0.08);
  --an-muted: rgba(255,255,255,0.55);
  --an-r:     10px;
  --an-rl:    14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  background: var(--an-bg);
  color: var(--an-txt);
  min-height: 100vh;
}
#an-app *, #an-app *::before, #an-app *::after {
  box-sizing: border-box; margin: 0; padding: 0;
}

/* ── Spinner ── */
.an-spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--an-ac);
  border-radius: 50%;
  animation: an-spin .7s linear infinite;
  margin: 0 auto;
}
@keyframes an-spin { to { transform: rotate(360deg); } }

/* ── Nav ── */
.an-nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15,17,23,0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--an-brd);
}
.an-nav-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center;
  gap: 0; padding: 0 1.5rem;
  overflow-x: auto; scrollbar-width: none;
}
.an-nav-inner::-webkit-scrollbar { display: none; }
.an-nav-brand {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: var(--an-txt);
  font-weight: 700; font-size: 14px;
  padding: 12px 16px 12px 0;
  flex-shrink: 0; margin-right: 4px;
  border-right: 1px solid var(--an-brd);
}
.an-brand-icon { font-size: 18px; }
.an-nav-links { display: flex; flex: 1; }
.an-nav-link {
  flex-shrink: 0; padding: 14px 12px;
  font-size: 12px; font-weight: 500;
  color: var(--an-muted); text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: all .15s; white-space: nowrap;
}
.an-nav-link:hover, .an-nav-link.active {
  color: var(--an-al);
  border-bottom-color: var(--an-al);
}
.an-nav-right {
  display: flex; align-items: center;
  gap: 6px; margin-left: auto;
  flex-shrink: 0; padding-left: 12px;
}
.an-th-dots {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px;
}
.an-th-dot {
  width: 14px; height: 14px; border-radius: 50%;
  cursor: pointer; padding: 0;
  border: 2px solid rgba(128,128,128,0.25);
  transition: transform .15s; flex-shrink: 0;
}
.an-th-dot:hover { transform: scale(1.3); }
.an-th-dot.on { transform: scale(1.2); outline: 2px solid var(--an-txt); outline-offset: 2px; }
.an-admin-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 7px; color: var(--an-muted);
  cursor: pointer; font-size: 13px;
  padding: 4px 10px; transition: all .15s;
}
.an-admin-btn:hover { color: var(--an-txt); background: rgba(255,255,255,0.08); }
.an-admin-btn.logged-in { color: var(--an-al); border-color: rgba(13,148,136,0.3); background: rgba(13,148,136,0.08); }

/* ── Content area ── */
.an-content { min-height: calc(100vh - 52px); }

/* ── Pages ── */
.an-page { display: none; }
.an-page.active { display: block; }

/* ── Home ── */
.an-home {
  max-width: 1100px; margin: 0 auto;
  padding: 4rem 1.5rem 5rem;
}
.an-home-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(13,148,136,0.12);
  border: 1px solid rgba(13,148,136,0.3);
  color: var(--an-al); padding: 5px 14px;
  border-radius: 100px; font-size: 12px;
  font-weight: 500; letter-spacing: .04em;
  margin-bottom: 1.5rem;
}
.an-home-title {
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: 900; line-height: 1.1;
  margin-bottom: 1rem; color: var(--an-txt);
}
.an-home-title span { color: var(--an-al); }
.an-home-sub {
  font-size: 15px; color: var(--an-muted);
  max-width: 580px; margin-bottom: 2.5rem; line-height: 1.7;
}
.an-home-stats { display: flex; gap: 2rem; flex-wrap: wrap; margin-bottom: 2.5rem; }
.an-stat-num { font-size: 2rem; font-weight: 800; color: var(--an-gold); line-height: 1; }
.an-stat-lbl { font-size: 12px; color: var(--an-muted); margin-top: 2px; }

.an-ch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.an-ch-card {
  background: var(--an-surf);
  border: 1px solid var(--an-brd);
  border-radius: var(--an-rl);
  padding: 1.1rem 1.25rem;
  cursor: pointer; transition: border-color .15s, transform .15s;
  display: flex; align-items: flex-start; gap: 12px;
}
.an-ch-card:hover { border-color: var(--an-ac); transform: translateY(-2px); }
.an-ch-card-num {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(13,148,136,0.12);
  border: 1px solid var(--an-ac);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--an-al);
  flex-shrink: 0;
}
.an-ch-card-title { font-size: 13px; font-weight: 600; color: var(--an-txt); margin-bottom: 6px; line-height: 1.4; }
.an-ch-card-meta { display: flex; flex-wrap: wrap; gap: 4px; }
.an-tag {
  font-size: 10px; font-weight: 600; padding: 2px 8px;
  border-radius: 100px; border: 1px solid;
}
.an-tag.high   { background: rgba(220,38,38,0.12); border-color: rgba(220,38,38,0.3); color: #fca5a5; }
.an-tag.med    { background: rgba(212,160,23,0.12); border-color: rgba(212,160,23,0.3); color: #fcd34d; }
.an-tag.time   { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); color: var(--an-muted); }
.an-tag.yt     { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.3); color: #fca5a5; }
.an-tag.pdf    { background: rgba(37,99,235,0.12); border-color: rgba(37,99,235,0.3); color: #93c5fd; }

/* ── Chapter page ── */
.an-chapter-wrap {
  max-width: 900px; margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
}
.an-ch-header {
  display: flex; align-items: flex-start; gap: 1.5rem;
  border-bottom: 1px solid var(--an-brd);
  padding-bottom: 1.25rem; margin-bottom: 2rem;
}
.an-ch-num {
  font-size: 4rem; font-weight: 900; line-height: 1;
  color: rgba(255,255,255,0.06); flex-shrink: 0; min-width: 80px;
}
.an-ch-header-title { font-size: 1.8rem; font-weight: 800; color: var(--an-txt); line-height: 1.2; margin: 6px 0; }
.an-isa-refs { font-size: 12px; color: var(--an-al); font-family: monospace; opacity: .8; }

.an-ch-content { margin-bottom: 1.5rem; }
.an-ch-content p { font-size: 14px; color: var(--an-muted); line-height: 1.8; margin-bottom: .75rem; }
.an-ch-content ul { list-style: none; display: flex; flex-direction: column; gap: 6px; margin-bottom: 1rem; }
.an-ch-content ul li { font-size: 14px; color: var(--an-muted); padding-left: 16px; position: relative; line-height: 1.6; }
.an-ch-content ul li::before { content: '▸'; position: absolute; left: 0; color: var(--an-ac); font-size: 11px; top: 3px; }
.an-ch-content h3, .an-ch-content h4 { color: var(--an-txt); margin: 1rem 0 .5rem; }
.an-ch-content table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 1rem 0; border-radius: var(--an-r); overflow: hidden; }
.an-ch-content thead tr { background: rgba(13,148,136,0.2); }
.an-ch-content thead th { padding: 10px 14px; text-align: left; color: var(--an-al); font-weight: 600; }
.an-ch-content tbody td { padding: 9px 14px; color: var(--an-muted); border-bottom: 1px solid var(--an-brd); }
.an-ch-content strong { color: var(--an-txt); font-weight: 600; }

/* ── Bangla box ── */
.an-bangla-box {
  background: var(--an-surf); border: 1px solid var(--an-brd);
  border-radius: var(--an-r); padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}
.an-bangla-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--an-muted); margin-bottom: 6px; }
.an-bangla-box p { font-size: 14px; color: var(--an-muted); line-height: 1.8; }

/* ── YouTube embed ── */
.an-yt-wrap {
  margin: 2rem 0 1.5rem;
  background: var(--an-surf);
  border: 1px solid var(--an-brd);
  border-radius: var(--an-rl);
  overflow: hidden;
}
.an-yt-label {
  padding: .75rem 1.25rem;
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--an-al);
  border-bottom: 1px solid var(--an-brd);
}
.an-yt-frame-wrap {
  position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;
}
.an-yt-frame-wrap iframe {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
}

/* ── PDF button ── */
.an-pdf-wrap { margin: 1.5rem 0; }
.an-pdf-btn {
  display: flex; align-items: center; gap: 14px;
  background: var(--an-surf);
  border: 1px solid var(--an-brd);
  border-radius: var(--an-r);
  padding: 1rem 1.25rem;
  text-decoration: none; color: var(--an-txt);
  transition: border-color .15s, background .15s;
}
.an-pdf-btn:hover { border-color: var(--an-ac); background: rgba(13,148,136,0.06); }
.an-pdf-icon { font-size: 28px; flex-shrink: 0; }
.an-pdf-title { font-size: 14px; font-weight: 600; color: var(--an-txt); }
.an-pdf-sub { font-size: 12px; color: var(--an-muted); margin-top: 2px; }

/* ── Overlay ── */
.an-ov {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 9999;
  align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.an-ov.show { display: flex; }
.an-modal {
  background: var(--an-surf);
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: var(--an-rl); padding: 2rem;
  width: 340px; text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
  animation: anPop .18s ease;
}
@keyframes anPop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.an-modal-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.an-modal h2 { font-size: 20px; font-weight: 800; color: var(--an-txt); margin-bottom: .3rem; }
.an-modal p  { font-size: 13px; color: var(--an-muted); margin-bottom: 1.5rem; }
.an-pw-wrap  { position: relative; margin-bottom: .75rem; }
.an-pw-wrap .an-input { padding-right: 44px; }
.an-eye {
  position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--an-muted); font-size: 15px; padding: 4px;
}
.an-err { font-size: 12px; color: #fca5a5; min-height: 18px; margin-bottom: .75rem; text-align: left; }
.an-link { font-size: 12px; color: var(--an-muted); cursor: pointer; margin-top: 1rem; }
.an-link:hover { color: var(--an-txt); }

/* ── Admin Panel ── */
.an-panel {
  display: none; position: fixed;
  top: 0; right: 0; width: 340px; height: 100vh;
  background: var(--an-surf);
  border-left: 1.5px solid rgba(255,255,255,0.1);
  z-index: 5000; flex-direction: column;
  box-shadow: -8px 0 40px rgba(0,0,0,0.4);
  overflow-y: auto;
}
.an-panel.show { display: flex; }
.an-panel-head {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--an-brd);
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; color: var(--an-txt);
  flex-shrink: 0; position: sticky; top: 0;
  background: var(--an-surf); z-index: 1;
}
.an-panel-badge {
  padding: 3px 10px; border-radius: 100px;
  font-size: 11px; font-weight: 700;
  background: rgba(13,148,136,0.12);
  border: 1px solid var(--an-ac); color: var(--an-al);
}
.an-panel-close {
  margin-left: auto; background: none; border: none;
  color: var(--an-muted); cursor: pointer; font-size: 18px; padding: 0;
}
.an-panel-close:hover { color: var(--an-txt); }
.an-panel-tabs {
  display: flex; border-bottom: 1px solid var(--an-brd);
  flex-shrink: 0;
}
.an-ptab {
  flex: 1; padding: 10px; border: none;
  background: none; color: var(--an-muted);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border-bottom: 2px solid transparent; transition: all .15s;
  font-family: inherit;
}
.an-ptab.active { color: var(--an-al); border-bottom-color: var(--an-al); }
.an-ptab-content { flex: 1; overflow-y: auto; }
.an-panel-section { padding: .9rem 1.1rem; border-bottom: 1px solid var(--an-brd); }
.an-panel-section-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; color: var(--an-muted); margin-bottom: .65rem;
}
.an-field { margin-bottom: 8px; }
.an-field label { font-size: 12px; color: var(--an-muted); display: block; margin-bottom: 4px; font-weight: 600; }
.an-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.an-input, .an-select, .an-textarea {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--an-r); padding: 8px 12px;
  font-size: 13px; color: var(--an-txt);
  font-family: inherit; outline: none;
  transition: border-color .15s;
}
.an-input:focus, .an-select:focus, .an-textarea:focus {
  border-color: var(--an-ac);
  background: rgba(255,255,255,0.07);
}
.an-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.an-select option { background: #1e2333; color: #f0f2f8; }
.an-upload-zone {
  border: 1.5px dashed rgba(255,255,255,0.15);
  border-radius: var(--an-r); padding: .75rem;
  text-align: center; font-size: 13px;
  color: var(--an-muted); cursor: pointer;
  transition: border-color .15s;
}
.an-upload-zone:hover { border-color: var(--an-ac); color: var(--an-al); }
.an-btn-primary {
  width: 100%; padding: 10px;
  background: var(--an-ac); border: none;
  border-radius: var(--an-r); color: white;
  font-size: 14px; font-weight: 700;
  cursor: pointer; font-family: inherit;
  transition: opacity .15s;
}
.an-btn-primary:hover { opacity: .85; }
.an-btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.an-btn-sm {
  padding: 7px 14px; border-radius: var(--an-r);
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: var(--an-txt); font-size: 12px;
  font-weight: 600; cursor: pointer;
  font-family: inherit; transition: all .15s;
}
.an-btn-sm:hover { background: rgba(255,255,255,0.08); }
.an-btn-sm.danger { border-color: rgba(239,68,68,0.3); color: #fca5a5; }
.an-btn-sm.danger:hover { background: rgba(239,68,68,0.1); }

/* ── Responsive ── */
@media (max-width: 640px) {
  .an-home { padding: 2rem 1rem 4rem; }
  .an-home-title { font-size: 2rem; }
  .an-chapter-wrap { padding: 1.5rem 1rem 4rem; }
  .an-panel { width: 100%; }
  .an-ch-header { flex-direction: column; gap: .75rem; }
  .an-ch-num { font-size: 2.5rem; min-width: 0; }
}
