/* learning-widget.css — Shared styles for FAQ, Articles, Quiz on landing pages */

.lw-container { max-width: 900px; margin: 0 auto; }

/* Tabs */
.lw-tabs { display: flex; gap: 0; border-bottom: 2px solid #e5e7eb; margin-bottom: 1.5rem; }
.lw-tab {
  padding: 0.75rem 1.25rem; cursor: pointer; font-weight: 500; font-size: 0.95rem;
  color: #6b7280; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s;
  background: none; border-top: none; border-left: none; border-right: none;
}
.lw-tab:hover { color: #374151; }
.lw-tab.active { color: var(--lw-brand, #7c3aed); border-bottom-color: var(--lw-brand, #7c3aed); font-weight: 600; }
.lw-panel { display: none; }
.lw-panel.active { display: block; }

/* Category chips */
.lw-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.25rem; }
.lw-chip {
  padding: 0.35rem 0.9rem; border-radius: 999px; font-size: 0.82rem; font-weight: 500;
  cursor: pointer; border: 1.5px solid #e5e7eb; background: #fff; color: #4b5563; transition: all 0.2s;
}
.lw-chip:hover { border-color: var(--lw-brand, #7c3aed); color: var(--lw-brand, #7c3aed); }
.lw-chip.active { background: var(--lw-brand, #7c3aed); color: #fff; border-color: var(--lw-brand, #7c3aed); }

/* Article cards */
.lw-articles { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) { .lw-articles { grid-template-columns: repeat(2, 1fr); } }
.lw-article-card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 1.25rem;
  cursor: pointer; transition: all 0.2s; position: relative;
}
.lw-article-card:hover { border-color: var(--lw-brand, #7c3aed); box-shadow: 0 4px 12px rgba(0,0,0,0.06); transform: translateY(-1px); }
.lw-article-card h3 { font-size: 1rem; font-weight: 600; color: #111827; margin: 0 0 0.4rem; line-height: 1.4; }
.lw-article-card p { font-size: 0.85rem; color: #6b7280; margin: 0 0 0.75rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lw-article-meta { display: flex; align-items: center; gap: 0.75rem; font-size: 0.78rem; color: #9ca3af; }
.lw-article-meta .lw-cat-badge {
  background: var(--lw-brand-light, #ede9fe); color: var(--lw-brand, #7c3aed);
  padding: 0.15rem 0.6rem; border-radius: 999px; font-weight: 500; font-size: 0.72rem;
}

/* Article detail modal */
.lw-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 9999;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  opacity: 0; transition: opacity 0.2s;
}
.lw-modal-overlay.visible { opacity: 1; }
.lw-modal {
  background: #fff; border-radius: 16px; max-width: 720px; width: 100%; max-height: 85vh;
  overflow-y: auto; padding: 2rem; position: relative;
}
.lw-modal-close {
  position: absolute; top: 1rem; right: 1rem; background: #f3f4f6; border: none;
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center; color: #6b7280;
}
.lw-modal-close:hover { background: #e5e7eb; }
.lw-modal h2 { font-size: 1.4rem; font-weight: 700; margin: 0 0 0.5rem; }
.lw-modal .lw-article-body { line-height: 1.7; color: #374151; }
.lw-modal .lw-article-body h2 { font-size: 1.15rem; font-weight: 600; margin: 1.5rem 0 0.5rem; color: #111827; }
.lw-modal .lw-article-body p { margin: 0 0 1rem; }
.lw-modal .lw-article-body ul, .lw-modal .lw-article-body ol { margin: 0 0 1rem; padding-left: 1.5rem; }
.lw-modal .lw-article-body li { margin-bottom: 0.4rem; }
.lw-modal .lw-article-body table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.88rem; }
.lw-modal .lw-article-body th { background: #f9fafb; padding: 0.6rem 0.75rem; text-align: left; font-weight: 600; border-bottom: 2px solid #e5e7eb; }
.lw-modal .lw-article-body td { padding: 0.5rem 0.75rem; border-bottom: 1px solid #f3f4f6; }
.lw-modal .lw-article-body strong { color: #111827; }

/* FAQ accordion */
.lw-faq-list { display: flex; flex-direction: column; gap: 0.5rem; }
.lw-faq-item { border: 1px solid #e5e7eb; border-radius: 10px; overflow: hidden; background: #fff; }
.lw-faq-q {
  padding: 1rem 1.25rem; cursor: pointer; font-weight: 500; font-size: 0.95rem;
  display: flex; justify-content: space-between; align-items: center; color: #1f2937;
  background: none; border: none; width: 100%; text-align: left; transition: background 0.15s;
}
.lw-faq-q:hover { background: #f9fafb; }
.lw-faq-q .lw-faq-arrow { transition: transform 0.2s; font-size: 0.8rem; color: #9ca3af; }
.lw-faq-item.open .lw-faq-arrow { transform: rotate(180deg); }
.lw-faq-a {
  max-height: 0; overflow: hidden; transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 1.25rem; color: #4b5563; font-size: 0.9rem; line-height: 1.65;
}
.lw-faq-item.open .lw-faq-a { max-height: 500px; padding: 0 1.25rem 1rem; }
.lw-faq-cat { font-size: 0.72rem; background: #f3f4f6; color: #6b7280; padding: 0.15rem 0.5rem; border-radius: 4px; margin-left: 0.5rem; font-weight: 400; }

/* Quiz */
.lw-quiz-intro { text-align: center; padding: 2rem; }
.lw-quiz-intro h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.5rem; }
.lw-quiz-intro p { color: #6b7280; margin-bottom: 1.5rem; }
.lw-quiz-start {
  background: var(--lw-brand, #7c3aed); color: #fff; border: none; padding: 0.75rem 2rem;
  border-radius: 10px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: background 0.2s;
}
.lw-quiz-start:hover { filter: brightness(1.1); }
.lw-quiz-progress { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; font-size: 0.88rem; color: #6b7280; }
.lw-quiz-bar { flex: 1; height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; }
.lw-quiz-bar-fill { height: 100%; background: var(--lw-brand, #7c3aed); transition: width 0.3s; border-radius: 3px; }
.lw-quiz-question { font-size: 1.05rem; font-weight: 600; color: #111827; margin-bottom: 1.25rem; line-height: 1.5; }
.lw-quiz-options { display: flex; flex-direction: column; gap: 0.6rem; }
.lw-quiz-option {
  padding: 0.85rem 1.1rem; border: 1.5px solid #e5e7eb; border-radius: 10px; cursor: pointer;
  font-size: 0.92rem; color: #374151; transition: all 0.2s; background: #fff;
}
.lw-quiz-option:hover { border-color: var(--lw-brand, #7c3aed); background: var(--lw-brand-light, #ede9fe); }
.lw-quiz-option.correct { border-color: #10b981; background: #ecfdf5; color: #065f46; }
.lw-quiz-option.wrong { border-color: #ef4444; background: #fef2f2; color: #991b1b; }
.lw-quiz-option.reveal { border-color: #10b981; background: #ecfdf5; }
.lw-quiz-option.disabled { pointer-events: none; opacity: 0.85; }
.lw-quiz-explanation {
  margin-top: 1rem; padding: 1rem; background: #f0fdf4; border-left: 3px solid #10b981;
  border-radius: 0 8px 8px 0; font-size: 0.88rem; color: #065f46; line-height: 1.6;
}
.lw-quiz-explanation.wrong-exp { background: #fef2f2; border-left-color: #ef4444; color: #991b1b; }
.lw-quiz-next {
  margin-top: 1.25rem; padding: 0.65rem 1.5rem; background: var(--lw-brand, #7c3aed);
  color: #fff; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; font-size: 0.92rem;
}
.lw-quiz-result { text-align: center; padding: 2rem 1rem; }
.lw-quiz-score { font-size: 3rem; font-weight: 800; color: var(--lw-brand, #7c3aed); }
.lw-quiz-result p { color: #6b7280; margin: 0.5rem 0; }
