/*
==================================================================
  Master Stylesheet for MCQ Plugin
  @MODIFIED:
  - REMOVED global :root and body.dark-mode variables.
  - REMOVED widget styles.
  - All global/widget styles are now in top-nav.css
==================================================================
*/

/* --- 1. ❌ REMOVED: Global Theming Variables --- */
/* This entire block has been moved to top-nav.css */


/* --- 2. Main MCQ Container & Elements --- */
/* These styles correctly apply ONLY to the shortcode container */
.nm-mcq-container {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  border: 1px solid var(--nm-border-primary);
  border-radius: 8px;
  padding: 20px;
  background-color: var(--nm-bg-primary);
  max-width: 100%;
  margin: 20px auto;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.nm-mcq-list {
  margin-top: 20px;
}

.nm-quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--nm-border-primary);
}

.nm-filters-wrapper {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

/* All filter blocks (Topic, Subtopic, Exam, Difficulty, Cognitive) */
.nm-topic-filter-wrapper,
.nm-subtopic-filter-wrapper,
.nm-exam-filter-wrapper,
.nm-difficulty-filter-wrapper,
.nm-cognitive-filter-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Consistent label styling */
.nm-topic-filter-wrapper label,
.nm-subtopic-filter-wrapper label,
.nm-exam-filter-wrapper label,
.nm-difficulty-filter-wrapper label,
.nm-cognitive-filter-wrapper label {
  font-weight: 600;
  color: var(--nm-text-secondary);
}

/* Consistent select styling */
.nm-topic-filter-wrapper select,
.nm-subtopic-filter-wrapper select,
.nm-exam-filter-wrapper select,
.nm-difficulty-filter-wrapper select,
.nm-cognitive-filter-wrapper select {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--nm-border-secondary);
  background-color: var(--nm-bg-tertiary);
  color: var(--nm-text-primary);
}

.nm-dark-mode-toggle {
  margin-left: auto;
}

.nm-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.nm-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.nm-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
}

.nm-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
}

input:checked+.nm-slider {
  background-color: var(--nm-brand-color);
}

input:checked+.nm-slider:before {
  transform: translateX(26px);
}

.nm-slider.nm-round {
  border-radius: 34px;
}

.nm-slider.nm-round:before {
  border-radius: 50%;
}

.nm-mcq-item {
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid var(--nm-border-primary);
  border-radius: 8px;
  background-color: var(--nm-bg-secondary);
}

.nm-mcq-question {
  font-size: 1.1em;
  font-weight: 600;
  color: var(--nm-text-primary);
  margin: 0 0 15px 0;
  line-height: 1.4;
}

.nm-mcq-options {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nm-mcq-option {
  padding: 12px 15px;
  border: 1px solid var(--nm-border-secondary);
  color: var(--nm-text-primary);
  border-radius: 6px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.nm-mcq-option:hover {
  background-color: var(--nm-bg-tertiary);
  border-color: var(--nm-border-hover);
}

.nm-mcq-item.answered .nm-mcq-option {
  cursor: default;
  pointer-events: none;
}

/* Light mode: ensure readable text for correct/wrong options (REINFORCED) */
html:not(.dark-mode) .nm-mcq-option.correct,
html:not(.dark-mode) .nm-mcq-option.correct *,
html:not(.dark-mode) .nm-mcq-option.correct .nm-option-btn,
html:not(.dark-mode) .quiz-option.correct {
  background-color: var(--nm-correct-bg) !important;
  border-color: var(--nm-correct-border) !important;
  color: var(--nm-correct-text) !important;
  font-weight: 600 !important;
}

html:not(.dark-mode) .nm-mcq-option.wrong,
html:not(.dark-mode) .nm-mcq-option.wrong *,
html:not(.dark-mode) .nm-mcq-option.wrong .nm-option-btn,
html:not(.dark-mode) .quiz-option.wrong {
  background-color: var(--nm-wrong-bg) !important;
  border-color: var(--nm-wrong-border) !important;
  color: var(--nm-wrong-text) !important;
  font-weight: 600 !important;
}

.nm-mcq-feedback {
  margin-top: 10px;
  font-weight: bold;
}

.nm-mcq-feedback.correct {
  color: var(--nm-correct-text);
}

.nm-mcq-feedback.wrong {
  color: var(--nm-wrong-text);
}

.nm-mcq-actions {
  margin-top: 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nm-mcq-actions button {
  background-color: var(--nm-bg-tertiary);
  border: 1px solid var(--nm-border-secondary);
  color: var(--nm-text-action);
  padding: 8px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.9em;
}

.nm-mcq-actions button:hover {
  background-color: var(--nm-border-primary);
}

.nm-mcq-explanation {
  margin-top: 15px;
  padding: 15px;
  background-color: var(--nm-bg-explanation);
  border-left: 4px solid var(--nm-brand-color);
  border-radius: 4px;
}

.nm-loader-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 150px;
}

.nm-loader {
  border: 5px solid var(--nm-border-primary);
  border-top: 5px solid var(--nm-brand-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: nm-spin 1s linear infinite;
}

@keyframes nm-spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* --- 3. ❌ REMOVED: SMART WIDGET STYLES (COMPACT) --- */
/* This entire block has been moved to top-nav.css */


/*
==================================================================
  MASTER DARK MODE OVERRIDES (MERGED)
==================================================================
*/

/* --- ❌ REMOVED: Dark Mode Variables --- */
/* This block has been moved to top-nav.css */


/* --- Dark Mode General Theme Adjustments --- */
/* These can stay here as they are page-specific */
body.dark-mode a {
  color: var(--nm-link-color);
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4 {
  color: #ffffff;
}

body.dark-mode .ast-separate-container .ast-article-post,
body.dark-mode .ast-separate-container .ast-article-single {
  background-color: var(--nm-bg-secondary);
}

/* --- Dark Mode Plugin Component Adjustments --- */
body.dark-mode .nm-mcq-container,
body.dark-mode .nm-topic-filter-wrapper select {
  background-color: var(--nm-bg-secondary);
  border-color: var(--nm-border-primary);
  color: var(--nm-text-primary);
}

body.dark-mode .nm-mcq-option {
  color: var(--nm-text-primary);
  background-color: #222;
  border-color: #444;
}

body.dark-mode .nm-mcq-option:hover {
  background-color: var(--nm-bg-tertiary);
  border-color: var(--nm-border-hover);
}

/* --- ❌ REMOVED: Widget Dark Mode Styles --- */
/* This block has been moved to top-nav.css */

body.dark-mode .nm-mcq-question {
  color: #fff;
}

/* --- DEFINITIVE FIX: Topic Heading & White Box --- */
body.dark-mode.ast-separate-container #primary #main .ast-archive-description,
body.dark-mode.ast-separate-container #primary.content-area .ast-article-post .entry-header {
  background-color: var(--nm-bg-secondary) !important;
  border: none !important;
}

/* --- DEFINITIVE FIX: Quiz Modal Hover & Suggestions --- */
body.dark-mode #nm-quiz-modal-content .nm-quiz-options .quiz-option:hover {
  color: var(--nm-input-text) !important;
  background-color: #333 !important;
}

body.dark-mode #nm-quiz-modal-content #nm-topic-suggestions {
  background: var(--nm-input-bg) !important;
  color: var(--nm-input-text) !important;
  border-color: var(--nm-input-border) !important;
}

body.dark-mode #nm-quiz-modal-content #nm-topic-suggestions div:hover {
  background: #333 !important;
}

/* Dark mode form controls (all dropdowns) */
body.dark-mode #nm-topic-filter,
body.dark-mode #nm-subtopic-filter,
body.dark-mode #nm-exam-filter,
body.dark-mode #nm-difficulty-filter,
body.dark-mode #nm-cognitive-filter {
  background-color: #333 !important;
  color: #eee !important;
  border-color: #555 !important;
}

/* Dark mode placeholder text for disabled subtopic */
body.dark-mode #nm-subtopic-filter:disabled {
  color: #777 !important;
}

/* Highlight correct answer in dark mode */
body.dark-mode .nm-mcq-option.correct {
  background-color: var(--nm-correct-bg) !important;
  color: var(--nm-correct-text) !important;
  border-color: var(--nm-correct-border) !important;
}

/* Highlight wrong answer in dark mode */
body.dark-mode .nm-mcq-option.wrong {
  background-color: var(--nm-wrong-bg) !important;
  color: var(--nm-wrong-text) !important;
  border-color: var(--nm-wrong-border) !important;
}

/* Dark mode explanation panel */
body.dark-mode .nm-mcq-explanation {
  background-color: var(--nm-bg-explanation) !important;
  color: #ccc !important;
  border-left: 4px solid var(--nm-brand-color) !important;
}

/* Dark mode quiz header text */
body.dark-mode .nm-quiz-header label,
body.dark-mode .nm-quiz-header h4,
body.dark-mode .nm-quiz-header h3 {
  color: #eee !important;
}

/* Dark mode "Show Answer" feedback */
body.dark-mode .nm-mcq-feedback.correct {
  color: var(--nm-correct-text) !important;
}

body.dark-mode .nm-mcq-feedback.wrong {
  color: var(--nm-wrong-text) !important;
}

/*
==================================================================
  ✅ NEW: MOBILE-FIRST SINGLE COLUMN LAYOUT
==================================================================
*/

/* Force single-column grid for options */
#nm-mcq-app .nm-mcq-options {
  display: grid;
  grid-template-columns: 1fr !important;
  gap: 10px;
}

/* Ensure list items fill the width */
#nm-mcq-app .nm-mcq-option {
  min-height: 50px;
  display: flex;
  align-items: center;
  width: 100%;
}

/* If an inner button is present inside the LI, ensure full-width tap target */
#nm-mcq-app .nm-mcq-option>.nm-option-btn {
  width: 100%;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  padding: 12px 15px;
  background: transparent;
  border: 0;
  text-align: left;
}

/* --- Option layout inside cards --- */

#nm-mcq-app .nm-mcq-option {
  display: flex;
  align-items: center;
  gap: 10px;
  /* space between letter and text */
}


/* Optional: slightly tighter on small screens */
@media (max-width: 480px) {
  #nm-mcq-app .nm-mcq-option::before {
    flex-basis: 1.4em;
  }
}

/* === Floating score tracker (shared) === */
.nm-score-tracker {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: #fff;
  padding: 15px 20px;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .18);
  z-index: 998;
  min-width: 140px;
  display: none;
  /* shown by JS when first answer is attempted */
  border: 2px solid #667eea;
  content-visibility: auto;
  /* render optimization */
  contain: layout style paint;
  /* isolate paints & layout for CWV */
}

.nm-score-tracker.visible {
  display: block;
}

.nm-score-title {
  font-size: .85em;
  color: #666;
  margin-bottom: 6px;
}

.nm-score-number {
  font-size: 1.8em;
  font-weight: 700;
  color: #667eea;
}

.nm-score-label {
  font-size: .8em;
  color: #999;
}

/* Mobile position & sizing */
@media (max-width: 767px) {
  .nm-score-tracker {
    bottom: 70px;
    right: 15px;
    padding: 12px 16px;
    min-width: 120px;
    font-size: .9em;
  }

  .nm-score-number {
    font-size: 1.5em;
  }
}

/* --- ❌ REMOVED: Dark Mode Score Tracker --- */
/* This block has been moved to top-nav.css */


/* Minor CLS guards on cards/explanations */
.nm-mcq-item,
.nm-mcq-card {
  content-visibility: auto;
  contain: layout style paint;
}

.nm-mcq-explanation {
  min-height: 0.001px;
  /* prevents snap open/close from shifting siblings */
}

/* Respect reduced motion (JS smooth scroll respects this, keep parity) */
@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }
}

/* Improved Contrast for Accessibility */
.nm-custom-breadcrumb a {
  color: #5056d6;
  /* Darker blue for better contrast */
}

.nm-custom-breadcrumb a:hover {
  color: #3d42a8;
  /* Even darker on hover */
}

.nm-topic-tab {
  color: #2c3e50;
  /* Dark text */
}

.nm-answer-btn,
.nm-load-more-btn {
  background: #5056d6;
  /* WCAG AAA compliant */
}

.nm-answer-btn:hover,
.nm-load-more-btn:hover {
  background: #3d42a8;
}

/* Ensure links are visually distinct */
a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-thickness: 2px;
}

/* Skip Link - Accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #000;
  color: #fff;
  padding: 8px 12px;
  text-decoration: none;
  z-index: 100000;
  border-radius: 0 0 4px 0;
}

.skip-link:focus {
  top: 0;
}

.screen-reader-text:not(:focus):not(:active) {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

/* =========================================
   ✅ NEW: E-A-T Bar Styling (Compact Badge Style)
   ========================================= */
.nm-eat-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  /* Tighter gap for compact look */
  margin-bottom: 12px;
  padding: 0;
  /* No padding/border by default for compact */
  background: transparent;
  font-size: 0.85em;
  line-height: 1.4;
  border: none;
}

.nm-eat-item {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--nm-text-muted, #777);
}

.nm-eat-value {
  font-weight: 500;
  color: var(--nm-text-secondary);
}

.nm-eat-item.author .nm-eat-value {
  color: var(--nm-text-muted, #888);
  /* Subtle author text */
  font-weight: 400;
}

/* --- BADGES (Difficulty) --- */
.nm-eat-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.85em;
  font-weight: 600;
  color: #fff;
  text-transform: capitalize;
  line-height: 1.2;
}

.nm-eat-badge.hard {
  background-color: #d32f2f;
  /* Red */
}

.nm-eat-badge.medium {
  background-color: #f57c00;
  /* Dark Orange */
}

.nm-eat-badge.easy {
  background-color: #388e3c;
  /* Green */
}

/* --- Fact Checked --- */
.nm-eat-item.fact-checked {
  color: #2e7d32;
  /* Green text */
  font-weight: 600;
}

.nm-eat-item.fact-checked .dashicons {
  color: #2e7d32;
  font-size: 16px;
  width: 16px;
  height: 16px;
  line-height: 16px;
}

.nm-eat-item.fact-checked .nm-eat-value {
  color: #2e7d32;
}

/* --- Separator --- */
.nm-eat-separator {
  color: var(--nm-border-secondary);
  font-size: 0.8em;
  margin-top: -1px;
  /* visual align */
}

/* --- Mobile --- */
@media (max-width: 600px) {
  .nm-eat-bar {
    gap: 6px;
    font-size: 0.8em;
  }
}