/* ================================================================
   DUAL-SUBJECT SWITCHER & ADY201m MODULE STYLES
   Palette: Deep Teal (#0f766e) + Emerald (#059669) + Slate (#0f172a)
   Font: Be Vietnam Pro + JetBrains Mono / Consolas for Python code
   ================================================================ */

/* TOP-LEVEL SUBJECT SWITCHER BAR ("TAB TO") */
.subject-switcher-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  flex-wrap: wrap;
}

.subject-switch-btn {
  flex: 1 1 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 12px;
  border: 1.5px solid transparent;
  background: transparent;
  color: #475569;
  font-family: inherit;
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.subject-switch-btn:hover {
  background: #f8fafc;
  color: #0f172a;
}

.subject-switch-btn .subj-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  white-space: nowrap;
}

.subject-switch-btn[data-subject="jpd"].active {
  background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.28);
}

.subject-switch-btn[data-subject="jpd"].active .subj-pill {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.subject-switch-btn[data-subject="ady"].active {
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(15, 118, 110, 0.28);
}

.subject-switch-btn[data-subject="ady"].active .subj-pill {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

/* Header theme shift when ADY is active */
body.subject-ady header {
  background: linear-gradient(135deg, #0f172a 0%, #0f766e 58%, #0d9488 100%);
  box-shadow: 0 12px 30px rgba(15, 118, 110, 0.22);
}

.subject-shell {
  display: none;
}

.subject-shell.active {
  display: block;
  animation: adyFadeIn 0.25s ease-out;
}

@keyframes adyFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ADY SUB-NAV TABS */
.ady-subnav-wrap {
  position: sticky;
  top: 10px;
  z-index: 40;
  margin-bottom: 20px;
}

.ady-subnav {
  display: flex;
  gap: 10px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border: 1.5px solid #ccfbf1;
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(15, 118, 110, 0.08);
  flex-wrap: wrap;
}

.ady-tab-btn {
  flex: 1 1 220px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 18px;
  border-radius: 11px;
  border: 1.5px solid transparent;
  background: transparent;
  color: #334155;
  font-family: inherit;
  font-size: 0.93rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ady-tab-btn:hover {
  background: #f0fdfa;
  color: #0f766e;
}

.ady-tab-btn.active,
.ady-tab-btn.active:hover {
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(15, 118, 110, 0.25);
}

.ady-tab-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
}

.ady-tab-btn.active .ady-tab-badge {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.ady-panel {
  display: none;
}

.ady-panel.active {
  display: block;
  animation: adyFadeIn 0.22s ease-out;
}

/* ================================================================
   ADY THEORY SECTION (PANDAS REVIEW & STATISTICS)
   ================================================================ */
.ady-theory-toolbar {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.ady-toolbar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.ady-toolbar-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ady-search-box {
  flex: 1 1 260px;
  max-width: 380px;
  position: relative;
}

.ady-search-input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  font-family: inherit;
  font-size: 0.88rem;
  color: #0f172a;
  background: #f8fafc;
  outline: none;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.ady-search-input:focus {
  border-color: #0d9488;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.14);
}

.ady-search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  pointer-events: none;
}

.ady-topic-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ady-topic-pill {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  font-family: inherit;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.ady-topic-pill:hover {
  border-color: #0d9488;
  color: #0f766e;
  background: #f0fdfa;
}

.ady-topic-pill.active {
  background: #0f766e;
  border-color: #0f766e;
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(15, 118, 110, 0.22);
}

/* ADY THEORY CARDS */
.ady-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-top: 4px solid #0d9488;
  border-radius: 16px;
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.ady-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1.5px solid #f1f5f9;
}

.ady-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
}

.ady-num-badge {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 800;
  flex-shrink: 0;
}

.ady-slide-tag {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f0fdfa;
  color: #0f766e;
  border: 1px solid #99f6e4;
}

.ady-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 12px 0;
}

@media (max-width: 860px) {
  .ady-grid-2 {
    grid-template-columns: 1fr;
  }
}

.ady-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.ady-concept-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
}

.ady-concept-box h4 {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f766e;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ady-concept-box p,
.ady-concept-box li {
  font-size: 0.87rem;
  line-height: 1.62;
  color: #334155;
}

.ady-concept-box ul {
  padding-left: 18px;
  margin-top: 4px;
}

.ady-formula-card {
  background: linear-gradient(135deg, #f0fdfa 0%, #ecfeff 100%);
  border: 1.5px solid #99f6e4;
  border-radius: 12px;
  padding: 12px 16px;
  margin: 10px 0;
}

.ady-formula-math {
  font-family: 'Cambria Math', 'Times New Roman', Georgia, serif;
  font-size: 1.06rem;
  font-weight: 700;
  color: #134e4a;
  background: #ffffff;
  border: 1px solid #ccfbf1;
  border-radius: 8px;
  padding: 8px 12px;
  display: inline-block;
  margin: 6px 0;
}

.ady-tip-box {
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-left: 4px solid #f59e0b;
  border-radius: 10px;
  padding: 12px 15px;
  margin-top: 12px;
  font-size: 0.86rem;
  line-height: 1.6;
  color: #78350f;
}

/* PYTHON CODE BLOCKS */
.ady-code-block {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  margin: 10px 0;
  border: 1px solid #1e293b;
}

.ady-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  background: #1e293b;
  font-size: 0.76rem;
  font-weight: 700;
  color: #94a3b8;
}

.ady-copy-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  padding: 3px 9px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ady-copy-btn:hover {
  background: #0d9488;
  border-color: #0d9488;
  color: #ffffff;
}

.ady-code-block pre {
  margin: 0;
  padding: 13px 16px;
  overflow-x: auto;
  font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
  font-size: 0.84rem;
  line-height: 1.6;
  color: #e2e8f0;
}

.py-kw { color: #38bdf8; font-weight: 600; }
.py-fn { color: #fbbf24; }
.py-str { color: #34d399; }
.py-num { color: #f472b6; }
.py-cm { color: #64748b; font-style: italic; }

/* CORRELATION SCALE BAR */
.ady-corr-scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin: 12px 0;
  text-align: center;
}

.ady-corr-step {
  padding: 10px 8px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.4;
}

/* ADY TABLE */
.ady-table-wrap {
  overflow-x: auto;
  margin: 12px 0;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.ady-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.ady-table th {
  background: #f0fdfa;
  color: #134e4a;
  font-weight: 800;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1.5px solid #99f6e4;
}

.ady-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: top;
}

.ady-table tr:last-child td {
  border-bottom: none;
}

.ady-table code {
  background: #f1f5f9;
  color: #0f766e;
  padding: 2px 6px;
  border-radius: 5px;
  font-family: Consolas, monospace;
  font-size: 0.82rem;
  font-weight: 600;
}

/* ADY EXAM HEADER ACCENT OVERRIDE */
#ady-tab-exam .fe-header-card {
  background: linear-gradient(135deg, #0f172a 0%, #115e59 100%);
  border-color: rgba(45, 212, 191, 0.28);
}

#ady-tab-exam .fe-q-num-badge {
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
}

#ady-tab-exam .fe-progress-fill {
  background: linear-gradient(90deg, #14b8a6, #34d399);
}

#ady-tab-exam .fe-option-card.selected {
  border-color: #0d9488;
  background: #f0fdfa;
}

#ady-tab-exam .fe-option-card.selected .fe-opt-letter {
  background: #0d9488;
  color: #ffffff;
}

#ady-tab-exam .fe-pal-btn.answered {
  background: #0d9488;
  border-color: #0f766e;
  color: #ffffff;
}

#ady-tab-exam .fe-pal-btn.current {
  border-color: #0f766e;
  background: #ccfbf1;
  color: #134e4a;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.22);
}

/* Crisp ADY Review Cards */
.ady-review-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-left: 5px solid #94a3b8;
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.04);
}
.ady-review-card.status-correct { border-left-color: #10b981; }
.ady-review-card.status-wrong { border-left-color: #ef4444; }
.ady-review-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}
.ady-review-status {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
}
.ady-review-status.correct { background: #d1fae5; color: #065f46; }
.ady-review-status.wrong { background: #fee2e2; color: #991b1b; }
.ady-review-status.skipped { background: #f1f5f9; color: #475569; }
.ady-review-img {
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
  margin-bottom: 12px;
  display: block;
}
.ady-review-answers {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.ady-ans-chip {
  font-size: 0.85rem;
  padding: 5px 12px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}
.ady-ans-chip.is-ok { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.ady-ans-chip.is-user { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.ady-ans-chip.is-correct { background: #ecfeff; color: #0f766e; border-color: #5eead4; }
.ady-review-explanation {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.88rem;
  line-height: 1.65;
  color: #1e293b;
}

/* VISUAL THEORY DIAGRAM FIGURES (CLICK TO ZOOM) */
.ady-fig-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin: 14px 0 6px;
}

.ady-fig-card {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.ady-fig-card:hover {
  border-color: #0d9488;
  box-shadow: 0 6px 18px rgba(13, 148, 136, 0.12);
  transform: translateY(-2px);
}

.ady-fig-img {
  width: 100%;
  max-height: 250px;
  object-fit: contain;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  cursor: zoom-in;
  display: block;
}

.ady-fig-cap {
  margin-top: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
  text-align: center;
  line-height: 1.4;
}

.ady-fig-cap span {
  color: #0f766e;
  font-weight: 600;
}

@media (max-width: 768px) {
  .ady-corr-scale {
    grid-template-columns: 1fr;
  }
  .ady-card {
    padding: 16px;
  }
  .subject-switch-btn {
    padding: 10px 14px;
    font-size: 0.88rem;
  }
}
