/* ── ROOT ── */
:root {
  /* 🎯 YOUR COLORS */
  --accent: #ffa500;
  --accent-light: #fff3cd;
  --accent-dark: #cc8400;
  --surface: #ffffff;
  --surface2: #f8f9fa;
  --border: #dee2e6;
  --text: #212529;
  --muted: #6c757d;
  --green: #198754;
  --green-bg: #d1e7dd;
  --green-border: #a3cfbb;
  --radius: 0.5rem;
  --mono: SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;

  /* 🔄 MAP TO EXISTING SYSTEM (IMPORTANT) */
  --bg: #ffffff;
  --bg2: #f8f9fa;
  --bg3: #ffffff;

  --border2: #dee2e6;

  --text2: #495057;
  --text3: #6c757d;

  --accent2: #ffc107;
  --accent-glow: rgba(255, 165, 0, 0.15);

  --blue: #0d6efd;
  --orange: #ffa500;

  --sidebar-w: 300px;
  --banner-h: 130px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── FULL SHELL ── */
.rc-shell {
  display: flex;
  flex-direction: column;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
}

/* ── BANNER (static, always visible) ── */
.rc-banner {
  flex-shrink: 0;
  background: linear-gradient(100deg, #ffffff 0%, #f8f9fa 100%);
  border-bottom: 1px solid var(--border2);
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: relative;
  overflow: hidden;
}
.rc-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 60% 100% at 80% 50%,
    rgba(249, 115, 22, 0.06),
    transparent
  );
  pointer-events: none;
}
.rc-banner::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.5;
}
.rc-banner-left {
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 1;
}
.rc-banner-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  box-shadow: 0 4px 20px rgba(249, 115, 22, 0.35);
  flex-shrink: 0;
}
.rc-banner-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}
.rc-banner-title span {
  color: var(--accent);
}
.rc-banner-sub {
  font-size: 0.78rem;
  color: var(--text2);
  margin-top: 3px;
  font-family: var(--mono);
}
.rc-banner-stats {
  display: flex;
  gap: 12px;
  z-index: 1;
}
.rc-stat {
  text-align: center;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 8px 16px;
}
.rc-stat-num {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent);
  font-family: var(--mono);
  line-height: 1;
}
.rc-stat-lbl {
  font-size: 0.65rem;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 2px;
}

/* ── BODY (sidebar + content) ── */
.rc-body {
  display: flex;
  overflow: hidden;
  /* height set dynamically by JS after banner renders */
  height: calc(
    100vh - 64px - var(--banner-actual, 92px) - 60px
  ); /*changes made*/
  min-height: 500px;
}

/* ── SIDEBAR ── */
.rc-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition:
    transform 0.3s ease,
    width 0.3s ease;
}

.rc-sidebar-head {
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.rc-search-wrap {
  position: relative;
}
.rc-search-wrap i {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 0.8rem;
  pointer-events: none;
}
.rc-search {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 9px 12px 9px 34px;
  font-size: 0.82rem;
  color: var(--text);
  outline: none;
  font-family: var(--sans);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.rc-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.rc-search::placeholder {
  color: var(--text3);
}

.rc-sidebar-count {
  font-size: 0.68rem;
  color: var(--text3);
  font-family: var(--mono);
  padding: 7px 14px 0;
}
.rc-problems {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px 20px;
}
.rc-problems::-webkit-scrollbar {
  width: 4px;
}
.rc-problems::-webkit-scrollbar-track {
  background: transparent;
}
.rc-problems::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 4px;
}

.rc-prob-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
}
.rc-prob-item:hover {
  background: var(--bg3);
}
.rc-prob-item.active {
  background: rgba(249, 115, 22, 0.08);
  border-color: rgba(249, 115, 22, 0.25);
}
.rc-prob-item.active .rc-prob-title {
  color: var(--accent);
}
.rc-prob-num {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text3);
  min-width: 30px;
  flex-shrink: 0;
}
.rc-prob-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  flex: 1;
  transition: color 0.15s;
}
.rc-prob-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--green);
  opacity: 0;
  transition: opacity 0.15s;
}
.rc-prob-item.active .rc-prob-dot {
  opacity: 1;
}

/* ── CONTENT AREA ── */
.rc-content {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  min-width: 0;
  height: 100%;
}
.rc-content::-webkit-scrollbar {
  width: 5px;
}
.rc-content::-webkit-scrollbar-track {
  background: transparent;
}
.rc-content::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 4px;
}

.rc-article {
  max-width: 820px;
  margin: 0 auto;
  padding: 32px 32px 160px; /* extra bottom padding so nav never clips */
}

/* ── PROBLEM HEADER ── */
.rc-art-head {
  margin-bottom: 24px;
}
.rc-art-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.rc-art-id {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text3);
  background: var(--bg3);
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid var(--border2);
}
.rc-art-badge {
  font-size: 0.65rem;
  font-weight: 700;
  font-family: var(--mono);
  padding: 3px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-basic {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.25);
}
.badge-moderate {
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.25);
}
.badge-advanced {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.rc-art-title {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.rc-art-desc {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px;
  font-size: 0.9rem;
  color: var(--text2);
  line-height: 1.75;
  margin-bottom: 24px;
  white-space: pre-line;

}

.rc-desc-label {
  font-family: var(--mono);
  font-size: 0.90rem;
  font-weight: 700;
  color: var(--accent); /* matches description border */
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rc-desc-label::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent); /* same accent color */
  flex-shrink: 0;
}

/* ── EXPLANATION ── */
.rc-explanation {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-left: 3px solid var(--blue);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px;
  margin: 20px 0px;
  font-size: 0.88rem;
  color: var(--text2);
  line-height: 1.75;
  margin-bottom: 24px;
  white-space: pre-line;

}

.rc-explanation-label {
  font-family: var(--mono);
  font-size: 0.90rem;
  font-weight: 700;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rc-explanation-label::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
  flex-shrink: 0;
}

.rc-complexity {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.rc-complexity-box {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 0.75rem;
  width: fit-content;
}

.rc-complexity-box span {
  display: block;
  color: var(--text3);
  font-weight: bold;
}

.rc-complexity-box strong {
  color: var(--accent);
  font-size: 0.9rem;
}

.rc-art-meta {
  display: flex;
  gap: 5px;
  margin-top: 6px;
  font-size: 13px;
  color: #9ca3af;
}

.rc-art-meta i {
  margin-right: 4px;
}

.rc-author {
  color: #000000;
  font-size: 18px;
}

.rc-time {
  color: #000000;
  font-size: 18px;
}
/* ── CODE BLOCK (GFG-style) ── */
.rc-code-block {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 24px;
}

.rc-lang-tabs {
  display: flex;
  gap: 2px;
  padding: 10px 12px 0;
  background: #0b0d13;
  border-bottom: 1px solid var(--border);

  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  flex: 0 0 auto; 
}

.rc-lang-tabs::-webkit-scrollbar {
  display: none;
}
.rc-lang-tabs {
  scrollbar-width: none; /* Firefox */
}
.rc-lang-tab {
  padding: 7px 16px;
  border-radius: 7px 7px 0 0;
  border: none;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: transparent;
  color: var(--text3);
  border: 1px solid transparent;
  border-bottom: none;
  transition: all 0.15s;
}
.rc-lang-tab:hover {
  color: var(--text2);
  background: var(--bg3);
}
.rc-lang-tab.active {
  background: #1e1e2e;
  color: var(--accent);
  border-color: var(--border2);
  border-bottom-color: #1e1e2e;
}

.rc-code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1e1e2e;
  padding: 8px 14px;
}
.rc-code-file {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 7px;
}
.rc-code-file i {
  color: var(--accent);
}
.rc-copy-btn {
  background: none;
  border: 1px solid var(--border2);
  border-radius: 5px;
  color: var(--text3);
  padding: 4px 12px;
  font-size: 0.72rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
  font-family: var(--mono);
}
.rc-copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.rc-copy-btn.ok {
  border-color: var(--green);
  color: var(--green);
}

.rc-code-pane {
  display: none;
}
.rc-code-pane.active {
  display: block;
}

pre[class*="language-"] {
  margin: 0 !important;
  border-radius: 0 !important;
  background: #1e1e2e !important;
  padding: 18px !important;
  font-size: 0.83rem !important;
  max-height: 380px;
  overflow: auto;
  font-family: var(--mono) !important;
  line-height: 1.7 !important;
}
pre[class*="language-"]::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
pre[class*="language-"]::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 4px;
}

/* ── OUTPUT ── */
.rc-output {
  margin: 20px 0px;
  background: var(--bg2);
  border: 1px solid var(--green-border);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.rc-output-label {
  font-family: var(--mono);
  font-size: 0.90rem;
  font-weight: 700;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.rc-output-label::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--green);
  animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}
.rc-output-txt {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: #000000;
  white-space: pre-wrap;
  line-height: 1.65;
}

/* ── NAV ARROWS ── */
.rc-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.rc-nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text2);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--sans);
  transition: all 0.18s;
}
.rc-nav-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(249, 115, 22, 0.06);
}
.rc-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.rc-nav-btn i {
  font-size: 0.8rem;
}
.rc-nav-info {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text3);
}

/* ── WELCOME STATE ── */
.rc-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 40px;
}
.rc-welcome-icon {
  font-size: 3rem;
  margin-bottom: 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.rc-welcome h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 10px;
}
.rc-welcome p {
  color: var(--text2);
  font-size: 0.9rem;
  max-width: 340px;
  line-height: 1.7;
}

/* ── MOBILE TOGGLE ── */
.rc-sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 200;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(249, 115, 22, 0.5);
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}
.rc-sidebar-toggle:active {
  transform: scale(0.92);
}

.rc-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 150;
  backdrop-filter: blur(2px);
}

/* ── NO RESULTS ── */
.rc-no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--text3);
  font-size: 0.85rem;
}
.rc-no-results i {
  font-size: 1.6rem;
  display: block;
  margin-bottom: 10px;
  color: var(--border2);
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  :root {
    --sidebar-w: 280px;
  }
  .rc-banner-stats {
    display: none;
  }
  .rc-banner-title {
    font-size: 1rem;
  }
  .rc-body {
    height: calc(100vh - 64px - var(--banner-actual, 80px));
  }
  .rc-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 160;
    transform: translateX(-100%);
    padding-top: 64px; /* base header */
  }
  .rc-sidebar.open {
    transform: translateX(0);
  }
  .rc-sidebar-toggle {
    display: flex;
  }
  .rc-overlay.open {
    display: block;
  }
  .rc-article {
    padding: 20px 16px 120px;
  }
  .rc-art-title {
    font-size: 1.4rem;
  }
}

/* ── PROBLEM IMAGE ── */
.rc-problem-image {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}

.rc-problem-image img {
  max-width: 520px;
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--border2);
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}