/* =========================================================
   Manga Translator Z — Documentation Styles
   Matches the landing page dark purple theme.
   ========================================================= */

:root {
  /* --- Colors (synced with ../style.css) --- */
  --bg:          #0e0e1a;
  --bg-2:        #131322;
  --surface:     #1a1a2e;
  --surface-2:   #16162a;
  --border:      #2a2a4a;
  --border-2:    #353560;

  --purple:      #8b5cf6;
  --purple-hot:  #a855f7;
  --purple-deep: #6c5ce7;
  --purple-glow: rgba(139, 92, 246, 0.45);
  --grad-purple: linear-gradient(135deg, #6c5ce7, #a855f7);

  --green:       #10b981;
  --amber:       #f59e0b;
  --red:         #ef4444;

  --text:        #ffffff;
  --text-dim:    #c4c4dc;
  --text-mute:   #8484a8;

  /* --- Fonts --- */
  --ff-display: "Archivo Black", "Bebas Neue", Impact, sans-serif;
  --ff-body:    "Inter", -apple-system, "Segoe UI", Arial, sans-serif;
  --ff-mono:    "JetBrains Mono", "Cascadia Code", "Fira Code", monospace;

  /* --- Layout --- */
  --sidebar-w:  280px;
  --header-h:   64px;
  --content-max: 900px;

  /* --- Radius --- */
  --radius-sm:  8px;
  --radius:     14px;
  --radius-lg:  20px;

  /* --- Shadows --- */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.5);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: var(--purple-hot); text-decoration: none; transition: color 120ms ease; }
a:hover { color: var(--purple); }
ul, ol { margin: 0; padding: 0; }
ul { list-style: none; }
ol { list-style: decimal; padding-left: 1.5em; }

/* ---------- Page ---------- */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--ff-body);
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Layout ---------- */
.doc-layout {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  overflow: hidden;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.sidebar-title {
  font-family: var(--ff-display);
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
}

.sidebar-subtitle {
  font-size: 11px;
  color: var(--text-mute);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* --- Sidebar Nav --- */
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-group {
  margin-bottom: 8px;
}

.nav-group-label {
  display: block;
  padding: 8px 20px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
  transition: background 120ms ease, color 120ms ease;
  border-left: 3px solid transparent;
}

.nav-link:hover {
  background: rgba(139, 92, 246, 0.08);
  color: var(--text);
}

.nav-link.active {
  background: rgba(139, 92, 246, 0.15);
  color: #fff;
  border-left-color: var(--purple);
  font-weight: 600;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-link.active svg {
  opacity: 1;
}

.nav-link.external::after {
  content: "";
  width: 12px;
  height: 12px;
  margin-left: auto;
  opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cline x1='10' y1='14' x2='21' y2='3'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

/* ---------- Main Content Area ---------- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- Sticky Header --- */
.header {
  position: sticky;
  top: 0;
  height: var(--header-h);
  background: rgba(14, 14, 26, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  z-index: 50;
  flex-shrink: 0;
}

.header-search {
  position: relative;
  width: 280px;
}

.header-search input {
  width: 100%;
  padding: 8px 14px 8px 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: var(--ff-body);
  outline: none;
  transition: border-color 160ms ease;
}

.header-search input::placeholder {
  color: var(--text-mute);
}

.header-search input:focus {
  border-color: var(--purple);
}

.header-search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-mute);
  pointer-events: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  background: var(--grad-purple);
  color: #fff;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  transition: transform 120ms ease, box-shadow 180ms ease;
  box-shadow: 0 8px 20px -8px var(--purple-glow);
}

.btn-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px -8px var(--purple-glow);
  color: #fff;
}

/* --- Content --- */
.content {
  flex: 1;
  max-width: var(--content-max);
  padding: 32px 32px 64px;
  animation: fadeIn 0.3s ease;
}

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

/* --- Breadcrumb --- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-mute);
  margin-bottom: 20px;
}

.breadcrumb a {
  color: var(--text-mute);
}

.breadcrumb a:hover {
  color: var(--purple-hot);
}

.breadcrumb .sep {
  color: var(--border-2);
}

/* --- Typography --- */
.content h1 {
  font-family: var(--ff-display);
  font-size: 36px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  margin: 0 0 16px;
  color: var(--text);
}

.content .lead {
  font-size: 18px;
  line-height: 1.6;
  color: var(--text-dim);
  margin: 0 0 32px;
}

.content h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin: 40px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.content h3 {
  font-size: 19px;
  font-weight: 600;
  color: var(--text);
  margin: 28px 0 12px;
}

.content p {
  color: var(--text-dim);
  margin: 0 0 16px;
}

.content ul {
  margin: 0 0 16px;
  padding-left: 0;
}

.content ul li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 8px;
  color: var(--text-dim);
}

.content ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--purple);
}

.content ol li {
  margin-bottom: 8px;
  color: var(--text-dim);
}

.content strong {
  color: var(--text);
  font-weight: 600;
}

/* --- Info Boxes --- */
.info-box {
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  margin: 20px 0;
  font-size: 14px;
  line-height: 1.6;
  border-left: 4px solid;
}

.info-box p {
  margin: 0 0 8px;
}

.info-box p:last-child {
  margin-bottom: 0;
}

.info-box strong {
  display: block;
  margin-bottom: 4px;
}

.info-box-tip {
  background: rgba(16, 185, 129, 0.08);
  border-color: var(--green);
  color: #a7f3d0;
}

.info-box-tip strong {
  color: var(--green);
}

.info-box-warning {
  background: rgba(245, 158, 11, 0.08);
  border-color: var(--amber);
  color: #fde68a;
}

.info-box-warning strong {
  color: var(--amber);
}

.info-box-danger {
  background: rgba(239, 68, 68, 0.08);
  border-color: var(--red);
  color: #fca5a5;
}

.info-box-danger strong {
  color: var(--red);
}

/* --- Tables --- */
.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
}

.content table th,
.content table td {
  padding: 10px 14px;
  text-align: left;
  border: 1px solid var(--border);
}

.content table th {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.content table td {
  color: var(--text-dim);
}

.content table tr:hover td {
  background: rgba(139, 92, 246, 0.04);
}

/* --- Code Blocks --- */
.content pre {
  background: #0f0f1e;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  overflow-x: auto;
  font-family: var(--ff-mono);
  font-size: 13px;
  line-height: 1.6;
  color: #e2e8f0;
  margin: 16px 0;
  position: relative;
}

.content code {
  font-family: var(--ff-mono);
  font-size: 0.9em;
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--purple-hot);
}

.content pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* --- Keyboard Keys --- */
kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 24px;
  padding: 0 6px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 4px;
  font-family: var(--ff-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  box-shadow: 0 1px 0 var(--border);
}

/* --- Screenshots --- */
.screenshot {
  margin: 24px 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}

.screenshot img {
  width: 100%;
  display: block;
}

/* Popup screenshots are captured at native ~300px — don't stretch them to
   full content width; cap and center so they render close to life-size. */
.screenshot img[src*="popup-"] {
  width: auto;
  max-width: 340px;
  margin: 20px auto;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

/* Chrome UI mockups are wider than content-width often fits — cap them too */
.screenshot img[src*="chrome-"] {
  max-width: 720px;
  margin: 0 auto;
}

.screenshot .placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: 40px 20px;
  color: var(--text-mute);
  font-size: 14px;
  text-align: center;
}

.screenshot .placeholder svg {
  width: 40px;
  height: 40px;
  margin-bottom: 12px;
  opacity: 0.3;
}

.screenshot-caption {
  font-size: 13px;
  color: var(--text-mute);
  text-align: center;
  margin-top: 8px;
}

/* --- Card Grid (Hub Page) --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin: 24px 0 40px;
}

.card {
  display: block;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
  color: inherit;
}

.card:hover {
  border-color: var(--purple);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -8px rgba(139, 92, 246, 0.2);
  color: inherit;
}

.card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 20px;
}

.card h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 6px;
}

.card p {
  font-size: 13px;
  color: var(--text-mute);
  margin: 0;
  line-height: 1.5;
}

/* --- Next Steps --- */
.next-steps {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.next-steps a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--purple-hot);
}

.next-steps a:hover {
  color: var(--purple);
}

/* --- Feedback Widget --- */
.feedback-widget {
  margin-top: 48px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 16px;
}

.feedback-widget span {
  font-size: 14px;
  color: var(--text-dim);
}

.feedback-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  border: 1px solid var(--border);
  transition: background 120ms ease, color 120ms ease;
}

.feedback-btn:hover {
  background: rgba(139, 92, 246, 0.1);
  color: var(--text);
  border-color: var(--purple);
}

.feedback-btn.active {
  background: rgba(16, 185, 129, 0.1);
  color: var(--green);
  border-color: var(--green);
}

.feedback-btn svg {
  width: 16px;
  height: 16px;
}

.feedback-thanks {
  font-size: 14px;
  color: var(--green);
  display: none;
}

.feedback-thanks.visible {
  display: block;
}

/* --- Code Copy Button --- */
.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-mute);
  background: var(--surface);
  border: 1px solid var(--border);
  opacity: 0;
  transition: opacity 120ms ease;
  cursor: pointer;
}

pre:hover .code-copy-btn {
  opacity: 1;
}

.code-copy-btn:hover {
  color: var(--text);
  border-color: var(--purple);
}

/* --- FAQ Accordion --- */
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  overflow: hidden;
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
}

.faq-question:hover {
  background: var(--surface-2);
}

.faq-question .chevron {
  width: 18px;
  height: 18px;
  transition: transform 200ms ease;
  flex-shrink: 0;
  color: var(--text-mute);
}

.faq-item.open .faq-question .chevron {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 300ms ease;
}

.faq-answer-inner {
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-dim);
}

.faq-item.open .faq-answer {
  max-height: 500px;
}

/* ---------- Mobile Menu Button ---------- */
.mobile-menu-btn {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--grad-purple);
  color: #fff;
  align-items: center;
  justify-content: center;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  transition: transform 160ms ease;
}

.mobile-menu-btn:active {
  transform: scale(0.92);
}

.mobile-menu-btn svg {
  width: 24px;
  height: 24px;
}

/* --- Sidebar overlay (mobile) --- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

/* ---------- Custom Scrollbar ---------- */
/* --- Scrollbars ---
   Chromium 121+ treats ANY `scrollbar-color` / `scrollbar-width` declaration
   as an opt-in to the "standards" scrollbar and ignores ::-webkit-scrollbar
   rules entirely. So we keep the declaration on a Firefox-only @supports
   fence and rely on ::-webkit-scrollbar for Chromium. */
@supports (-moz-appearance: none) {
  .sidebar, .sidebar-nav, .content {
    scrollbar-width: thin;
    scrollbar-color: rgba(168, 85, 247, 0.55) transparent;
  }
}

/* WebKit (Chrome / Edge / Safari) */
.sidebar::-webkit-scrollbar,
.sidebar-nav::-webkit-scrollbar,
.content::-webkit-scrollbar {
  width: 8px;
  height: 8px;
  background: transparent;
}

.sidebar::-webkit-scrollbar-track,
.sidebar-nav::-webkit-scrollbar-track,
.content::-webkit-scrollbar-track {
  background: transparent;
  border: none;
}

.sidebar::-webkit-scrollbar-thumb,
.sidebar-nav::-webkit-scrollbar-thumb,
.content::-webkit-scrollbar-thumb {
  background-color: rgba(168, 85, 247, 0.55);
  border-radius: 999px;
  min-height: 40px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.sidebar-nav::-webkit-scrollbar-thumb:hover,
.content::-webkit-scrollbar-thumb:hover {
  background-color: rgba(168, 85, 247, 0.85);
}

.sidebar::-webkit-scrollbar-corner,
.sidebar-nav::-webkit-scrollbar-corner,
.content::-webkit-scrollbar-corner {
  background: transparent;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 250ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .main-content {
    margin-left: 0;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .header-search {
    width: 200px;
  }
}

@media (max-width: 768px) {
  .content {
    padding: 20px 16px 48px;
  }

  .content h1 {
    font-size: 28px;
  }

  .header-search {
    display: none;
  }

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

  .next-steps {
    flex-direction: column;
    gap: 12px;
  }
}
