/* ==========================================================================
   SaveXTube Tutorials / Documentation Styles (tutorial.css)
   Inspired by VidBee doc system, aligned with SaveXTube branding
   ========================================================================== */

:root {
  --doc-bg: #f8fafc;
  --doc-card-bg: #ffffff;
  --doc-text: #1e293b;
  --doc-text-dark: #0f172a;
  --doc-muted: #64748b;
  --doc-border: #e2e8f0;
  --doc-border-hover: #cbd5e1;
  --doc-primary: #1768d5;
  --doc-primary-hover: #0f55b4;
  --doc-primary-soft: #eff6ff;
  --doc-green: #059669;
  --doc-green-soft: #ecfdf5;
  --doc-sidebar-w: 260px;
  --doc-toc-w: 240px;
  --doc-radius: 12px;
  --doc-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
}

body.doc-body {
  background-color: var(--doc-bg);
  color: var(--doc-text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Segoe UI", Roboto, sans-serif;
  line-height: 1.65;
  margin: 0;
  min-height: 100vh;
}

/* Header customization for Doc/Tutorials page */
.site-header.doc-header {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--doc-border);
  z-index: 50;
  height: 70px;
}

.doc-header .nav {
  height: 70px;
}

.nav-links a.active-link {
  color: var(--doc-primary);
  font-weight: 700;
}

/* Main 3-Column Layout Container */
.doc-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: var(--doc-sidebar-w) minmax(0, 1fr) var(--doc-toc-w);
  gap: 36px;
  position: relative;
  align-items: start;
}

/* ==========================================================================
   Left Sidebar: Navigation & Search
   ========================================================================== */
.doc-sidebar {
  position: sticky;
  top: 86px;
  height: calc(100vh - 100px);
  overflow-y: auto;
  padding: 20px 0;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.doc-sidebar::-webkit-scrollbar {
  width: 4px;
}
.doc-sidebar::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 4px;
}

.doc-search-box {
  position: relative;
  margin-bottom: 24px;
}

.doc-search-input {
  width: 100%;
  padding: 10px 34px 10px 14px;
  font-size: 13px;
  border: 1px solid var(--doc-border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--doc-text);
  outline: none;
  transition: all 0.2s ease;
}

.doc-search-input:focus {
  border-color: var(--doc-primary);
  box-shadow: 0 0 0 3px rgba(23, 104, 213, 0.12);
}

.doc-search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}

.doc-nav-group {
  margin-bottom: 24px;
}

.doc-nav-heading {
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  margin: 0 0 10px 10px;
}

.doc-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.doc-nav-item a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  color: #475569;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.15s ease;
}

.doc-nav-item a:hover {
  background: #f1f5f9;
  color: var(--doc-text-dark);
}

.doc-nav-item.active a {
  background: var(--doc-primary-soft);
  color: var(--doc-primary);
  font-weight: 650;
}

.doc-nav-icon {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: contain;
}

.badge-hot {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: #fee2e2;
  color: #ef4444;
}

.badge-new {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e0e7ff;
  color: #4f46e5;
}

/* ==========================================================================
   Center Content: Tutorial Main Body
   ========================================================================== */
.doc-main {
  padding: 28px 0 80px;
  max-width: 840px;
}

.doc-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--doc-muted);
  margin-bottom: 20px;
}

.doc-breadcrumb a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s;
}

.doc-breadcrumb a:hover {
  color: var(--doc-primary);
}

.doc-breadcrumb span {
  color: #cbd5e1;
}

.doc-title-section h1 {
  font-size: 34px;
  line-height: 1.25;
  letter-spacing: -0.03em;
  color: var(--doc-text-dark);
  margin: 0 0 14px;
  font-weight: 800;
}

.doc-subtitle {
  font-size: 16.5px;
  line-height: 1.6;
  color: #475569;
  margin: 0 0 20px;
}

.doc-meta-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--doc-border);
  margin-bottom: 32px;
  font-size: 12.5px;
  color: var(--doc-muted);
}

.doc-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.doc-copy-btn {
  background: none;
  border: 1px solid var(--doc-border);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--doc-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.doc-copy-btn:hover {
  background: #f1f5f9;
  color: var(--doc-text-dark);
  border-color: #cbd5e1;
}

/* Core Highlights Cards */
.core-features-section {
  margin: 32px 0 44px;
}

.core-features-section h2 {
  font-size: 20px;
  font-weight: 750;
  color: var(--doc-text-dark);
  margin: 0 0 16px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.feature-box {
  background: var(--doc-card-bg);
  border: 1px solid var(--doc-border);
  border-radius: var(--doc-radius);
  padding: 18px 20px;
  box-shadow: var(--doc-shadow);
  transition: transform 0.2s, border-color 0.2s;
}

.feature-box:hover {
  border-color: #cbd5e1;
  transform: translateY(-2px);
}

.feature-box-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.feature-box-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.icon-blue { background: #eff6ff; color: #1d4ed8; }
.icon-green { background: #ecfdf5; color: #047857; }
.icon-purple { background: #faf5ff; color: #6d28d9; }
.icon-orange { background: #fff7ed; color: #c2410c; }

.feature-box-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--doc-text-dark);
}

.feature-box p {
  margin: 0;
  font-size: 13px;
  color: var(--doc-muted);
  line-height: 1.6;
}

/* Flow Overview Banner */
.doc-flow-banner {
  margin: 32px 0 48px;
  background: #ffffff;
  border: 1px solid var(--doc-border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--doc-shadow);
}

.doc-flow-banner img {
  width: 100%;
  height: auto;
  border-radius: 10px;
}

/* Detailed Step Blocks */
.step-section {
  margin-bottom: 48px;
  scroll-margin-top: 90px;
}

.step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--doc-primary);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
}

.step-title {
  font-size: 22px;
  font-weight: 750;
  color: var(--doc-text-dark);
  margin: 0;
}

.step-content {
  background: var(--doc-card-bg);
  border: 1px solid var(--doc-border);
  border-radius: 14px;
  padding: 26px;
  box-shadow: var(--doc-shadow);
}

.step-content p {
  margin: 0 0 16px;
  font-size: 15px;
  color: #334155;
  line-height: 1.7;
}

.step-content ul, .step-content ol {
  margin: 0 0 18px 20px;
  padding: 0;
  color: #334155;
  font-size: 14.5px;
}

.step-content li {
  margin-bottom: 8px;
  line-height: 1.6;
}

/* Mockup / Visual Container inside Steps */
.step-mockup {
  margin: 20px 0 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  overflow: hidden;
}

.mockup-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.mockup-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
}

.mockup-title {
  font-size: 11.5px;
  color: #94a3b8;
  margin-left: 6px;
  font-weight: 600;
}

.mockup-input-bar {
  display: flex;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 12px;
  align-items: center;
}

.mockup-input-text {
  font-family: monospace;
  font-size: 12.5px;
  color: #1e293b;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mockup-btn {
  background: var(--doc-primary);
  color: #ffffff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* Alert Callout Boxes */
.callout {
  padding: 14px 18px;
  border-radius: 10px;
  margin: 18px 0;
  font-size: 13.5px;
  line-height: 1.6;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.callout-info {
  background: #f0f9ff;
  border-left: 4px solid #0284c7;
  color: #0369a1;
}

.callout-tip {
  background: #f0fdf4;
  border-left: 4px solid #16a34a;
  color: #15803d;
}

.callout-warning {
  background: #fffbeb;
  border-left: 4px solid #d97706;
  color: #b45309;
}

.callout svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* FAQ Accordion */
.doc-faq-section {
  margin-top: 56px;
  scroll-margin-top: 90px;
}

.doc-faq-section h2 {
  font-size: 22px;
  font-weight: 750;
  color: var(--doc-text-dark);
  margin: 0 0 20px;
}

.faq-card {
  background: var(--doc-card-bg);
  border: 1px solid var(--doc-border);
  border-radius: var(--doc-radius);
  margin-bottom: 12px;
  box-shadow: var(--doc-shadow);
  overflow: hidden;
}

.faq-card summary {
  padding: 18px 22px;
  font-size: 15px;
  font-weight: 650;
  color: var(--doc-text-dark);
  cursor: pointer;
  list-style: none;
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-card summary::-webkit-details-marker {
  display: none;
}

.faq-card summary::after {
  content: "+";
  font-size: 20px;
  color: #94a3b8;
  font-weight: 400;
}

.faq-card[open] summary::after {
  content: "−";
}

.faq-card .faq-answer {
  padding: 0 22px 20px;
  font-size: 14px;
  color: #475569;
  line-height: 1.7;
}

/* Other Tutorials Grid Section (like Reference Image 2) */
.more-tutorials-section {
  margin-top: 64px;
  padding-top: 40px;
  border-top: 1px solid var(--doc-border);
}

.more-tutorials-section h2 {
  font-size: 22px;
  font-weight: 750;
  color: var(--doc-text-dark);
  margin: 0 0 8px;
}

.more-tutorials-section p.sub {
  color: var(--doc-muted);
  font-size: 14px;
  margin: 0 0 24px;
}

.tutorials-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.tutorial-link-card {
  background: #ffffff;
  border: 1px solid var(--doc-border);
  border-radius: 12px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  box-shadow: var(--doc-shadow);
  transition: all 0.2s ease;
}

.tutorial-link-card:hover {
  border-color: var(--doc-primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(23, 104, 213, 0.1);
}

.tutorial-card-info h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--doc-text-dark);
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tutorial-card-info p {
  font-size: 13px;
  color: var(--doc-muted);
  margin: 0;
  line-height: 1.5;
}

.tutorial-card-arrow {
  color: var(--doc-primary);
  font-weight: 700;
  font-size: 18px;
  margin-left: 16px;
}

/* ==========================================================================
   Right Sidebar: On-this-page Table of Contents (TOC)
   ========================================================================== */
.doc-toc {
  position: sticky;
  top: 86px;
  padding: 20px 0;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.doc-toc-title {
  font-size: 11.5px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  margin: 0 0 14px;
}

.doc-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 1px solid var(--doc-border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.doc-toc-item a {
  display: block;
  padding: 6px 0 6px 14px;
  font-size: 13px;
  color: #64748b;
  text-decoration: none;
  border-left: 2px solid transparent;
  margin-left: -1px;
  transition: all 0.15s ease;
  line-height: 1.4;
}

.doc-toc-item a:hover {
  color: var(--doc-text-dark);
}

.doc-toc-item.active a {
  color: var(--doc-primary);
  border-left-color: var(--doc-primary);
  font-weight: 650;
}

/* Footer in doc pages */
.doc-footer {
  margin-top: 60px;
  padding: 42px 0 36px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  font-size: 13px;
}

.doc-footer .shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.doc-footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 22px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 18px;
}

.doc-footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
}

.doc-footer-brand img {
  border-radius: 8px;
}

.doc-footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  font-size: 13px;
  font-weight: 500;
}

.doc-footer-nav a {
  color: #475569;
  text-decoration: none;
  transition: color 0.15s;
}

.doc-footer-nav a:hover {
  color: var(--doc-primary);
}

.doc-footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: #94a3b8;
  flex-wrap: wrap;
  gap: 12px;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 1140px) {
  .doc-shell {
    grid-template-columns: var(--doc-sidebar-w) minmax(0, 1fr);
  }
  .doc-toc {
    display: none;
  }
}

@media (max-width: 840px) {
  .doc-shell {
    display: block;
    padding: 0 18px;
  }
  .doc-sidebar {
    position: static;
    height: auto;
    border-bottom: 1px solid var(--doc-border);
    margin-bottom: 24px;
    padding-bottom: 24px;
  }
  .features-grid {
    grid-template-columns: 1fr;
  }
  .doc-title-section h1 {
    font-size: 26px;
  }
  .doc-footer-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .doc-footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}
