/* =====================================================================
   Phố SEO AI - Product documentation
   Style synchronization across all guide pages
   ===================================================================== */

:root {
  --top-nav-height: 64px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  
  /* Neutral surfaces; blue is reserved for inline links. */
  --bg-app: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-toc: #ffffff;
  
  --primary: #1f2328;
  --primary-hover: #000000;
  --primary-light: #f6f8fa;
  --primary-border: #d1d9e0;
  --link: #0969da;
  
  --pro-green: #059669;
  --pro-green-bg: #ecfdf5;
  --pro-green-border: #a7f3d0;
  
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --amber-border: #fde68a;
  
  --purple: #7c3aed;
  --purple-bg: #f5f3ff;
  --purple-border: #ddd6fe;

  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  
  --text-main: #1f2328;
  --text-secondary: #3d444d;
  --text-muted: #656d76;
  --text-subtle: #818b98;
  
  --border-subtle: #e5e7eb;
  --border-strong: #d1d9e0;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  
  --radius-sm: 6px;
  --radius-md: 6px;
  --radius-lg: 6px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-main);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ================= Top Navigation Bar ================= */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--top-nav-height);
  background: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo {
  height: 38px;
  width: 38px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-logo-icon {
  width: 36px;
  height: 36px;
  background: #1f2328;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 1.15rem;
  box-shadow: none;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.brand-tag {
  font-size: 0.85rem;
  font-weight: 500;
  padding-left: 12px;
  color: var(--text-muted);
  border-left: 1px solid var(--border-strong);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-actions .btn-mock {
  text-decoration: none;
  padding: 6px 12px;
  font-size: 0.82rem;
  white-space: nowrap;
}

.search-input-wrapper {
  position: relative;
  width: 280px;
}

.search-input-wrapper input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: #f6f8fa;
  font-size: 0.85rem;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s;
}

.search-input-wrapper input:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(31, 35, 40, 0.12);
}

.search-input-wrapper svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  color: var(--text-secondary);
}

/* ================= Documentation Layout Grid ================= */
.docs-container {
  display: flex;
  flex: 1;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* ================= Left Sidebar (Navigation) ================= */
.docs-sidebar {
  width: 290px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  flex-shrink: 0;
  position: sticky;
  top: var(--top-nav-height);
  height: calc(100vh - var(--top-nav-height));
  overflow-y: auto;
  padding: 1.5rem 1rem 3rem 1rem;
}

.docs-sidebar::-webkit-scrollbar {
  width: 5px;
}
.docs-sidebar::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.nav-group {
  margin-bottom: 1.5rem;
}

.nav-group-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0;
  padding: 0 0.6rem;
  margin-bottom: 0.5rem;
}

.nav-item-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 0.86rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
  margin-bottom: 2px;
}

.nav-item-link:hover {
  background: #f6f8fa;
  color: var(--text-main);
}

.nav-item-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  border-left: 2px solid var(--primary);
}

.badge-pro {
  font-size: 0.62rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--pro-green-bg);
  color: var(--pro-green);
  border: 1px solid var(--pro-green-border);
  letter-spacing: 0.03em;
}

.badge-free {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: #f1f5f9;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

/* ================= Center Content Area ================= */
.docs-content {
  flex: 1;
  min-width: 0;
  padding: 2.5rem 3rem;
  max-width: 900px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}
.breadcrumb a:hover {
  color: var(--primary);
}

.article-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.article-header h1 {
  font-size: 2.2rem;
  font-weight: 650;
  letter-spacing: -0.025em;
  color: var(--text-main);
  margin-bottom: 0.75rem;
  line-height: 1.25;
}

.article-meta-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.lead-paragraph {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-top: 1rem;
}

/* ================= Typography & Content Components ================= */
.docs-content h2 {
  font-size: 1.45rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin: 2.5rem 0 1rem 0;
  padding-top: 1rem;
  scroll-margin-top: calc(var(--top-nav-height) + 16px);
  display: flex;
  align-items: center;
  gap: 10px;
}

.docs-content h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 1.75rem 0 0.75rem 0;
  scroll-margin-top: calc(var(--top-nav-height) + 16px);
}

.docs-content p {
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.docs-content ul, .docs-content ol {
  margin: 0 0 1.5rem 1.5rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.docs-content li {
  margin-bottom: 0.5rem;
}

.docs-content b, .docs-content strong {
  color: var(--text-main);
}

.docs-content a {
  color: var(--link);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

/* ================= Callout Cards ================= */
.callout {
  border-radius: var(--radius-md);
  padding: 1.15rem 1.35rem;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  display: flex;
  gap: 14px;
}

.callout-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  line-height: 1.4;
}

.callout-body {
  flex: 1;
}

.callout-body strong {
  display: block;
  font-weight: 700;
  margin-bottom: 4px;
}

.callout-pro {
  background: var(--pro-green-bg);
  border: 1px solid var(--pro-green-border);
  color: #065f46;
}
.callout-pro strong { color: #047857; }

.callout-tip {
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  color: #1e40af;
}
.callout-tip strong { color: #1d4ed8; }

.callout-warning {
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  color: #92400e;
}
.callout-warning strong { color: #b45309; }

.callout-info {
  background: #f8fafc;
  border: 1px solid var(--border-strong);
  color: #334155;
}

/* ================= Step-by-Step UI Cards ================= */
.step-card {
  background: transparent;
  border: 0;
  border-left: 2px solid var(--border-strong);
  border-radius: 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  margin: 1.5rem 0;
  box-shadow: none;
  position: relative;
}

.step-card:hover {
  border-color: var(--border-strong);
  box-shadow: none;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.step-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

/* Mock UI Tags & Badges */
.ui-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #0f172a;
  font-weight: 600;
}

.btn-mock {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 6px;
  background: #1f2328;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
}

/* Data Tables */
.docs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.88rem;
  background: #fff;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-subtle);
}

.docs-table th {
  background: #f8fafc;
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  color: #334155;
  border-bottom: 1px solid var(--border-subtle);
}

.docs-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: #475569;
}

.docs-table tr:last-child td {
  border-bottom: none;
}

.docs-table tr:hover td {
  background: #f8fafc;
}

/* Code & Pre Blocks */
.code-block {
  background: #f6f8fa;
  color: #1f2328;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin: 1.25rem 0;
  overflow-x: auto;
  position: relative;
  line-height: 1.6;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 6px;
}

/* ================= Right Sidebar (Table of Contents) ================= */
.docs-toc {
  width: 250px;
  flex-shrink: 0;
  position: sticky;
  top: var(--top-nav-height);
  height: calc(100vh - var(--top-nav-height));
  overflow-y: auto;
  padding: 2.5rem 1rem 3rem 1rem;
}

.toc-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.toc-list {
  list-style: none;
}

.toc-item {
  margin-bottom: 6px;
}

.toc-link {
  display: block;
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-decoration: none;
  line-height: 1.4;
  padding: 4px 0;
  transition: color 0.15s;
}

.toc-link:hover {
  color: var(--primary);
}

.toc-link.active {
  color: var(--primary);
  font-weight: 700;
}

/* Footer Pagination */
.doc-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 3.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border-subtle);
  gap: 16px;
}

.page-nav-card {
  display: flex;
  flex-direction: column;
  padding: 12px 18px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-decoration: none;
  background: #fff;
  transition: all 0.2s;
  min-width: 180px;
}

.page-nav-card:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.page-nav-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.page-nav-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 4px;
}

/* Mobile Responsiveness */
@media (max-width: 1100px) {
  .docs-toc {
    display: none;
  }
}

@media (max-width: 860px) {
  .docs-sidebar {
    position: fixed;
    top: var(--top-nav-height);
    left: -290px;
    z-index: 99;
    box-shadow: var(--shadow-lg);
    transition: left 0.25s ease-in-out;
  }
  .docs-sidebar.open {
    left: 0;
  }
  .mobile-menu-btn {
    display: block;
  }
  .docs-content {
    padding: 1.5rem 1rem;
  }
  .search-input-wrapper {
    display: none;
  }
}

/* Reference tables and worked examples */
.example-box {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  margin: 1.75rem 0;
  overflow-x: auto;
  box-shadow: none;
}

.example-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-main);
  background: #f6f8fa;
  padding: 12px 18px;
  margin: 0;
  border-bottom: 1px solid var(--border-strong);
  letter-spacing: -0.01em;
}

.example-title span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.example-box > p,
.example-box > ul,
.example-box > ol,
.example-box > div:not(.example-title) {
  padding: 12px 18px;
}

.example-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  background: #ffffff;
  margin: 0;
  border: none;
}

.example-table th, .example-table td {
  padding: 11px 16px;
  border: 0;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}

.example-table th {
  background: #f6f8fa;
  color: var(--text-main);
  font-weight: 600;
  white-space: normal;
  border-bottom: 1px solid var(--border-strong);
}

.example-table td {
  color: var(--text-secondary);
  background: #ffffff;
}

.example-table tr:hover td {
  background: #fafbfc;
}

.example-table tbody tr:last-child td {
  border-bottom: 0;
}

.example-table th, .example-table td {
  vertical-align: top;
  overflow-wrap: anywhere;
}

.example-box[tabindex]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

/* Worked examples have a distinct visual hierarchy from reference tables. */
.worked-example {
  border: 1px solid var(--border-strong);
  background: #ffffff;
  box-shadow: none;
}

.worked-example .example-title {
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  background: #f6f8fa;
  border-bottom: 1px solid var(--border-strong);
  padding: 13px 18px;
}

.worked-example .example-kicker {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 500;
}

.worked-example .example-heading {
  color: var(--text-main);
  font-size: 0.94rem;
  line-height: 1.5;
}

.worked-example .example-table th {
  background: #ffffff;
  color: var(--text-main);
  border-bottom-color: var(--border-strong);
}

.worked-example .example-content {
  background: #ffffff;
  padding: 18px;
}

.worked-example .example-content > :last-child {
  margin-bottom: 0;
}

.worked-example .code-block {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 3rem 1rem 1rem;
  font-size: 0.82rem;
}

.internal-link-shortcut {
  background: #f6f8fa;
  border: 1px solid var(--border-subtle);
  border-left: 3px solid #8c959f;
  border-radius: 4px;
  padding: 16px 18px;
  margin-top: 24px;
}

.internal-link-shortcut > strong {
  display: block;
  color: var(--text-main);
  font-size: 1rem;
}

.internal-link-shortcut p {
  margin: 6px 0 10px;
}

.internal-link-shortcut a {
  color: var(--link);
  font-weight: 500;
  text-underline-offset: 3px;
}

.copy-snippet-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #ffffff;
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
  padding: 4px 9px;
  border-radius: 5px;
  font: 500 0.72rem var(--font-sans);
  cursor: pointer;
}

.copy-snippet-btn:hover {
  color: var(--text-main);
  border-color: #8c959f;
}

.copy-snippet-btn:focus-visible {
  outline: 2px solid var(--text-main);
  outline-offset: 2px;
}

.step-card > ol:last-child {
  margin-bottom: 0;
}

.breadcrumb {
  flex-wrap: wrap;
}

.docs-content code {
  overflow-wrap: anywhere;
}

@media (max-width: 600px) {
  :root {
    --top-nav-height: 104px;
  }

  .top-nav {
    padding: 8px 12px;
    gap: 8px;
    flex-wrap: wrap;
    align-content: center;
  }

  .nav-brand {
    width: 100%;
  }

  .nav-actions {
    width: 100%;
    gap: 8px;
  }

  .nav-actions .btn-mock {
    flex: 1;
    justify-content: center;
    text-align: center;
  }

  .nav-brand {
    gap: 10px;
  }

  .brand-wrapper {
    gap: 8px;
  }

  .brand-logo {
    width: 32px;
    height: 32px;
  }

  .brand-title {
    font-size: 1rem;
  }

  .brand-tag {
    display: none;
  }

  .doc-pagination {
    flex-direction: column;
    align-items: stretch;
  }

  .page-nav-card {
    min-width: 0;
  }

  .example-table {
    min-width: 520px;
  }
}

@media (max-width: 380px) {
  .brand-logo {
    width: 28px;
    height: 28px;
  }

  .brand-title {
    font-size: 0.9rem;
  }

  .nav-actions .btn-mock {
    padding: 6px 8px;
    font-size: 0.75rem;
  }
}



/* Secondary navigation back to the main website. */
.nav-actions .btn-home {
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-strong);
}
.nav-actions .btn-home:hover {
  background: #f6f8fa;
  border-color: #8c959f;
  color: var(--text-main);
}
.nav-actions .btn-home:focus-visible {
  outline: 2px solid var(--text-main);
  outline-offset: 3px;
}
