/* ============================================================
   DiCode Minimal Theme — Black/White/Blue
   Dark:  Black bg, White text, Blue buttons
   Light: White bg, Black text, Blue buttons
   NOT applied to /mag/ pages
   ============================================================ */

/* ── CSS Variables ── */
:root {
  color-scheme: light;
  --dc-bg: #ffffff;
  --dc-bg-2: #fafafa;
  --dc-card: #ffffff;
  --dc-line: #e5e7eb;
  --dc-line-strong: #d1d5db;
  --dc-text: #0a0a0a;
  --dc-muted: #6b7280;
  --dc-soft: #f4f4f5;
  --dc-blue: #2563eb;
  --dc-blue-hover: #1d4ed8;
  --dc-blue-soft: #eff6ff;
  --dc-blue-ring: rgba(37, 99, 235, 0.15);
  --dc-radius: 12px;
  --dc-font: 'Vazirmatn', system-ui, -apple-system, sans-serif;
}

html.dark {
  color-scheme: dark;
  --dc-bg: #0a0a0a;
  --dc-bg-2: #111111;
  --dc-card: #141414;
  --dc-line: #262626;
  --dc-line-strong: #3f3f3f;
  --dc-text: #fafafa;
  --dc-muted: #a1a1aa;
  --dc-soft: #1c1c1c;
  --dc-blue: #3b82f6;
  --dc-blue-hover: #60a5fa;
  --dc-blue-soft: rgba(59, 130, 246, 0.1);
  --dc-blue-ring: rgba(59, 130, 246, 0.2);
}

/* ── Base Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--dc-bg);
  color: var(--dc-text);
  font-family: var(--dc-font);
}

body {
  min-height: 100vh;
  line-height: 1.7;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { 
  color: inherit; 
  text-decoration: none; 
}

img {
  max-width: 100%;
  height: auto;
}

/* ── Layout ── */
.dc-shell { 
  max-width: 1100px; 
  margin-inline: auto; 
  padding-inline: 20px; 
}

.dc-page { 
  min-height: 60vh;
}

.dc-muted { 
  color: var(--dc-muted); 
}

/* ── Glass Header ── */
.glass-header, 
.doc-glass-header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--dc-line);
}

html.dark .glass-header,
html.dark .doc-glass-header {
  background: rgba(10, 10, 10, 0.9);
}

/* ── Navigation Items ── */
.section-nav-item, 
.doc-nav-link, 
.doc-lang-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--dc-muted);
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
}

.section-nav-item:hover, 
.doc-nav-link:hover, 
.doc-lang-chip:hover {
  background: var(--dc-soft);
  color: var(--dc-text);
}

.section-nav-item.active, 
.doc-nav-link.active, 
.doc-lang-chip.active {
  background: var(--dc-blue);
  color: #fff;
}

/* ── Cards ── */
.dc-card {
  background: var(--dc-card);
  border: 1px solid var(--dc-line);
  border-radius: var(--dc-radius);
  transition: border-color 0.15s ease;
}

.dc-card:hover {
  border-color: var(--dc-line-strong);
}

/* ── Search Box ── */
.dc-search {
  background: var(--dc-card);
  border: 1px solid var(--dc-line);
  border-radius: 50px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dc-search:focus-within {
  border-color: var(--dc-blue);
  box-shadow: 0 0 0 3px var(--dc-blue-ring);
}

.dc-search input {
  color: var(--dc-text);
  background: transparent;
  border: none;
  outline: none;
}

.dc-search input::placeholder {
  color: var(--dc-muted);
  opacity: 0.7;
}

/* ── Buttons ── */
.dc-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--dc-blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.dc-btn-primary:hover {
  background: var(--dc-blue-hover);
}

.dc-btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  background: transparent;
  color: var(--dc-text);
  border: 1px solid var(--dc-line);
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.dc-btn-ghost:hover {
  background: var(--dc-soft);
  border-color: var(--dc-line-strong);
}

/* ── Chips / Tags ── */
.dc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--dc-line);
  background: var(--dc-card);
  color: var(--dc-muted);
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dc-chip:hover {
  background: var(--dc-soft);
  color: var(--dc-text);
  border-color: var(--dc-line-strong);
}

.dc-chip.active {
  background: var(--dc-blue);
  border-color: var(--dc-blue);
  color: #fff;
}

/* ── Hero Section ── */
.dc-hero { 
  padding: 80px 0 60px; 
  text-align: center; 
}

.dc-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid var(--dc-line);
  border-radius: 6px;
  color: var(--dc-muted);
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--dc-card);
}

.dc-title {
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 1.1;
  letter-spacing: -0.04em;
  font-weight: 800;
  color: var(--dc-text);
  margin: 20px 0 16px;
}

.dc-title span { 
  color: var(--dc-blue); 
}

.dc-subtitle {
  max-width: 600px;
  margin: 0 auto;
  color: var(--dc-muted);
  font-size: clamp(0.95rem, 1.6vw, 1.1rem);
  line-height: 1.7;
}

/* ── Google-style Tabs ── */
.dc-google-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--dc-line);
  padding-bottom: 0;
  margin-top: 16px;
}

.dc-google-tab {
  position: relative;
  padding: 12px 16px;
  color: var(--dc-muted);
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  cursor: pointer;
  background: none;
  border: none;
  transition: color 0.15s ease;
}

.dc-google-tab:hover { 
  color: var(--dc-text); 
}

.dc-google-tab.active { 
  color: var(--dc-blue); 
}

.dc-google-tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--dc-blue);
}

/* ── Search Results ── */
.dc-result {
  padding: 20px 0;
  border-bottom: 1px solid var(--dc-line);
}

.dc-result:last-child { 
  border-bottom: none; 
}

.dc-result-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dc-text);
  line-height: 1.5;
  transition: color 0.15s ease;
}

.dc-result-title:hover { 
  color: var(--dc-blue); 
}

.dc-result-desc {
  color: var(--dc-muted);
  font-size: 0.9rem;
  line-height: 1.7;
  margin-top: 6px;
}

.dc-result-url {
  direction: ltr;
  text-align: right;
  color: var(--dc-blue);
  font-size: 0.78rem;
  margin-top: 4px;
}

.dc-empty {
  border: 1px dashed var(--dc-line-strong);
  border-radius: var(--dc-radius);
  padding: 40px 20px;
  text-align: center;
  color: var(--dc-muted);
  background: var(--dc-card);
}

/* ── Footer ── */
footer, .dc-footer {
  background: var(--dc-bg);
  border-top: 1px solid var(--dc-line);
}

/* ── Form Inputs ── */
.dc-form-input {
  width: 100%;
  background: var(--dc-card);
  color: var(--dc-text);
  border: 1px solid var(--dc-line);
  border-radius: 8px;
  padding: 12px 16px;
  outline: none;
  font-family: var(--dc-font);
  font-size: 0.95rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dc-form-input:focus {
  border-color: var(--dc-blue);
  box-shadow: 0 0 0 3px var(--dc-blue-ring);
}

/* ── Doc-specific ── */
.doc-glass-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
}

.doc-lang-subnav {
  background: var(--dc-card);
  border-bottom: 1px solid var(--dc-line);
  position: sticky;
  top: 56px;
  z-index: 40;
}

.doc-mobile-menu {
  background: var(--dc-bg);
}

.doc-auth-menu {
  background: var(--dc-card);
  border: 1px solid var(--dc-line);
  border-radius: var(--dc-radius);
}

/* ── Code Boxes ── */
.code-box {
  border-radius: 8px;
  overflow: hidden;
  margin: 1.25rem 0;
  border: 1px solid var(--dc-line);
  background: var(--dc-bg-2);
}

.code-header {
  background: var(--dc-soft);
  color: var(--dc-muted);
  border-bottom: 1px solid var(--dc-line);
  padding: 10px 16px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.code-action-btn {
  background: var(--dc-bg);
  border: 1px solid var(--dc-line);
  color: var(--dc-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.code-action-btn:hover { 
  border-color: var(--dc-blue); 
  color: var(--dc-blue); 
}

.code-action-btn.copied { 
  background: #10b981; 
  color: white; 
  border-color: #10b981; 
}

/* ── Prism Override ── */
pre[class*="language-"] {
  background: var(--dc-bg-2) !important;
  border-radius: 0 !important;
  font-size: 0.85rem;
  margin: 0 !important;
  padding: 0 !important;
}

code[class*="language-"] {
  padding: 16px 20px;
  display: block;
  color: var(--dc-text);
}

.dark .token.punctuation { color: #a1a1aa !important; }
.dark .token.tag, .dark .token.selector { color: #f87171 !important; }
.dark .token.attr-name { color: #fb923c !important; }
.dark .token.attr-value, .dark .token.string { color: #818cf8 !important; }
.dark .token.comment { color: #71717a !important; }
.dark .token.keyword { color: #f472b6 !important; }
.dark .token.function { color: #60a5fa !important; }
.dark .token.number { color: #4ade80 !important; }

/* Light mode tokens */
:root .token.punctuation { color: #6b7280 !important; }
:root .token.tag, :root .token.selector { color: #dc2626 !important; }
:root .token.attr-name { color: #d97706 !important; }
:root .token.attr-value, :root .token.string { color: #7c3aed !important; }
:root .token.comment { color: #9ca3af !important; }
:root .token.keyword { color: #db2777 !important; }
:root .token.function { color: #2563eb !important; }
:root .token.number { color: #16a34a !important; }

/* ── Lesson Cards ── */
.lesson-card {
  background: var(--dc-card);
  border: 1px solid var(--dc-line);
  border-radius: var(--dc-radius);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.lesson-card:hover {
  border-color: var(--dc-line-strong);
}

.lesson-number {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  background: var(--dc-blue);
  flex-shrink: 0;
}

.start-btn, .next-btn {
  background: var(--dc-blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  padding: 10px 20px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.start-btn:hover, .next-btn:hover {
  background: var(--dc-blue-hover);
}

/* ── Exercise Boxes ── */
.exercise-box {
  background: var(--dc-blue-soft);
  border: 1px solid var(--dc-blue);
  border-radius: var(--dc-radius);
  padding: 20px;
  margin: 24px 0;
}

.answer-box {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--dc-radius);
  padding: 20px;
  margin-top: 12px;
  display: none;
}

.show-answer-btn {
  background: var(--dc-blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.show-answer-btn:hover {
  background: var(--dc-blue-hover);
}

/* ── Text Colors Override ── */
h1, h2, h3, h4, h5, h6 { 
  color: var(--dc-text); 
}

p, li { 
  color: var(--dc-muted); 
}

.text-primary { color: var(--dc-blue) !important; }
a.text-primary:hover { color: var(--dc-blue-hover) !important; }

/* ── Background Overrides ── */
.bg-card { background: var(--dc-card) !important; }
.bg-background { background: var(--dc-bg) !important; }
.bg-muted { background: var(--dc-soft) !important; }

/* ── Border Overrides ── */
.border-border { border-color: var(--dc-line) !important; }

/* ── Input Overrides ── */
input, textarea, select {
  background: var(--dc-card);
  color: var(--dc-text);
  caret-color: var(--dc-blue);
  border-color: var(--dc-line);
}

input::placeholder, textarea::placeholder { 
  color: var(--dc-muted);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--dc-blue);
  outline: none;
}

/* ── Image Card ── */
.image-card {
  background: var(--dc-card);
  border: 1px solid var(--dc-line);
  border-radius: var(--dc-radius);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.image-card:hover { 
  border-color: var(--dc-line-strong); 
}

/* ── Scrollbar ── */
::-webkit-scrollbar { 
  width: 6px; 
  height: 6px; 
}

::-webkit-scrollbar-track { 
  background: var(--dc-bg); 
}

::-webkit-scrollbar-thumb { 
  background: var(--dc-line-strong); 
  border-radius: 3px; 
}

::-webkit-scrollbar-thumb:hover { 
  background: var(--dc-muted); 
}

/* ── Utility: icon tap fix ── */
button i, button svg, button svg *,
a i, a svg, a svg * {
  pointer-events: none;
}

/* ── Feature Grid ── */
.feature-card {
  background: var(--dc-card);
  border: 1px solid var(--dc-line);
  border-radius: var(--dc-radius);
  padding: 24px;
  transition: border-color 0.15s ease;
}

.feature-card:hover {
  border-color: var(--dc-line-strong);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .dc-shell { 
    padding-inline: 16px; 
  }
  
  .dc-hero { 
    padding: 60px 0 40px; 
  }
  
  .dc-title { 
    letter-spacing: -0.03em; 
  }
  
  .dc-card { 
    border-radius: 10px; 
  }
}

@media (max-width: 480px) {
  body { 
    font-size: 14px; 
  }
  
  .dc-shell { 
    padding-inline: 12px; 
  }
}
