/* Custom styles for VOTR documentation */

/* Reset and base styles */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0; /* Remove body padding, we'll handle margins in containers */
  background: #f8f9fa;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Global container for consistent width */
.global-container {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* Main layout structure */
.wrapper {
  max-width: 1400px !important;
  width: 100% !important;
  margin: 0 auto !important;
  padding: 0 32px !important; /* Default side margins */
}

.page-content {
  padding: 0 !important;
  width: 100% !important;
  background: #f8f9fa;
  flex: 1;
}

.page-content .wrapper {
  padding-top: 24px !important;
  padding-bottom: 24px !important;
  width: 100% !important;
  max-width: 1400px !important;
  margin: 0 auto !important;
  /* Left and right padding handled by base .wrapper class */
}

/* Ensure main container has proper constraints */
main.page-content {
  width: 100% !important;
  max-width: none !important;
}

/* Root variables */
:root {
  --primary-color: #5263ff;
  --secondary-color: #34c759;
  --danger-color: #ff3b30;
  --warning-color: #ff9500;
  --background-color: #ffffff;
  --sidebar-bg: #fafbfc;
  --border-color: #d1d9e0;
  --text-color: #1a1e22;
  --text-muted: #6a737d;
  --code-bg: #f6f8fa;
  --sidebar-width: 300px;
  --header-height: 64px;
}

/* Documentation layout - Default desktop behavior */
.documentation-layout {
  display: flex;
  flex-direction: row; /* Explicitly set row direction for desktop */
  min-height: calc(
    100vh - var(--header-height) - 80px
  ); /* Account for footer */
  gap: 0;
  margin: 0; /* No additional margin, wrapper handles spacing */
  width: 100%;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

/* Sidebar styles - Default desktop behavior */
.sidebar {
  width: var(--sidebar-width);
  background: white;
  border-right: 1px solid var(--border-color);
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  flex-shrink: 0;
  display: block !important; /* Ensure sidebar is visible */
}

.sidebar-content {
  padding: 32px 24px;
}

.nav-section {
  margin-bottom: 32px;
}

.nav-section:first-child {
  margin-top: 0;
}

.nav-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-color);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

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

.nav-item {
  margin-bottom: 2px;
}

.nav-link {
  display: block;
  padding: 10px 16px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.15s ease;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

.nav-link:hover {
  background-color: rgba(0, 122, 255, 0.08);
  color: var(--primary-color);
  text-decoration: none;
  transform: translateX(2px);
}

.nav-link.active {
  background-color: var(--primary-color);
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 122, 255, 0.2);
}

.nav-link.external {
  position: relative;
  padding-right: 25px;
}

.external-icon {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  fill: currentColor;
}

/* Main content area - Default desktop behavior */
.main-content {
  flex: 1;
  padding: 40px 48px;
  max-width: none;
  overflow-x: auto;
  background: var(--background-color);
  min-height: calc(100vh - var(--header-height) - 80px);
  animation: fadeIn 0.3s ease-in-out;
  line-height: 1.8; /* Increased for better readability */
}

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

/* Typography improvements */
.post-title {
  color: var(--text-color);
  font-size: 2.75rem;
  font-weight: 800;
  margin-bottom: 16px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.post-description {
  font-size: 1.25rem;
  color: var(--text-muted);
  margin-bottom: 40px;
  font-weight: 400;
  line-height: 1.7; /* Increased for better readability */
}

.post-content h1 {
  color: var(--text-color);
  font-size: 2.125rem;
  font-weight: 700;
  margin-top: 48px;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-color);
  letter-spacing: -0.01em;
}

.post-content h2 {
  color: var(--text-color);
  font-size: 1.75rem;
  font-weight: 650;
  margin-top: 40px;
  margin-bottom: 20px;
  letter-spacing: -0.01em;
}

.post-content h3 {
  color: var(--text-color);
  font-size: 1.375rem;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 16px;
}

.post-content h4 {
  color: var(--text-color);
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: 28px;
  margin-bottom: 12px;
}

/* Code blocks and inline code */
.post-content code {
  background: var(--code-bg);
  border: 1px solid #e1e8ed;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 0.875em;
  font-family: "SFMono-Regular", "Monaco", "Inconsolata", "Roboto Mono",
    Consolas, "Courier New", monospace;
  font-weight: 500;
  color: #e83e8c;
}

/* Improved spacing for content */
.post-content p {
  line-height: 1.8; /* Better line spacing for paragraphs */
  margin-bottom: 20px; /* More space between paragraphs */
}

.post-content ul,
.post-content ol {
  line-height: 1.8; /* Better line spacing for lists */
  margin-bottom: 20px;
  padding-left: 24px;
}

.post-content li {
  margin-bottom: 12px; /* Increased space between list items */
}

/* Special spacing for numbered step lists */
.post-content ol > li {
  margin-bottom: 16px; /* Extra spacing for step-by-step lists */
}

/* Better spacing for nested lists */
.post-content li > ul,
.post-content li > ol {
  margin-top: 8px;
  margin-bottom: 8px;
}

.post-content pre {
  background: var(--code-bg);
  border: 1px solid #e1e8ed;
  border-radius: 8px;
  padding: 24px;
  overflow-x: auto;
  margin: 24px 0;
  font-size: 0.875em;
  line-height: 1.7; /* Improved code line height */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

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

/* Tables */
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 28px 0;
  font-size: 0.9em;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.post-content th,
.post-content td {
  border: 1px solid var(--border-color);
  padding: 14px 18px;
  text-align: left;
  vertical-align: top;
}

.post-content th {
  background: linear-gradient(135deg, var(--code-bg) 0%, #f1f3f4 100%);
  font-weight: 600;
  color: var(--text-color);
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.post-content tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.015);
}

.post-content tr:hover {
  background: rgba(0, 122, 255, 0.03);
  transition: background-color 0.15s ease;
}

/* Page navigation */
.page-navigation {
  display: flex;
  justify-content: space-between;
  margin-top: 50px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.page-navigation a {
  padding: 12px 20px;
  background: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-color);
  font-weight: 500;
  transition: all 0.2s ease;
}

.page-navigation a:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.prev-page {
  margin-right: auto;
}

.next-page {
  margin-left: auto;
}

/* Header improvements */
.site-header {
  border-bottom: 1px solid var(--border-color);
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  width: 100%;
}

.site-header .wrapper {
  height: var(--header-height);
  display: flex;
  align-items: center;
  max-width: 1400px !important;
  width: 100% !important;
  padding: 0 32px !important; /* Match body margins */
  margin: 0 auto !important;
}

.site-title {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.header-logo {
  height: 40px;
  width: auto;
  transition: transform 0.2s ease;
}

.header-logo:hover {
  transform: scale(1.05);
}

.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
}

/* Hide mobile navigation elements on desktop */
.nav-trigger {
  display: none;
}

.menu-icon {
  display: none;
}

.site-nav .trigger {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-nav .page-link {
  color: var(--text-muted);
  font-weight: 500;
  transition: all 0.2s ease;
  padding: 10px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.95rem;
}

.site-nav .page-link:hover {
  color: var(--primary-color);
  background-color: rgba(0, 122, 255, 0.08);
  text-decoration: none;
}

/* Footer improvements */
.site-footer {
  border-top: 1px solid var(--border-color);
  background: white;
  padding: 24px 0;
  margin-top: auto;
  flex-shrink: 0;
}

.site-footer .wrapper {
  max-width: 1400px !important;
  margin: 0 auto !important;
  padding: 0 32px !important; /* Match body margins */
}

.footer-content {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9em;
}

.footer-content p {
  margin: 0;
}

.footer-bottom {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9em;
}

/* Responsive design with consistent margins */

/* Extra large screens */
@media (min-width: 1440px) {
  .wrapper,
  .site-header .wrapper,
  .site-footer .wrapper {
    padding-left: 48px !important;
    padding-right: 48px !important; /* Larger margins for very wide screens */
  }
}

/* Large screens (desktop) - Ensure proper sidebar layout */
@media (min-width: 769px) {
  .documentation-layout {
    display: flex;
    flex-direction: row;
  }

  .sidebar {
    width: var(--sidebar-width) !important;
    position: sticky !important;
    top: var(--header-height) !important;
    height: calc(100vh - var(--header-height)) !important;
    border-right: 1px solid var(--border-color) !important;
    border-bottom: none !important;
    order: 0 !important;
  }

  .main-content {
    width: calc(100% - var(--sidebar-width)) !important;
    flex: 1;
  }
}

/* Medium screens (tablets) */
@media (max-width: 1024px) and (min-width: 769px) {
  .wrapper,
  .site-header .wrapper,
  .site-footer .wrapper {
    padding-left: 24px !important;
    padding-right: 24px !important; /* Medium margins for tablets */
  }
}

/* Small screens (mobile) */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 100%;
    --header-height: 60px;
  }

  .wrapper,
  .site-header .wrapper,
  .site-footer .wrapper {
    padding-left: 16px !important;
    padding-right: 16px !important; /* Smaller but still visible margins on mobile */
  }

  /* Mobile-specific documentation layout */
  .page-content {
    padding: 12px !important;
  }

  .documentation-layout {
    flex-direction: column;
    width: 100%;
    max-width: none;
    margin: 0;
    box-shadow: none; /* Remove shadow on mobile */
  }

  .sidebar {
    width: 100% !important;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    order: -1; /* Show sidebar at top on mobile */
  }

  .sidebar-content {
    padding: 24px 20px;
  }

  .main-content {
    width: 100% !important;
    max-width: none !important;
    padding: 32px 24px;
    min-height: auto;
  }

  .post-title {
    font-size: 2.25rem;
  }

  .post-content h1 {
    font-size: 1.875rem;
  }

  .post-content h2 {
    font-size: 1.5rem;
  }

  .page-navigation {
    flex-direction: column;
    gap: 12px;
  }

  .page-navigation a {
    text-align: center;
  }

  .site-nav {
    margin-left: 0;
  }

  .site-nav .trigger {
    flex-wrap: wrap;
    gap: 4px;
  }

  /* Show mobile menu toggle on small screens */
  .nav-trigger {
    display: block;
  }

  .menu-icon {
    display: block;
  }

  .site-nav .page-link {
    padding: 8px 12px;
    font-size: 0.9rem;
  }

  .header-logo {
    height: 36px;
  }
}

/* Very small screens */
@media (max-width: 480px) {
  .wrapper,
  .site-header .wrapper,
  .site-footer .wrapper {
    padding-left: 12px !important;
    padding-right: 12px !important; /* Minimum margins for very small screens */
  }

  .sidebar-content {
    padding: 15px;
  }

  .main-content {
    padding: 15px;
  }

  .post-title {
    font-size: 1.8rem;
  }

  .post-content h1 {
    font-size: 1.6rem;
  }

  .post-content h2 {
    font-size: 1.3rem;
  }

  .post-content table {
    font-size: 0.85em;
  }

  .post-content th,
  .post-content td {
    padding: 8px 10px;
  }
}

/* Alert boxes and callouts */
.post-content h2:has(+ p:contains("⚠️")),
.post-content h2[id*="important"] {
  color: var(--warning-color);
}

.post-content p:contains("⚠️"),
.post-content p:contains("IMPORTANT") {
  background: linear-gradient(135deg, #fff3cd 0%, #fef8e7 100%);
  border: 1px solid #ffeaa7;
  border-left: 4px solid var(--warning-color);
  padding: 16px 20px;
  border-radius: 8px;
  margin: 24px 0;
  font-weight: 500;
}

.post-content p:contains("❌") {
  background: linear-gradient(135deg, #ffe6e6 0%, #fff0f0 100%);
  border: 1px solid #ffb3b3;
  border-left: 4px solid var(--danger-color);
  padding: 16px 20px;
  border-radius: 8px;
  margin: 16px 0;
}

.post-content p:contains("✅") {
  background: linear-gradient(135deg, #e6f7e6 0%, #f0fdf0 100%);
  border: 1px solid #b3e6b3;
  border-left: 4px solid var(--secondary-color);
  padding: 16px 20px;
  border-radius: 8px;
  margin: 16px 0;
}

/* Emoji styling */
.post-content h2:contains("⚠️"),
.post-content h3:contains("❌"),
.post-content h4:contains("✅") {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Print styles */
@media print {
  .sidebar,
  .site-header,
  .site-footer,
  .page-navigation {
    display: none;
  }

  .documentation-layout {
    display: block;
  }

  .main-content {
    max-width: 100%;
    padding: 0;
  }
}
