/* ============================================
   Countries API — Clean UI Design System
   Theme: Light/Dark with Indigo accent
   ============================================ */

/* --- Light Theme (Default) --- */
:root {
  --bg-body: #f8f9fc;
  --bg-card: #ffffff;
  --bg-card-hover: #f3f4f8;
  --bg-elevated: #f1f3f8;
  --border: #e5e7eb;
  --border-hover: #c7c9d1;

  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-on-accent: #ffffff;
  --text-on-dark: #e2e8f0;

  --accent: #ef4444;
  --accent-hover: #dc2626;
  --accent-soft: rgba(239, 68, 68, 0.08);
  --accent-glow: rgba(239, 68, 68, 0.25);

  --surface-dark: #1e2030;
  --surface-dark-border: #2a2d3e;

  --code-bg: #1a1c2e;
  --code-text: #e2e8f0;
  --code-highlight: #fca5a5;
  --code-comment: #64748b;

  --success: #22c55e;
  --error: #ef4444;
  --error-soft: rgba(239, 68, 68, 0.1);

  --radius: 10px;
  --radius-sm: 6px;
  --radius-pill: 20px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08);

  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Dark Theme --- */
[data-theme="dark"] {
  --bg-body: #0f1117;
  --bg-card: #181b25;
  --bg-card-hover: #1e2130;
  --bg-elevated: #1c1f2b;
  --border: #2a2d3a;
  --border-hover: #3a3e4e;

  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-on-accent: #ffffff;
  --text-on-dark: #e2e8f0;

  --accent: #f87171;
  --accent-hover: #ef4444;
  --accent-soft: rgba(248, 113, 113, 0.1);
  --accent-glow: rgba(248, 113, 113, 0.2);

  --surface-dark: #12141e;
  --surface-dark-border: #222538;

  --code-bg: #12141e;
  --code-text: #e2e8f0;
  --code-highlight: #fca5a5;
  --code-comment: #64748b;

  --success: #4ade80;
  --error: #f87171;
  --error-soft: rgba(248, 113, 113, 0.1);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* --- Global Reset & Base --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  color-scheme: light dark;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  width: 100%;
  line-height: 1.6;
  font-weight: 400;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition:
    background-color var(--transition),
    color var(--transition);
}

/* Smooth theme transition for all themed elements */
.navbar, .endpoints-panel, .tester-panel, .console-box,
.response-box, .modal-content, .endpoint-card, .chip,
.code-tab, .method-select, .path-input, .key-input,
.docs-sidebar, .docs-content, .endpoint-doc, .lang-card,
.param-table th, .param-table td, .postman-guide,
.code-block, .key-result, .key-display, .badge, .method,
.btn, .status-badge, .api-key-pill {
  transition:
    background-color var(--transition),
    color var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* --- Layout --- */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 24px;
}

/* ============================================
   Navbar — Clean Modern Design
   ============================================ */
.navbar {
  display: flex;
  align-items: center;
  padding: 0 24px;
  min-height: 58px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

/* ---- Logo ---- */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-right: 32px;
  text-decoration: none;
}

.nav-logo-img {
  height: 42px;
  width: auto;
  border-radius: 6px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

[data-theme="dark"] .nav-logo-img {
  mix-blend-mode: normal;
  background-color: rgba(255, 255, 255, 0.95);
  padding: 2px 4px;
  border-radius: 8px;
}

.logo-icon-ring {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, #f97316 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.logo-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
}

.logo-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  line-height: 1.1;
}

.logo-version {
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  font-family: var(--font-mono);
  line-height: 1;
  margin-top: -1px;
}

/* ---- Nav Links — underline style ---- */
.nav-links {
  display: flex;
  align-items: stretch;
  height: 100%;
  gap: 2px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0 14px;
  position: relative;
  transition: color var(--transition);
  white-space: nowrap;
}

.nav-item::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 14px;
  right: 14px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item:hover {
  color: var(--text-primary);
}

.nav-item:hover::after {
  transform: scaleX(0.6);
  opacity: 0.4;
}

.nav-item.active {
  color: var(--accent);
  font-weight: 600;
}

.nav-item.active::after {
  transform: scaleX(1);
}

/* ---- Header Actions ---- */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* API Key pill — minimal */
.api-key-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 5px 5px 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
}

.key-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 5px rgba(34, 197, 94, 0.6);
  animation: pulse-dot 2s ease-in-out infinite;
  flex-shrink: 0;
}

.api-key-pill code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-primary);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.key-copy-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-sans);
  letter-spacing: 0.2px;
}

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

/* Outline accent button */
.btn-outline-accent {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-sans);
  letter-spacing: 0.1px;
  white-space: nowrap;
}

.btn-outline-accent:hover {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-outline-accent:active {
  transform: translateY(0);
}

/* Theme toggle — square icon button */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: all var(--transition);
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

/* Responsive navbar */
@media (max-width: 900px) {
  .navbar { flex-wrap: wrap; justify-content: space-between; gap: 12px; }
  .nav-links {
    order: 3;
    width: 100%;
    justify-content: center;
    border-top: 1px solid var(--border);
    padding-top: 12px;
  }
  .logo { margin-right: auto; }
}

@media (max-width: 600px) {
  .navbar { padding: 12px 14px; }
  .api-key-pill { display: none; }
  .nav-links { overflow-x: auto; justify-content: flex-start; padding-bottom: 4px; }
  .nav-item { white-space: nowrap; }
}

/* ============================================
   API Info Banner — Rich Hero Layout
   ============================================ */
.api-banner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  animation: bannerReveal 0.45s cubic-bezier(0.4, 0, 0.2, 1) both;
}

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

/* Animated rainbow accent line */
.banner-accent-bar {
  height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, #f97316 35%, #a855f7 65%, #3b82f6 100%);
  background-size: 200% 100%;
  animation: shiftGradient 4s linear infinite;
}

@keyframes shiftGradient {
  0%   { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

/* Two-column body */
.banner-body {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 0;
}

/* ---- Left: Hero ---- */
.banner-hero {
  padding: 28px 28px 26px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Eyebrow row */
.banner-eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
}

.banner-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.banner-status-dot {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--success);
  font-weight: 500;
}

/* Title */
.banner-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.6px;
  line-height: 1.15;
}

.banner-version {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.2px;
  vertical-align: middle;
  margin-left: 6px;
}

/* Description */
.banner-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.65;
  max-width: 560px;
}

.banner-desc strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Tags row */
.banner-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.btag {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.1px;
  border: 1px solid;
}

.btag-green  { background: rgba(34, 197, 94, 0.08);  color: #16a34a;  border-color: rgba(34, 197, 94, 0.2); }
.btag-blue   { background: rgba(59, 130, 246, 0.08); color: #2563eb;  border-color: rgba(59, 130, 246, 0.2); }
.btag-purple { background: rgba(168, 85, 247, 0.08); color: #9333ea;  border-color: rgba(168, 85, 247, 0.2); }
.btag-orange { background: rgba(249, 115, 22, 0.08); color: #ea580c;  border-color: rgba(249, 115, 22, 0.2); }
.btag-slate  { background: var(--bg-elevated);        color: var(--text-secondary); border-color: var(--border); }

[data-theme="dark"] .btag-green  { color: #4ade80; }
[data-theme="dark"] .btag-blue   { color: #60a5fa; }
[data-theme="dark"] .btag-purple { color: #c084fc; }
[data-theme="dark"] .btag-orange { color: #fb923c; }

/* Base URL strip */
.banner-url-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}

.url-strip-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.url-strip-code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.url-strip-copy {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  font-family: var(--font-sans);
  white-space: nowrap;
}

.url-strip-copy:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* ---- Right column ---- */
.banner-right {
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
}

/* Stat grid 2×2 */
.banner-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border);
}

.bstat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 20px 10px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.bstat-card:nth-child(even) { border-right: none; }
.bstat-card:nth-child(3),
.bstat-card:nth-child(4) { border-bottom: none; }

.bstat-card:hover {
  background: var(--bg-card-hover);
}

.bstat-icon {
  font-size: 1.2rem;
  line-height: 1;
  margin-bottom: 2px;
}

.bstat-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  letter-spacing: -0.4px;
  line-height: 1.1;
}

.bstat-value.bstat-green {
  color: var(--success);
  font-size: 0.88rem;
  font-family: var(--font-sans);
  display: flex;
  align-items: center;
  gap: 5px;
}

.bstat-value.bstat-green::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
  animation: pulse-dot 2s ease-in-out infinite;
}

.bstat-label {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  font-weight: 500;
}

/* Use-cases section */
.banner-usecases {
  flex: 1;
  padding: 18px 20px;
}

.usecases-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  letter-spacing: -0.1px;
}

.usecases-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.usecases-list li {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.usecases-list li strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ---- Responsive ---- */
@media (max-width: 1100px) {
  .banner-body { grid-template-columns: 1fr 280px; }
}

@media (max-width: 900px) {
  .banner-body { grid-template-columns: 1fr; }
  .banner-body > * { min-width: 0; }
  .banner-hero { border-right: none; border-bottom: 1px solid var(--border); }
  .banner-right { flex-direction: row; }
  .banner-stat-grid {
    grid-template-columns: repeat(4, 1fr);
    border-bottom: none;
    border-right: 1px solid var(--border);
    flex: 1;
  }
  .bstat-card { border-bottom: none; }
  .bstat-card:nth-child(even) { border-right: 1px solid var(--border); }
  .bstat-card:last-child { border-right: none; }
  .banner-usecases { border-top: none; padding: 16px; }
}

@media (max-width: 700px) {
  .banner-hero { padding: 20px 18px; }
  .banner-title { font-size: 1.4rem; }
  .banner-right { flex-direction: column; }
  .banner-stat-grid { grid-template-columns: repeat(2, 1fr); border-right: none; }
  .bstat-card:nth-child(1), .bstat-card:nth-child(2) { border-bottom: 1px solid var(--border); }
  .bstat-card:nth-child(odd) { border-right: 1px solid var(--border); }
  .bstat-card:nth-child(even) { border-right: none; }
}

@media (max-width: 480px) {
  .banner-title { font-size: 1.2rem; }
  .url-strip-code { font-size: 0.72rem; }
}

/* ============================================
   Dashboard Grid
   ============================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 440px 1fr;
  gap: 20px;
}

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-grid > * {
    min-width: 0;
  }
}

/* ============================================
   Panels (Cards)
   ============================================ */
.endpoints-panel, .tester-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.panel-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ============================================
   Endpoint Cards
   ============================================ */
.endpoint-group {
  margin-bottom: 20px;
}

.endpoint-group h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 500;
}

.endpoint-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all var(--transition);
}

.endpoint-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.endpoint-card.active {
  border-color: var(--accent);
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
}

/* --- Method Badge --- */
.method {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  min-width: 46px;
  text-align: center;
  letter-spacing: 0.3px;
}

.method.get {
  background: var(--surface-dark);
  color: var(--text-on-dark);
}

.method.post {
  background: var(--accent);
  color: var(--text-on-accent);
}

.path {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 450;
  color: var(--text-primary);
}

.desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
  font-weight: 400;
}

/* ============================================
   Preset Chips
   ============================================ */
.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 450;
  cursor: pointer;
  transition: all var(--transition);
}

.chip:hover {
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* ============================================
   Code Snippets & Tabs
   ============================================ */
.code-snippets-group {
  margin-top: 20px;
}

.code-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.code-tab {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.code-tab:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.code-tab.active {
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: var(--accent);
}

.code-block {
  background: var(--code-bg);
  border: 1px solid var(--surface-dark-border);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--code-text);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
}

.comment {
  color: var(--code-comment);
}

.key-placeholder {
  color: var(--code-highlight);
  font-weight: 500;
}

.postman-guide {
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--surface-dark-border);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  line-height: 1.6;
}

.postman-guide p {
  margin-top: 8px;
  color: var(--code-text);
}

.postman-guide strong {
  font-weight: 600;
  color: #ffffff;
}

.postman-guide ul {
  padding-left: 20px;
  margin-top: 4px;
}

.postman-guide code {
  color: var(--code-highlight);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* ============================================
   Console & Request Tester
   ============================================ */
.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 450;
  color: var(--success);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot.green {
  background: var(--success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.console-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.request-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.method-select {
  background: var(--surface-dark);
  color: var(--text-on-dark);
  border: 1px solid var(--surface-dark-border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.82rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.path-input, .key-input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-mono);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 400;
  transition: border-color var(--transition);
}

.path-input:focus, .key-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.request-headers {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.request-headers label {
  white-space: nowrap;
  font-weight: 450;
}

.request-headers code {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.8rem;
}

.request-body {
  margin-top: 10px;
}

.request-body label {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
  font-weight: 450;
}

.request-body textarea {
  width: 100%;
  background: var(--code-bg);
  border: 1px solid var(--surface-dark-border);
  color: var(--code-highlight);
  font-family: var(--font-mono);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  resize: vertical;
  transition: border-color var(--transition);
}

.request-body textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.hidden {
  display: none !important;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.82rem;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.1px;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-on-accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 12px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-on-dark);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* ============================================
   Response Box
   ============================================ */
.response-box {
  background: var(--code-bg);
  border: 1px solid var(--surface-dark-border);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--code-text);
}

.response-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.response-header h3 {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--code-text);
}

.response-metrics {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.78rem;
}

.status-badge {
  padding: 3px 10px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  transition: all 0.2s ease;
}

.status-200, .status-201 {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.status-401, .status-403, .status-404 {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.status-429 {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.4);
}

.status-500 {
  background: rgba(225, 29, 72, 0.2);
  color: #fda4af;
  border: 1px solid rgba(253, 164, 175, 0.4);
}

.status-idle {
  color: var(--code-comment);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.time-badge, .speed-badge, .ratelimit-badge, .size-badge {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  padding: 3px 8px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(226, 232, 240, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.speed-fast {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.25);
  background: rgba(34, 197, 94, 0.08);
}

.speed-normal {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.25);
  background: rgba(56, 189, 248, 0.08);
}

.speed-slow {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.25);
  background: rgba(251, 191, 36, 0.08);
}

.rate-low {
  color: #f87171 !important;
  border-color: rgba(248, 113, 113, 0.3) !important;
  background: rgba(239, 68, 68, 0.12) !important;
}

@keyframes flashPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.4);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(56, 189, 248, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0);
  }
}

.flash-pulse {
  animation: flashPulse 0.45s ease-out;
}

.json-viewer {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--code-text);
  max-height: 420px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

/* ============================================
   Modal
   ============================================ */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 420px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  transition: color var(--transition);
  line-height: 1;
}

.close-btn:hover {
  color: var(--text-primary);
}

.modal-body label {
  display: block;
  font-size: 0.82rem;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-weight: 450;
}

.modal-body input {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  transition: border-color var(--transition);
}

.modal-body input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.full-width {
  width: 100%;
}

.key-result {
  margin-top: 14px;
  padding: 14px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
}

.key-result p {
  color: var(--text-primary);
  font-size: 0.85rem;
}

.key-result strong {
  font-weight: 600;
  color: #ffffff;
}

.key-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--code-bg);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin: 8px 0;
}

.key-display code {
  color: var(--code-highlight);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.82rem;
}

.key-display button {
  background: var(--accent);
  color: var(--text-on-accent);
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 500;
  transition: background var(--transition);
}

.key-display button:hover {
  background: var(--accent-hover);
}

.tip {
  font-size: 0.73rem;
  color: var(--accent);
  font-weight: 450;
}

/* ============================================
   Docs Page — Specific Styles
   ============================================ */
.docs-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }
  .docs-layout > * {
    min-width: 0;
  }
}

.docs-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  position: sticky;
  top: 20px;
  height: fit-content;
  box-shadow: var(--shadow-sm);
}

.docs-sidebar h3 {
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 500;
}

.docs-nav-link {
  display: block;
  padding: 7px 10px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 450;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  transition: all var(--transition);
  border-left: 2px solid transparent;
}

.docs-nav-link:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-left-color: var(--accent);
}

.docs-nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-left-color: var(--accent);
}

.docs-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  max-width: 100%;
  box-sizing: border-box;
}

.docs-section {
  margin-bottom: 40px;
  scroll-margin-top: 80px;
}

.docs-section h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.docs-section p {
  color: var(--text-secondary);
  line-height: 1.65;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.docs-section strong {
  font-weight: 600;
  color: #ffffff;
}

.docs-section code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 5px;
  border-radius: 3px;
  word-break: break-all;
  overflow-wrap: anywhere;
  max-width: 100%;
  display: inline-block;
  vertical-align: middle;
}

.endpoint-doc {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  margin-bottom: 16px;
  max-width: 100%;
  box-sizing: border-box;
}

.endpoint-doc p {
  font-size: 0.88rem;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.endpoint-title-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.endpoint-title-bar .path {
  word-break: break-all;
  overflow-wrap: anywhere;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 12px 0;
  border-radius: var(--radius-sm);
}

.param-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.84rem;
  display: table;
}

.param-table th, .param-table td {
  padding: 9px 12px;
  border: 1px solid var(--border);
  text-align: left;
}

.param-table th {
  background: var(--surface-dark);
  color: var(--text-on-dark);
  font-weight: 500;
  font-size: 0.8rem;
}

.param-table td {
  background: var(--bg-card);
  color: var(--text-secondary);
}

.param-table td code {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.lang-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.lang-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.lang-card code {
  color: var(--accent);
  font-weight: 500;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* ============================================
   Complete Multi-Device Responsive System
   ============================================ */

/* --- Tablets & Small Laptops (max-width: 1024px) --- */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .docs-layout {
    grid-template-columns: 1fr;
  }
  .docs-layout > * {
    min-width: 0;
  }

  .docs-sidebar {
    position: sticky;
    top: 0;
    z-index: 80;
    margin-bottom: 16px;
    padding: 10px 14px;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
  }

  .docs-sidebar-nav {
    display: flex;
    overflow-x: auto;
    gap: 6px;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  .docs-nav-link {
    margin-bottom: 0;
    white-space: nowrap;
    border-left: none;
    border-bottom: 2px solid transparent;
    padding: 5px 10px;
    font-size: 0.8rem;
    flex-shrink: 0;
  }

  .docs-nav-link:hover, .docs-nav-link.active {
    border-left-color: transparent;
    border-bottom-color: var(--accent);
  }
}

/* --- Mobile & Small Tablets (max-width: 768px) --- */
@media (max-width: 768px) {
  .app-container {
    padding: 12px 14px;
  }

  .navbar {
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    align-items: stretch;
  }

  .logo {
    justify-content: center;
  }

  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
  }

  .header-actions {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .api-key-pill {
    font-size: 0.76rem;
    max-width: 100%;
  }

  .api-key-pill code {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
  }

  .endpoints-panel, .tester-panel, .docs-content {
    padding: 16px 14px;
  }

  .endpoint-card {
    flex-wrap: wrap;
    gap: 8px;
  }

  .desc {
    max-width: 100%;
    margin-left: 0;
    width: 100%;
  }

  .lang-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

/* --- Small Phones & Portraits (max-width: 600px) --- */
@media (max-width: 600px) {
  .request-bar {
    flex-direction: column;
  }

  .method-select {
    width: 100%;
  }

  .path-input {
    width: 100%;
  }

  #send-req-btn {
    width: 100%;
  }

  .request-headers {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .key-input {
    width: 100%;
  }

  .response-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .modal-content {
    width: 100%;
    max-width: calc(100vw - 24px);
    padding: 18px 14px;
    margin: 12px;
  }

  .preset-chips {
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    width: 100%;
  }

  .banner-url-strip {
    flex-wrap: wrap;
    gap: 8px;
  }

  .url-strip-code {
    width: 100%;
    order: 3;
    font-size: 0.74rem;
  }

  .chip {
    white-space: nowrap;
  }

  .code-tabs {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .code-block, .json-viewer {
    font-size: 0.78rem;
    padding: 10px 12px;
  }
}

/* --- Extra Small Devices / 320px-360px Phones (max-width: 400px) --- */
@media (max-width: 400px) {
  .logo h1 {
    font-size: 1.05rem;
  }

  .nav-item {
    font-size: 0.8rem;
    padding: 5px 8px;
  }

  .btn {
    font-size: 0.78rem;
    padding: 7px 12px;
  }

  .lang-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
  text-align: center;
  padding: 24px 0 16px;
  margin-top: 24px;
  border-top: 1px solid var(--border);
}

.site-footer p {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.2px;
}

.footer-author {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
  transition: opacity var(--transition);
}

.footer-author:hover {
  text-decoration: underline;
  opacity: 0.85;
}

/* ============================================
   Language Toggle Button
   ============================================ */
.lang-toggle-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 1.15rem;
  cursor: pointer;
  transition: all var(--transition);
  padding: 0;
  flex-shrink: 0;
}

.lang-toggle-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--border-hover);
}

/* Myanmar body font override */
body.lang-my {
  font-family: 'Noto Sans Myanmar', 'Plus Jakarta Sans', sans-serif;
  font-size: 1.02em;
  line-height: 1.75;
}

body.lang-my .logo-name,
body.lang-my .banner-title,
body.lang-my h1, body.lang-my h2, body.lang-my h3 {
  font-family: 'Noto Sans Myanmar', sans-serif;
}

/* ============================================
   Learn Page — Layout
   ============================================ */
.learn-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  align-items: start;
  min-height: calc(100vh - 200px);
}

/* ---- Sidebar ---- */
.learn-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: sticky;
  top: 16px;
}

.learn-sidebar-header {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
}

.learn-sidebar-header h2 {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.learn-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.learn-progress-bar {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 99px;
  overflow: hidden;
}

.learn-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #f97316);
  border-radius: 99px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.learn-progress-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}

.lesson-nav-list {
  display: flex;
  flex-direction: column;
}

.lesson-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-align: left;
  border-bottom: 1px solid var(--border);
  transition: all var(--transition);
  width: 100%;
}

.lesson-nav-item:last-child { border-bottom: none; }

.lesson-nav-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.lesson-nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.lesson-nav-item.done {
  color: var(--text-muted);
}

.lesson-nav-item.done .lesson-nav-label {
  text-decoration: line-through;
  text-decoration-color: var(--success);
  text-decoration-thickness: 1.5px;
}

.lesson-nav-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lesson-nav-item.active .lesson-nav-num {
  background: var(--accent);
  color: #fff;
}

.lesson-nav-label {
  flex: 1;
  line-height: 1.35;
}

.lesson-nav-status {
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* ---- Main Content ---- */
.learn-main {
  min-height: 500px;
}

/* Welcome state */
.learn-welcome {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 32px;
  text-align: center;
  gap: 14px;
}

.welcome-icon {
  font-size: 3.5rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.learn-welcome h2 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.4px;
}

.learn-welcome p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 420px;
}

.learn-start-btn {
  margin-top: 8px;
  padding: 12px 28px;
  font-size: 0.9rem;
}

/* ---- Lesson Content ---- */
.lesson-content {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.lesson-header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px 28px 20px;
  border-bottom: none;
}

.lesson-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.lesson-module-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.lesson-module-of {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.lesson-title {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin-bottom: 6px;
}

.lesson-subtitle {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

/* ---- Tabs ---- */
.lesson-tabs {
  display: flex;
  border: 1px solid var(--border);
  border-top: none;
  border-bottom: none;
  background: var(--bg-elevated);
}

.lesson-tab {
  flex: 1;
  padding: 12px 16px;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  border-bottom: 2px solid transparent;
}

.lesson-tab:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.lesson-tab.active {
  color: var(--accent);
  font-weight: 600;
  background: var(--bg-card);
  border-bottom-color: var(--accent);
}

/* ---- Lesson Section ---- */
.lesson-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 28px;
}

.lesson-section.hidden { display: none; }

/* Theory body formatting */
.lesson-theory-body h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 20px 0 8px;
}

.lesson-theory-body h3:first-child { margin-top: 0; }

.lesson-theory-body p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 10px;
}

.lesson-theory-body ul {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.lesson-theory-body li {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.lesson-theory-body code {
  font-family: var(--font-mono);
  font-size: 0.83rem;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 5px;
  border-radius: 4px;
}

.code-block {
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.65;
  overflow-x: auto;
  margin: 12px 0;
  border: 1px solid rgba(255,255,255,0.06);
  white-space: pre-wrap;
  word-break: break-word;
}

.param-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin: 12px 0 16px;
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}

.param-table th {
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-weight: 600;
  text-align: left;
  padding: 8px 12px;
  border: 1px solid var(--border);
}

.param-table td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: top;
}

.param-table code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ---- Exercise ---- */
.exercise-box {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.exercise-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.exercise-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.exercise-goal {
  font-size: 0.72rem;
  font-weight: 600;
  color: #7c3aed;
  background: rgba(124, 58, 237, 0.08);
  border: 1px solid rgba(124, 58, 237, 0.2);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.exercise-desc {
  font-size: 0.87rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.exercise-request-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.exercise-method-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: #16a34a;
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.2);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}

.exercise-path {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-primary);
  flex: 1;
  word-break: break-all;
}

.exercise-key-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.exercise-key-row .key-input {
  flex: 1;
  max-width: 300px;
}

.exercise-response {
  margin-top: 4px;
  background: var(--code-bg);
  border: 1px solid var(--surface-dark-border);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--code-text);
}

.exercise-response.hidden { display: none; }

.response-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--surface-dark-border);
  padding-bottom: 12px;
}

.exercise-note {
  font-size: 0.82rem;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 14px;
  line-height: 1.6;
}

/* ---- Quiz ---- */
.quiz-box {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.quiz-box h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.quiz-questions {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.quiz-question {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-q-text {
  font-size: 0.88rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.84rem;
  color: var(--text-secondary);
  transition: all var(--transition);
  background: var(--bg-elevated);
}

.quiz-option:hover {
  border-color: var(--accent);
  color: var(--text-primary);
  background: var(--accent-soft);
}

.quiz-option input[type="radio"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.quiz-result {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.88rem;
  font-weight: 500;
}

.quiz-result.hidden { display: none; }

.quiz-success {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.2);
  color: #15803d;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quiz-fail {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.2);
  color: var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quiz-score-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.82rem;
  background: rgba(255,255,255,0.5);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

/* ---- Lesson Footer Nav ---- */
.lesson-footer-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0 0;
}

.complete-btn.completed {
  background: var(--success);
  border-color: var(--success);
  opacity: 0.75;
  cursor: default;
}

/* ---- Responsive Learn ---- */
@media (max-width: 1000px) {
  .learn-layout { grid-template-columns: 220px 1fr; }
}

@media (max-width: 768px) {
  .learn-layout { grid-template-columns: 1fr; }
  .learn-layout > * { min-width: 0; }
  .learn-sidebar { position: static; }
  .lesson-nav-list { 
    flex-direction: row; 
    overflow-x: auto; 
    white-space: nowrap; 
    padding-bottom: 8px; 
    gap: 10px; 
  }
  .lesson-nav-item { 
    flex: 0 0 auto; 
    width: auto; 
    border-bottom: none; 
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
  }
}

@media (max-width: 480px) {
  .lesson-header { padding: 18px 16px 14px; }
  .lesson-title { font-size: 1.2rem; }
  .lesson-section { padding: 18px 16px; }
}

