/* Custom styles for MER-Factory documentation */
/* Enhancing the dinky theme with modern touches */

:root {
  --primary-color: #2c3e50;
  --secondary-color: #3498db;
  --accent-color: #e74c3c;
  --success-color: #27ae60;
  --warning-color: #f39c12;
  --text-color: #2c3e50;
  --light-gray: #ecf0f1;
  --border-color: #bdc3c7;
  --code-bg: #f8f9fa;
}

/* Global Styles */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: #fafbfc;
  margin: 0 !important;
  padding: 0 !important;
  overflow-x: hidden !important;
}

/* Menu Toggle Button for Mobile */
.menu-toggle {
  display: none;
  /* Hidden on desktop */
  position: fixed;
  top: 1rem;
  left: 1rem;
  width: 44px;
  height: 44px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  z-index: 1001;
  /* Above the sidebar */
  cursor: pointer;
  font-size: 1.2rem;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: background-color 0.3s ease;
}

.menu-toggle:hover {
  background: var(--secondary-color);
}

/* Wrapper for layout */
.wrapper {
  display: flex !important;
  flex-direction: row !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  min-height: 100vh !important;
}

/* Header/Sidebar */
.wrapper header {
  position: fixed !important;
  left: 0 !important;
  top: 0 !important;
  width: 300px !important;
  height: 100vh !important;
  background: #dc143c !important;
  color: white !important;
  padding: 0 !important;
  z-index: 1000 !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  text-align: left !important;
}

/* This new rule ensures the main content area grows to push the footer down */
.header-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* Crucial for flexbox scrolling */
}

.header-content {
  padding: 2rem 1rem 1rem 1rem;
  color: white;
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  overflow-y: auto;
  /* This is where scrolling will happen */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.header-content::-webkit-scrollbar {
  width: 6px;
}

.header-content::-webkit-scrollbar-track {
  background: transparent;
}

.header-content::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.header-content::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.5);
}

.site-title a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: white !important;
  font-weight: 700;
  font-size: 1.5rem;
}

.site-title i {
  color: #f39c12;
  font-size: 1.8rem;
}

.site-description {
  margin: 1rem 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  line-height: 1.4;
}

/* Language Switcher */
.language-switcher {
  margin: 1rem 0;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.lang-button {
  padding: 0.5rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s ease;
  background-color: rgba(255, 255, 255, 0.1);
}

.lang-button:hover {
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  text-decoration: none;
}

.lang-button.active {
  background-color: rgba(255, 255, 255, 0.9);
  color: #dc143c !important;
  font-weight: 600;
  cursor: default;
}

/* Navigation */
.main-nav {
  margin: 2rem 0;
}

.nav-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-button {
  display: block !important;
  padding: 12px 16px !important;
  background: #dc3545 !important;
  color: white !important;
  text-decoration: none !important;
  border-radius: 6px !important;
  font-weight: 500 !important;
  transition: all 0.3s ease !important;
  border: 2px solid #dc3545 !important;
  text-align: left !important;
  box-sizing: border-box !important;
}

.nav-button:hover {
  background: #c82333 !important;
  border-color: #c82333 !important;
  transform: translateX(4px);
}

.nav-button:visited {
  color: white !important;
}

.nav-button i {
  margin-right: 8px;
  width: 16px;
  display: inline-block;
  text-align: center;
}

/* Action Buttons */
.action-buttons {
  margin: 2rem 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  margin: 0.25rem 0;
  width: 100%;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 600;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  text-align: center;
  justify-content: center;
}

.btn-primary {
  background: linear-gradient(135deg, #f39c12, #e67e22);
  color: white !important;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(243, 156, 18, 0.4);
}

.btn-secondary {
  background-color: rgba(255, 255, 255, 0.2);
  color: white !important;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

/* Sidebar Footer */
.sidebar-footer {
  background: rgba(0, 0, 0, 0.2) !important;
  padding: 20px !important;
  border-top: 2px solid rgba(255, 255, 255, 0.3) !important;
  margin-top: auto !important;
  flex-shrink: 0 !important;
}

.sidebar-footer h3 {
  color: white !important;
  margin: 0 0 10px 0 !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
}

.sidebar-footer h3 i {
  margin-right: 8px !important;
}

.sidebar-footer .social-links {
  display: flex !important;
  justify-content: space-around !important;
  align-items: center !important;
  gap: 10px !important;
}

.sidebar-footer .social-links a {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 40px !important;
  height: 40px !important;
  background-color: rgba(255, 255, 255, 0.15) !important;
  border-radius: 8px !important;
  transition: all 0.3s ease !important;
  color: white !important;
  font-size: 18px !important;
  text-decoration: none !important;
}

.sidebar-footer .social-links a:hover {
  background-color: rgba(255, 255, 255, 0.3) !important;
  transform: translateY(-2px) !important;
}

/* Main Content Area */
section.main-content {
  margin-left: 300px !important;
  width: calc(100% - 300px) !important;
  padding: 2rem !important;
  padding-bottom: 80px !important;
  /* Space for footer */
  background-color: white !important;
  min-height: 100vh !important;
  box-sizing: border-box !important;
}

/* Breadcrumb */
.breadcrumb {
  margin-bottom: 2rem;
  padding: 0.75rem 1rem;
  background-color: var(--light-gray);
  border-radius: 6px;
  font-size: 0.9rem;
}

.breadcrumb a {
  color: var(--secondary-color);
  text-decoration: none;
}

.separator {
  margin: 0 0.5rem;
  color: #7f8c8d;
}

.current {
  color: var(--text-color);
  font-weight: 500;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--primary-color);
  font-weight: 600;
  line-height: 1.3;
}

h1 {
  font-size: 2.25rem;
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.875rem;
  margin: 2rem 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--light-gray);
}

h3 {
  font-size: 1.5rem;
  margin: 1.5rem 0 0.75rem 0;
}

/* Code Styling */
code {
  background-color: var(--code-bg);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.85rem;
  color: var(--accent-color);
}

pre {
  background-color: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
  position: relative;
  /* For copy button positioning */
}

pre code {
  background: none;
  padding: 0;
  color: var(--text-color);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  background-color: white;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

th,
td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  background-color: var(--light-gray);
  font-weight: 600;
  color: var(--primary-color);
}

tr:hover {
  background-color: #f8f9fa;
}

/* Page Footer */
.site-footer {
  position: fixed !important;
  bottom: 0 !important;
  left: 300px !important;
  width: calc(100% - 300px) !important;
  height: 60px !important;
  z-index: 500 !important;
  background: linear-gradient(135deg, var(--primary-color), #34495e) !important;
  color: white !important;
  display: flex !important;
  align-items: center !important;
  padding: 0 2rem !important;
  box-sizing: border-box !important;
}

.footer-content {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  width: 100% !important;
}

.footer-section h4 {
  color: white;
  margin: 0 0 0.25rem 0;
  font-size: 0.9rem;
}

.footer-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 1rem;
}

.footer-section a {
  color: #bdc3c7;
  text-decoration: none;
  transition: color 0.3s ease;
  font-size: 0.85rem;
}

.footer-section a:hover {
  color: white;
}

.footer-bottom {
  display: none !important;
}

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
    /* Show the button on small screens */
  }

  .wrapper {
    flex-direction: column !important;
  }

  .wrapper header {
    /* Hide by default, make it a fixed overlay */
    display: none;
    position: fixed;
    width: 280px;
    height: 100vh;
    z-index: 1000;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
    transform: translateX(-100%);
  }

  /* Class to show the sidebar, toggled by JS */
  .wrapper header.sidebar-visible {
    display: flex;
    transform: translateX(0);
  }

  section.main-content,
  .site-footer {
    margin-left: 0 !important;
    width: 100% !important;
  }

  .main-content {
    padding-top: 70px !important;
    /* Space for toggle button */
  }

  .site-footer {
    left: 0 !important;
    width: 100% !important;
    padding: 0 1rem !important;
  }

  .footer-content {
    justify-content: center !important;
  }

  .footer-section {
    text-align: center !important;
  }

  h1 {
    font-size: 1.875rem;
  }

  h2 {
    font-size: 1.5rem;
  }
}

/* Scroll to Top Button */
.scroll-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 1000;
}

.scroll-to-top:hover {
  background: var(--secondary-color);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.scroll-to-top.visible {
  display: flex;
}