/**
 * components.css — Shared UI components for Interview Prep
 *
 * Imported after style.css on every page:
 *   <link rel="stylesheet" href="../css/components.css">  (subfolders)
 *   <link rel="stylesheet" href="css/components.css">     (root)
 *
 * Contains: filter bar, topic tags, difficulty badges, progress bars,
 *           empty state, modal, toast, home button override, page layout.
 */

/* ─────────────────────────────────────────────
   Page layout
   ───────────────────────────────────────────── */
.page {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.5rem 5rem;
}

.page-header { padding: 2.4rem 0 1.6rem; }
.page-header h1 { font-size: 1.8rem; color: var(--accent); margin: 0 0 0.3rem; }
.page-header p  { color: var(--text-dim); font-size: 0.88rem; margin: 0; }

.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 2rem 0 0.8rem;
}

/* ─────────────────────────────────────────────
   Filter bar
   ───────────────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.6rem;
}

.filter-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.73rem;
  font-weight: 600;
  padding: 4px 13px;
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.filter-btn:hover,
.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

/* ─────────────────────────────────────────────
   Topic tags
   ───────────────────────────────────────────── */
.topic-tag {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
}
.tag-java    { background: rgba(110,168,254,0.15); color: #6ea8fe; }
.tag-spring  { background: rgba(82,196,100,0.15);  color: #52c464; }
.tag-kafka   { background: rgba(255,193,7,0.15);   color: #ffc107; }
.tag-pattern { background: rgba(189,147,249,0.15); color: #bd93f9; }
.tag-db      { background: rgba(255,121,198,0.15); color: #ff79c6; }
.tag-testing { background: rgba(255,184,108,0.15); color: #ffb86c; }
.tag-general { background: rgba(160,167,186,0.15); color: #a0a7ba; }

/* ─────────────────────────────────────────────
   Difficulty badges
   ───────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
}
.badge-easy   { background: rgba(82,196,100,0.15);  color: #52c464; }
.badge-medium { background: rgba(255,193,7,0.15);   color: #ffc107; }
.badge-hard   { background: rgba(255,121,198,0.15); color: #ff79c6; }

/* Status badges */
.badge-answered   { background: rgba(126,224,184,0.12); color: var(--accent-2); }
.badge-unanswered { background: rgba(160,167,186,0.10); color: var(--text-dim); }
.badge-done       { background: rgba(126,224,184,0.12); color: var(--accent-2); }
.badge-progress   { background: rgba(240,182,86,0.12);  color: var(--warn); }

/* ─────────────────────────────────────────────
   Progress bar
   ───────────────────────────────────────────── */
.progress-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.2rem 1.6rem;
  margin-bottom: 2rem;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.progress-label span:last-child { color: var(--accent-2); font-weight: 700; }
.progress-track {
  background: var(--border);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 99px;
  transition: width 0.4s ease;
}

/* ─────────────────────────────────────────────
   Stats line
   ───────────────────────────────────────────── */
.stats {
  font-size: 0.76rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
}
.stats strong { color: var(--accent); font-weight: 700; }

/* ─────────────────────────────────────────────
   Empty state
   ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-dim);
  font-size: 0.88rem;
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 0.8rem; }

/* ─────────────────────────────────────────────
   Generic card
   ───────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.18s, transform 0.15s;
}
.card:hover { border-color: rgba(110,168,254,0.4); }
.card-body  { padding: 1rem 1.3rem 0.9rem; }

/* ─────────────────────────────────────────────
   Action buttons (small, borderless style)
   ───────────────────────────────────────────── */
.btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn:hover        { border-color: var(--accent);  color: var(--accent); }
.btn-primary      { background: var(--accent); color: #000; border-color: var(--accent); }
.btn-primary:hover { opacity: 0.85; }
.btn-success      { border-color: var(--accent-2); color: var(--accent-2); }
.btn-success:hover { background: rgba(126,224,184,0.1); }
.btn-danger:hover  { border-color: var(--danger); color: var(--danger); }
.btn-copied        { border-color: var(--accent-2); color: var(--accent-2); }

/* ─────────────────────────────────────────────
   Form inputs
   ───────────────────────────────────────────── */
.input, .textarea, .select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 8px 12px;
  border-radius: 8px;
  transition: border-color 0.15s;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
}
.textarea { resize: vertical; line-height: 1.55; }

/* ─────────────────────────────────────────────
   Modal
   ───────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.6rem;
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.modal h2 { margin: 0; font-size: 1.1rem; color: var(--accent); }
.modal p  { margin: 0; font-size: 0.82rem; color: var(--text-dim); line-height: 1.5; }
.modal-actions { display: flex; gap: 0.6rem; justify-content: flex-end; }
.modal-status  { font-size: 0.8rem; min-height: 1.2rem; }
.modal-status.ok  { color: var(--accent-2); }
.modal-status.err { color: var(--danger); }

/* ─────────────────────────────────────────────
   Markdown rendered content (.md-body)
   ───────────────────────────────────────────── */
.md-body { font-size: 0.86rem; line-height: 1.7; color: var(--text); }
.md-body h3 {
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.8px;
  text-transform: uppercase; margin: 0.9rem 0 0.25rem; color: var(--accent);
}
.md-body h3:first-child { margin-top: 0; }
.md-body p  { margin: 0 0 0.5rem; }
.md-body ul, .md-body ol { margin: 0.3rem 0 0.5rem 1.2rem; padding: 0; }
.md-body li { margin: 0.2rem 0; }
.md-body code {
  background: var(--code-bg); padding: 1px 5px; border-radius: 4px;
  font-size: 0.8rem; font-family: 'SF Mono','Fira Code',Consolas,monospace;
  color: var(--accent-2);
}
.md-body pre {
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 0.8rem 1rem; overflow-x: auto; margin: 0.5rem 0;
}
.md-body pre code { background: none; padding: 0; color: var(--text); font-size: 0.8rem; }

/* ─────────────────────────────────────────────
   Responsive
   ───────────────────────────────────────────── */
@media (max-width: 600px) {
  .page { padding: 0 1rem 4rem; }
  .page-header h1 { font-size: 1.5rem; }
  .filter-bar { gap: 0.35rem; }
  .filter-btn { font-size: 0.7rem; padding: 3px 10px; }
}
