/* ========================================================
   DevOps / Content Page Styles — Professional Edition
   ======================================================== */

/* ── Progress bar (shown in top nav via .sidebar-footer) ── */
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0;
  margin-left: 0.75rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.sidebar-progress-label { display: none; }

.sidebar-progress-bar {
  height: 4px;
  width: 80px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2563eb, #7c3aed);
  border-radius: 4px;
  transition: width 0.45s cubic-bezier(.4,0,.2,1);
}

.sidebar-progress-text {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: -0.01em;
}

/* ── Secondary topbar (search + filters, below nav) ── */
.topbar {
  position: sticky;
  top: var(--topnav-height, 60px);
  z-index: 50;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0.625rem 2rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  flex-wrap: wrap;
}

/* ── Search box ── */
.search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--content-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4375rem 0.875rem;
  flex: 1;
  min-width: 180px;
  max-width: 300px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
  background: #fff;
}

.search-box svg { color: var(--text-muted); flex-shrink: 0; }

.search-box input {
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--text);
  width: 100%;
  line-height: 1;
}

.search-box input::placeholder { color: var(--text-muted); }

/* ── Difficulty filters ── */
.difficulty-filters {
  display: flex;
  gap: 0.3125rem;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 0.3125rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  font-family: var(--font-sans);
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--content-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.filter-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.filter-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(37,99,235,0.3);
}

/* ========================================================
   CONTENT SPLIT LAYOUT
   ======================================================== */
.content-split {
  display: flex;
  gap: 0;
  max-width: 100%;
}

.content-split .content-panel {
  flex: 1;
  min-width: 0;
  padding: 2.25rem 2.5rem 3.5rem;
}

/* ── Right TOC sidebar ── */
.toc-sidebar {
  width: 230px;
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--topnav-height, 60px) + 1px);
  height: fit-content;
  max-height: calc(100vh - var(--topnav-height, 60px) - 2rem);
  overflow-y: auto;
  padding: 1.75rem 0 1.75rem;
  border-left: 1px solid var(--border);
}

.toc-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  padding: 0 1.25rem 0.875rem;
}

.toc-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1.25rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  transition: all var(--transition);
  border-left: 2px solid transparent;
  margin-left: -1px;
  text-decoration: none;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.toc-link:hover { color: var(--accent); background: var(--accent-light); }

.toc-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
  background: var(--accent-light);
}

.toc-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  flex-shrink: 0;
  transition: all var(--transition);
}

.toc-link.reviewed .toc-dot {
  background: #22c55e;
  border-color: #22c55e;
}

.toc-link.active .toc-dot {
  border-color: var(--accent);
  background: var(--accent);
}

.toc-keyboard-hint {
  padding: 0.875rem 1.25rem 0;
  font-size: 0.6875rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: 1.25rem;
  line-height: 1.55;
}

.toc-keyboard-hint kbd {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  background: var(--content-bg);
  border: 1px solid var(--border-strong, #cbd5e1);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  line-height: 1.4;
}

/* ========================================================
   PAGE HERO
   ======================================================== */
.page-hero { margin-bottom: 2.25rem; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid var(--accent-mid);
  border-radius: 20px;
  margin-bottom: 0.875rem;
}

.page-hero h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.035em;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.hero-lead {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 680px;
}

.hero-stats {
  display: none;
}

.stat { display: flex; flex-direction: column; }

.stat-number {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -0.03em;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  font-weight: 500;
}

/* Hero diagram */
.hero-diagram { margin: 0 0 2.5rem; }

.hero-diagram img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero-diagram figcaption {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  text-align: center;
}

/* ========================================================
   TOPIC CARDS
   ======================================================== */
.topic-card {
  margin-bottom: 1rem;
  background: var(--content-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  scroll-margin-top: 84px;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.topic-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--border-strong, #cbd5e1);
}

.topic-card.collapsed .topic-card-body {
  display: block;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  transition: max-height 0.35s ease-out, opacity 0.2s ease-out, padding 0.2s ease;
}

.topic-card:not(.collapsed) .topic-card-body {
  max-height: 3000px;
  opacity: 1;
  transition: max-height 0.45s ease-in, opacity 0.25s ease-in;
}

.topic-card.hidden { display: none; }

.topic-card.reviewed { border-left: 3px solid #22c55e; }

.topic-card-header {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1.125rem 1.375rem;
  cursor: pointer;
  user-select: none;
  position: relative;
  flex-wrap: wrap;
  transition: background var(--transition);
}

.topic-card-header:hover { background: #fbfcfe; }
.topic-card-header:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.topic-card-header h2 {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  border: none;
  padding: 0;
  min-width: 150px;
  letter-spacing: -0.02em;
  line-height: 1.4;
}

.topic-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Difficulty badges */
.difficulty-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.difficulty-badge.beginner  { background: #dcfce7; color: #166534; }
.difficulty-badge.intermediate { background: #fef9c3; color: #854d0e; }
.difficulty-badge.advanced  { background: #fee2e2; color: #991b1b; }

.read-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Expand/collapse icon */
.expand-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  position: relative;
}

.expand-icon::before, .expand-icon::after {
  content: '';
  position: absolute;
  background: var(--text-muted);
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.expand-icon::before {
  width: 12px; height: 2px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}

.expand-icon::after {
  width: 2px; height: 12px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}

.topic-card:not(.collapsed) .expand-icon::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.topic-card:not(.collapsed) .expand-icon::before { opacity: 0; }

/* Review button */
.review-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong, #cbd5e1);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}

.review-btn:hover {
  border-color: #22c55e;
  color: #22c55e;
  background: #f0fdf4;
}

.topic-card.reviewed .review-btn {
  background: #22c55e;
  border-color: #22c55e;
  color: #fff;
}

/* Card body */
.topic-card-body {
  padding: 0 1.375rem 1.375rem;
}

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

/* ── Key Takeaway Block ── */
.key-takeaway {
  display: flex;
  gap: 0.875rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, #eff6ff, #f5f3ff);
  border: 1px solid #c7d2fe;
  border-radius: var(--radius);
  margin-top: 1.125rem;
}

.takeaway-icon {
  font-size: 1.125rem;
  flex-shrink: 0;
  line-height: 1.5;
}

.key-takeaway strong {
  display: block;
  font-size: 0.6875rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.25rem;
  font-weight: 700;
}

.key-takeaway p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* ========================================================
   SCROLL TO TOP
   ======================================================== */
.scroll-top-btn {
  position: fixed;
  bottom: 2rem;
  right: 1.5rem;
  z-index: 101;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(37,99,235,0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s, background 0.15s;
  pointer-events: none;
}

.scroll-top-btn.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-top-btn:hover { background: var(--accent-hover); }

/* ========================================================
   INTERVIEW QUESTIONS
   ======================================================== */
.iq-list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: iq-counter;
}

.iq-item {
  counter-increment: iq-counter;
  margin-bottom: 0.625rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--content-card);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.iq-item:hover {
  border-color: var(--border-strong, #cbd5e1);
  box-shadow: var(--shadow-sm);
}

.iq-question {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.iq-question:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: var(--radius-lg);
}

.iq-num {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.6875rem;
  font-weight: 700;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.1rem;
  border: 1px solid var(--accent-mid);
}

.iq-num::before { content: counter(iq-counter); }

.iq-text {
  flex: 1;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
  letter-spacing: -0.01em;
}

.iq-toggle {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: transform 0.25s ease, color 0.15s ease;
  margin-top: 0.125rem;
}

.iq-item.open .iq-toggle { transform: rotate(180deg); color: var(--accent); }

.iq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.iq-item.open .iq-answer { max-height: 600px; }

.iq-answer-inner {
  padding: 0 1.25rem 1.125rem 3.875rem;
}

.iq-answer-label {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #15803d;
  margin-bottom: 0.5rem;
}

.iq-answer-label svg { flex-shrink: 0; }

.iq-answer-text {
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--text-secondary);
  background: #f0fdf4;
  border-left: 3px solid #22c55e;
  padding: 0.875rem 1rem;
  border-radius: 0 6px 6px 0;
}

/* Difficulty badges in IQ */
.iq-difficulty {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-size: 0.625rem;
  font-weight: 600;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.iq-difficulty.beginner    { background: #dcfce7; color: #166534; }
.iq-difficulty.intermediate { background: #fef9c3; color: #854d0e; }
.iq-difficulty.advanced    { background: #fee2e2; color: #991b1b; }

/* IQ controls */
.iq-controls { display: flex; gap: 0.5rem; margin-bottom: 1rem; }

.iq-ctrl-btn {
  padding: 0.375rem 0.875rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent-mid);
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  letter-spacing: -0.01em;
}

.iq-ctrl-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ========================================================
   RESPONSIVE
   ======================================================== */
@media (max-width: 1100px) {
  .toc-sidebar { display: none; }
}

@media (max-width: 900px) {
  .topbar { padding: 0.625rem 1rem; top: var(--topnav-height, 60px); }
  .topbar-inner { gap: 0.5rem; }
  .search-box { max-width: 100%; min-width: 0; }
  .content-split .content-panel { padding: 1.5rem 1rem 2rem; }
  .page-hero h1 { font-size: 1.625rem; }
  .hero-stats { gap: 1.5rem; }
  .difficulty-filters { display: none; }
  .topic-card-header { padding: 0.875rem 1rem; }
  .sidebar-footer { display: none; }
}

@media (max-width: 600px) {
  .iq-answer-inner { padding-left: 1.25rem; }
  .iq-question { padding: 0.875rem 1rem; gap: 0.5rem; }
}
