/* Power of One News Admin — Doc Styles */

:root {
  --bg: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-code: #1e293b;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --accent: #667eea;
  --accent-hover: #5a67d8;
  --accent-light: #eef2ff;
  --success: #48bb78;
  --warning: #ed8936;
  --danger: #f56565;
  --sidebar-width: 280px;
  --header-height: 64px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.1);
  --radius: 10px;
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg-secondary: #1e293b;
  --bg-code: #0f172a;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #334155;
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-light: #1e1b4b;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.4);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 15px;
}

.doc-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 200;
  gap: 16px;
  box-shadow: var(--shadow);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
}

.menu-toggle:hover {
  background: var(--accent-light);
}

.doc-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}

.doc-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), #9f7aea);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.doc-logo-text {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
}

.doc-logo-sub {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 400;
}

.search-box {
  flex: 1;
  max-width: 400px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 8px 14px 8px 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition);
}

.search-box input:focus {
  border-color: var(--accent);
}

.search-box::before {
  content: '🔍';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  pointer-events: none;
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  max-height: 320px;
  overflow-y: auto;
  display: none;
  z-index: 300;
}

.search-results.show {
  display: block;
}

.search-result-item {
  display: block;
  padding: 10px 14px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

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

.search-result-item:hover {
  background: var(--accent-light);
}

.search-result-item mark {
  background: #fef08a;
  color: #1e293b;
  border-radius: 2px;
  padding: 0 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.btn-icon {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 16px;
  color: var(--text);
  transition: background var(--transition);
}

.btn-icon:hover {
  background: var(--accent-light);
}

.version-badge {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 20px;
}

.doc-layout {
  display: flex;
  padding-top: var(--header-height);
  min-height: 100vh;
}

.doc-sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 8px 20px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: all var(--transition);
}

.nav-link:hover {
  color: var(--accent);
  background: var(--accent-light);
}

.nav-link.active {
  color: var(--accent);
  background: var(--accent-light);
  border-left-color: var(--accent);
  font-weight: 600;
}

.nav-link .nav-icon {
  font-size: 15px;
  width: 20px;
  text-align: center;
}

.doc-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 40px 48px 80px;
  max-width: 900px;
}

.doc-hero {
  background: linear-gradient(135deg, var(--accent) 0%, #9f7aea 100%);
  border-radius: var(--radius);
  padding: 40px;
  color: #fff;
  margin-bottom: 40px;
}

.doc-hero h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 12px;
}

.doc-hero p {
  font-size: 16px;
  opacity: 0.9;
  max-width: 600px;
  margin-bottom: 24px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-tag {
  background: rgba(255, 255, 255, 0.2);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 13px;
  backdrop-filter: blur(4px);
}

.doc-section {
  margin-bottom: 48px;
  scroll-margin-top: calc(var(--header-height) + 24px);
}

.doc-section.hidden-by-search {
  display: none;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.section-icon {
  font-size: 24px;
}

.section-header h2 {
  font-size: 22px;
  font-weight: 700;
}

.section-header h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 24px 0 12px;
  color: var(--text);
}

.doc-section p {
  margin-bottom: 14px;
  color: var(--text-secondary);
}

.doc-section p strong,
.doc-section li strong {
  color: var(--text);
}

.doc-section ul,
.doc-section ol {
  margin: 12px 0 16px 24px;
  color: var(--text-secondary);
}

.doc-section li {
  margin-bottom: 6px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin: 16px 0;
}

.info-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: box-shadow var(--transition), transform var(--transition);
}

.info-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.info-card-icon {
  font-size: 28px;
  margin-bottom: 10px;
}

.info-card h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.info-card p {
  font-size: 13px;
  margin: 0;
}

.table-wrap {
  overflow-x: auto;
  margin: 16px 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead {
  background: var(--accent-light);
}

th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: top;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--accent-light);
}

td strong {
  color: var(--text);
}

.code-block {
  position: relative;
  margin: 16px 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #334155;
  padding: 8px 14px;
  font-size: 12px;
  color: #94a3b8;
}

.copy-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #e2e8f0;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background var(--transition);
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.copy-btn.copied {
  background: var(--success);
  color: #fff;
}

pre {
  background: var(--bg-code);
  color: #e2e8f0;
  padding: 18px 20px;
  overflow-x: auto;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.6;
  margin: 0;
}

code {
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 13px;
}

:not(pre) > code {
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
}

.arch-diagram {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 16px 0;
  overflow-x: auto;
}

.arch-diagram pre {
  background: transparent;
  color: var(--text);
  padding: 0;
  font-size: 12px;
}

.flow-steps {
  counter-reset: step;
  list-style: none;
  margin: 16px 0;
  padding: 0;
}

.flow-steps li {
  counter-increment: step;
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
  align-items: flex-start;
}

.flow-steps li::before {
  content: counter(step);
  background: var(--accent);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin: 16px 0;
  font-size: 14px;
  border-left: 4px solid;
}

.alert-info {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--text);
}

.alert-warning {
  background: #fffbeb;
  border-color: var(--warning);
  color: #92400e;
}

[data-theme="dark"] .alert-warning {
  background: #451a03;
  color: #fcd34d;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.tag {
  background: var(--accent-light);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 44px;
  height: 44px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
  z-index: 150;
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

.doc-footer {
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 90;
}

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

@media (max-width: 900px) {
  .menu-toggle {
    display: block;
  }

  .doc-sidebar {
    transform: translateX(-100%);
  }

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

  .doc-main {
    margin-left: 0;
    padding: 24px 20px 60px;
  }

  .search-box {
    max-width: none;
  }

  .version-badge {
    display: none;
  }

  .doc-hero {
    padding: 28px 24px;
  }

  .doc-hero h1 {
    font-size: 22px;
  }
}

@media (max-width: 480px) {
  .doc-logo-text span {
    display: none;
  }

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

@media print {
  .doc-header,
  .doc-sidebar,
  .back-to-top,
  .copy-btn {
    display: none !important;
  }

  .doc-main {
    margin-left: 0;
    padding: 0;
    max-width: 100%;
  }

  .doc-hero {
    background: none;
    color: #000;
    border: 1px solid #ccc;
  }
}
