/*
Theme Name:  BeanRails Docs
Theme URI:   https://docs.beanrails.com
Author:      BeanRails
Author URI:  https://beanrails.com
Description: Clean documentation theme for BeanRails Help Center
Version:     1.0.0
License:     GNU General Public License v2 or later
Text Domain: beanrails-docs
*/

/* ─── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: #1c1e21;
  background: #fff;
}

a { color: #0070f3; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Layout ───────────────────────────────────────────────── */
.site-wrapper {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.site-header {
  background: #1a1a2e;
  color: #fff;
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
  overflow: visible;
}

.site-header .site-title a {
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
}

.site-logo {
  height: 32px;
  width: auto;
  display: block;
}

.site-header nav a {
  color: #c9d1d9;
  font-size: 0.9rem;
  margin-left: 1.5rem;
}
.site-header nav a:hover { color: #fff; }
.site-header nav a[aria-current="page"] { color: #fff; font-weight: 600; }
.site-header nav a.nav-cta {
  margin-left: 1.5rem;
  background: #0070f3;
  color: #fff;
  padding: 0.3rem 0.85rem;
  border-radius: 6px;
  font-weight: 600;
}
.site-header nav a.nav-cta:hover { background: #005bd3; text-decoration: none; }

/* ─── Dropdown ─────────────────────────────────────────────── */
.site-header nav .nav-item {
  position: relative;
  display: inline-block;
  margin-left: 1.5rem;
}
.site-header nav .nav-item > a {
  margin-left: 0;
}
.nav-arrow {
  font-size: 0.6rem;
  vertical-align: middle;
  margin-left: 0.2rem;
  opacity: 0.7;
}
.nav-dropdown {
  display: none !important;
  position: absolute;
  top: 100%;
  left: 0;
  background: #1a1a2e;
  min-width: 200px;
  border-radius: 0 0 6px 6px;
  padding: 8px 0 0.4rem;
  list-style: none;
  margin: 0;
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
  z-index: 9999;
}
.nav-item:hover .nav-dropdown,
.nav-item.open .nav-dropdown,
.nav-item:focus-within .nav-dropdown { display: block !important; }
.nav-dropdown li a {
  display: block;
  padding: 0.4rem 1rem;
  color: #c9d1d9;
  font-size: 0.88rem;
  white-space: nowrap;
  margin-left: 0;
}
.nav-dropdown li a:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
  text-decoration: none;
}

/* ─── Flyout sub-menu ──────────────────────────────────────── */
.nav-dropdown li.has-flyout {
  position: relative;
}
.nav-dropdown li.has-flyout > a::after {
  content: ' ›';
  float: right;
  padding-left: 0.5rem;
  opacity: 0.6;
}
.nav-flyout {
  display: none;
  position: absolute;
  left: 100%;
  top: -8px;
  background: #1a1a2e;
  min-width: 200px;
  list-style: none;
  padding: 8px 0 0.4rem;
  margin: 0;
  box-shadow: 4px 6px 16px rgba(0,0,0,0.4);
  border-radius: 0 6px 6px 6px;
  z-index: 10000;
}
.nav-dropdown li.has-flyout:hover .nav-flyout { display: block; }
.nav-flyout li a {
  display: block;
  padding: 0.4rem 1rem;
  color: #c9d1d9;
  font-size: 0.88rem;
  white-space: nowrap;
  margin-left: 0;
}
.nav-flyout li a:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
  text-decoration: none;
}

.site-body {
  display: flex;
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding: 0 1rem;
}

/* ─── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  padding: 2rem 1rem 2rem 0;
  border-right: 1px solid #e8eaed;
  position: sticky;
  top: 60px;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
}

.sidebar .widget-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6e7681;
  margin: 1.25rem 0 0.4rem;
}

.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar ul li a {
  display: block;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  font-size: 0.9rem;
  color: #444d56;
}
.sidebar ul li a:hover,
.sidebar ul li a:focus {
  background: #f0f6ff;
  color: #0070f3;
  text-decoration: none;
}

/* sub-pages indented */
.sidebar ul ul {
  padding-left: 0.75rem;
  border-left: 2px solid #e8eaed;
  margin: 0.2rem 0 0.2rem 0.5rem;
}

/* active page link */
.sidebar ul li a.active {
  color: #0070f3;
  font-weight: 600;
  background: #f0f6ff;
}

/* single-item category header as direct link */
.sidebar .widget-title a { color: inherit; text-decoration: none; }
.sidebar .widget-title a:hover { color: #0070f3; }
.sidebar .widget-title a.active { color: #0070f3; }

/* ─── Collapsible sidebar categories ───────────────────────── */
.sidebar-cat { margin: 1.25rem 0 0; }

.nav-sub-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6e7681;
  margin: 0.75rem 0 0.25rem;
  padding: 0;
}

/* items always visible — higher specificity (0,2,0) beats .sidebar ul (0,1,1) */
.sidebar .sidebar-cat-items {
  display: block;
  list-style: none;
  padding: 0 0 0.25rem 0.75rem;
  margin: 0 0 0 0.5rem;
  border-left: 2px solid #e8eaed;
}

.sidebar .sidebar-subcat-items {
  display: block;
  list-style: none;
  padding: 0 0 0 0.75rem;
  margin: 0.1rem 0 0 0.5rem;
  border-left: 2px solid #e8eaed;
}

/* sub-category label */
.nav-sub-cat { list-style: none; margin-top: 0.5rem; }

/* ─── Main content ─────────────────────────────────────────── */
.site-content {
  flex: 1;
  padding: 2.5rem 2rem;
  min-width: 0;
}

.entry-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 1.5rem;
  color: #1c1e21;
}

.entry-content h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid #e8eaed;
}
.entry-content h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
}
.entry-content h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 1.25rem 0 0.4rem;
}

.entry-content p { margin: 0 0 1rem; }

.entry-content ul,
.entry-content ol {
  margin: 0 0 1rem 1.5rem;
  padding: 0;
}
.entry-content li { margin-bottom: 0.3rem; }

/* ─── Tables ───────────────────────────────────────────────── */
.entry-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.92rem;
}
.entry-content table th,
.entry-content table td {
  border: 1px solid #d0d7de;
  padding: 0.5rem 0.75rem;
  text-align: left;
  vertical-align: top;
}
.entry-content table th {
  background: #f6f8fa;
  font-weight: 600;
}
.entry-content table tr:nth-child(even) td {
  background: #fafbfc;
}

/* ─── Code ─────────────────────────────────────────────────── */
.entry-content pre {
  background: #1e1e2e;
  color: #cdd6f4;
  border-radius: 6px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
  margin: 1.25rem 0;
}
.entry-content code {
  background: #f0f0f0;
  color: #c0392b;
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}
.entry-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

/* ─── Admonitions ──────────────────────────────────────────── */
.docs-admonition {
  border-left: 4px solid #ccc;
  border-radius: 0 4px 4px 0;
  padding: 0.75rem 1rem;
  margin: 1.25rem 0;
  background: #f9f9f9;
}
.docs-admonition__title {
  font-weight: 700;
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.docs-admonition__body { font-size: 0.95rem; }
.docs-admonition__body p:last-child { margin-bottom: 0; }

.docs-admonition--tip    { border-color: #2e7d32; background: #f1f8f2; }
.docs-admonition--tip    .docs-admonition__title { color: #2e7d32; }

.docs-admonition--info,
.docs-admonition--note   { border-color: #0288d1; background: #e8f4fd; }
.docs-admonition--info   .docs-admonition__title,
.docs-admonition--note   .docs-admonition__title { color: #0277bd; }

.docs-admonition--warning,
.docs-admonition--caution { border-color: #e65100; background: #fff8e1; }
.docs-admonition--warning .docs-admonition__title,
.docs-admonition--caution .docs-admonition__title { color: #e65100; }

.docs-admonition--danger { border-color: #c62828; background: #fff5f5; }
.docs-admonition--danger .docs-admonition__title { color: #c62828; }

/* ─── Footer ───────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid #e8eaed;
  padding: 1.25rem 2rem;
  font-size: 0.85rem;
  color: #6e7681;
  text-align: center;
}

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .site-body { flex-direction: column; padding: 0; }
  .sidebar {
    width: 100%;
    position: static;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid #e8eaed;
    padding: 1rem;
  }
  .site-content { padding: 1.5rem 1rem; }
}
