/* ══════════════════════════════════════
   فایل CSS تکمیلی برای موارد خاص
══════════════════════════════════════ */

/* ── Print Styles ── */
@media print {
  .navbar, .footer, .sidebar, .tutorial-header .btn,
  .admin-sidebar, .admin-topbar { display: none !important; }

  body { background: white !important; color: black !important; }

  .tutorial-content-wrap {
    border: none !important;
    box-shadow: none !important;
  }
}

/* ── Code Blocks در محتوای آموزش ── */
.lesson-content {
  padding: clamp(1.25rem, 4vw, 3rem);
  font-size: 1rem;
  line-height: 2.05;
  color: var(--text);
  overflow-wrap: anywhere;
}

.lesson-content > :first-child { margin-top: 0; }
.lesson-content > :last-child { margin-bottom: 0; }

.lesson-content p { margin: 0 0 1.25rem; }

.lesson-content .lesson-lead {
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  line-height: 2.1;
  color: var(--text-muted);
  padding: 1.1rem 1.25rem;
  border-right: 4px solid var(--primary);
  background: linear-gradient(90deg, transparent, var(--primary-light));
  border-radius: var(--radius-sm);
  margin-bottom: 2rem;
}

.lesson-content .lesson-callout,
.lesson-content .lesson-warning,
.lesson-content .lesson-example,
.lesson-content .lesson-note {
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  border-right-width: 4px;
}
.lesson-content .lesson-callout { background: var(--primary-light); border-right-color: var(--primary); }
.lesson-content .lesson-example { background: #ECFDF5; border-right-color: var(--success); }
.lesson-content .lesson-warning { background: #FFF7ED; border-right-color: var(--warning); }
.lesson-content .lesson-note { background: var(--bg); border-right-color: var(--secondary); }
[data-theme="dark"] .lesson-content .lesson-example { background: #052E2B; }
[data-theme="dark"] .lesson-content .lesson-warning { background: #2D1B06; }

.lesson-content .lesson-checklist { list-style:none; padding-right:0; }
.lesson-content .lesson-checklist li { position:relative; padding-right:1.8rem; margin:.4rem 0; }
.lesson-content .lesson-checklist li::before { content:'✓'; position:absolute; right:0; color:var(--success); font-weight:800; }

.lesson-content pre,
.lesson-content code {
  font-family: 'Courier New', Courier, monospace;
  direction: ltr;
  text-align: left;
}

.lesson-content pre {
  background: #1E293B;
  color: #E2E8F0;
  padding: 1.25rem;
  border-radius: 10px;
  overflow-x: auto;
  margin: 1rem 0;
  line-height: 1.7;
  font-size: 0.9rem;
}

.lesson-content :not(pre) > code,
.lesson-content kbd {
  background: #F1F5F9;
  color: #7C3AED;
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.875em;
}

.lesson-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

[data-theme="dark"] .lesson-content :not(pre) > code,
[data-theme="dark"] .lesson-content kbd {
  background: #1E293B;
  color: #A78BFA;
}

/* ── Tables در محتوای آموزش ── */
.lesson-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.lesson-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 560px;
}

.lesson-content th {
  background: var(--primary);
  color: white;
  padding: 0.75rem 1rem;
  text-align: right;
  font-weight: 700;
}

.lesson-content td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
}

.lesson-content tbody tr:nth-child(even) {
  background: var(--bg);
}

/* ── Images در محتوای آموزش ── */
.lesson-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  margin: 0.5rem 0;
}

/* ── Headings در محتوای آموزش ── */
.lesson-content h1,
.lesson-content h2,
.lesson-content h3,
.lesson-content h4 {
  margin: 1.5rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}

.lesson-content h1 { font-size: clamp(1.6rem, 3vw, 2rem); }
.lesson-content h2 { font-size: clamp(1.35rem, 2.5vw, 1.65rem); }
.lesson-content h3 { font-size: 1.2rem; border-bottom: none; }
.lesson-content h4 { font-size: 1.05rem; border-bottom: none; }

/* ── Blockquote ── */
.lesson-content blockquote {
  border-right: 4px solid var(--primary);
  background: var(--primary-light);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1rem 0;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Lists ── */
.lesson-content ul,
.lesson-content ol {
  padding-right: 1.5rem;
  margin: 0.75rem 0;
  line-height: 2;
}

/* ── Links ── */
.lesson-content a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-color: rgba(79,70,229,0.3);
}

.lesson-content a:hover {
  text-decoration-color: var(--primary);
}

/* ── Fullscreen محتوا ── */
.lesson-content figure { margin: 1.5rem 0; }
.lesson-content figcaption {
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
  margin-top: 0.5rem;
}

.lesson-content hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }
.lesson-content mark { background: #FEF3C7; color: #92400E; padding: 0.05em 0.2em; }

.lesson-content:fullscreen {
  background: var(--surface);
  padding: 2rem;
  overflow-y: auto;
  max-width: 900px;
  margin: 0 auto;
}

/* ── Highlight رنگ در جستجو ── */
.search-result-highlight mark {
  background: rgba(79,70,229,0.12);
  color: var(--primary);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-weight: 700;
}

/* ── Skeleton Loading ── */
.skeleton {
  background: linear-gradient(90deg,
    var(--border) 25%,
    var(--bg) 50%,
    var(--border) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-sm);
}

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

/* ── Back to Top ── */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--transition);
  opacity: 0;
  pointer-events: none;
  z-index: 999;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(79,70,229,0.4);
}
