/* Posify User Documentation - inspired by modern API doc layouts */

:root {
  --sidebar-width: 280px;
  --header-height: 56px;
  --bg-sidebar: #111827;
  --bg-sidebar-hover: #1f2937;
  --bg-body: #ffffff;
  --bg-muted: #f9fafb;
  --bg-code: #f3f4f6;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --text-sidebar: #d1d5db;
  --text-sidebar-muted: #9ca3af;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg-body);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Layout */
.docs-shell {
  display: flex;
  min-height: 100vh;
}

.docs-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.docs-sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.docs-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.docs-logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: block;
  object-fit: cover;
  flex-shrink: 0;
}

.docs-logo-sub {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-sidebar-muted);
  margin-top: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.docs-search-wrap {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.docs-search {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 0.875rem;
  outline: none;
}

.docs-search::placeholder {
  color: var(--text-sidebar-muted);
}

.docs-search-wrap {
  position: relative;
}

.docs-search-icon {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-sidebar-muted);
  pointer-events: none;
  font-size: 14px;
}

.docs-nav {
  flex: 1;
  padding: 12px 0 24px;
  overflow-y: auto;
}

.nav-section-title {
  padding: 14px 20px 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-sidebar-muted);
}

.nav-link {
  display: block;
  padding: 7px 20px 7px 20px;
  color: var(--text-sidebar);
  font-size: 0.875rem;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: var(--bg-sidebar-hover);
  color: #fff;
  text-decoration: none;
}

.nav-link.active {
  background: rgba(37, 99, 235, 0.15);
  color: #fff;
  border-left-color: var(--accent);
}

.nav-link.hidden {
  display: none;
}

.nav-sub .nav-link {
  padding-left: 32px;
  font-size: 0.8125rem;
  color: var(--text-sidebar-muted);
}

/* Main content */
.docs-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
}

.docs-topbar {
  position: sticky;
  top: 0;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 32px;
  z-index: 50;
  gap: 16px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--text);
  padding: 4px 8px;
}

.topbar-breadcrumb {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.topbar-breadcrumb strong {
  color: var(--text);
}

.docs-content {
  max-width: 860px;
  padding: 40px 32px 80px;
}

/* Typography */
.docs-content h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin: 0 0 12px;
}

.docs-content h2 {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 48px 0 16px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.docs-content h2:first-of-type {
  border-top: none;
  margin-top: 0;
}

.docs-content h3 {
  font-size: 1.1rem;
  font-weight: 650;
  margin: 28px 0 10px;
  color: var(--text);
}

.docs-content h4 {
  font-size: 0.95rem;
  font-weight: 650;
  margin: 20px 0 8px;
}

.lead {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.7;
}

.docs-content p {
  margin: 0 0 14px;
}

.docs-content ul,
.docs-content ol {
  margin: 0 0 16px;
  padding-left: 1.4rem;
}

.docs-content li {
  margin-bottom: 6px;
}

.docs-content li ul {
  margin-top: 6px;
}

/* Cards & callouts */
.callout {
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 20px 0;
  border-left: 4px solid;
  font-size: 0.925rem;
}

.callout-info {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #1e40af;
}

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

.callout-success {
  background: #d1fae5;
  border-color: var(--success);
  color: #065f46;
}

.callout-danger {
  background: #fee2e2;
  border-color: var(--danger);
  color: #991b1b;
}

.callout-title {
  font-weight: 700;
  margin-bottom: 4px;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 16px 0 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead {
  background: var(--bg-muted);
}

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

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

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

tbody tr:hover {
  background: #fafafa;
}

/* Code */
code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-code);
  padding: 2px 6px;
  border-radius: 4px;
  color: #be185d;
}

pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 16px 18px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.55;
  margin: 16px 0;
}

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

/* Steps */
.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 20px 0;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 20px 44px;
  margin: 0;
  border-left: 2px solid var(--border);
  margin-left: 14px;
}

.steps li:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: -15px;
  top: 0;
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Feature grid */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.feature-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--bg-muted);
  transition: box-shadow 0.15s;
}

.feature-card .feature-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  color: var(--accent);
}

.feature-card:hover {
  box-shadow: var(--shadow);
}

.feature-card h4 {
  margin: 0 0 6px;
  font-size: 0.95rem;
}

.feature-card p {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.badge-admin { background: #ede9fe; color: #5b21b6; }
.badge-manager { background: #dbeafe; color: #1d4ed8; }
.badge-user { background: #d1fae5; color: #047857; }
.badge-module { background: #fef3c7; color: #b45309; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--accent);
  color: #fff !important;
  border-radius: var(--radius);
  font-weight: 650;
  font-size: 0.925rem;
  text-decoration: none !important;
  margin: 8px 0 16px;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: #1d4ed8;
  text-decoration: none !important;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: #fff;
  color: var(--accent) !important;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-weight: 650;
  font-size: 0.925rem;
  text-decoration: none !important;
  margin: 8px 8px 16px 0;
}

.btn-outline:hover {
  background: var(--accent-soft);
  text-decoration: none !important;
}

/* Flow diagram */
.flow {
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  white-space: pre-wrap;
  margin: 16px 0;
}

/* Footer */
.docs-footer {
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* Mobile */
@media (max-width: 900px) {
  .docs-sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

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

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

  .menu-toggle {
    display: block;
  }

  .docs-content {
    padding: 24px 20px 60px;
  }

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

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

@media print {
  .docs-sidebar,
  .docs-topbar,
  .menu-toggle {
    display: none !important;
  }

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

  .docs-content {
    max-width: 100%;
  }
}
