/* General Styles */
:root {
  --primary-color: #202020;
  --background-color: #FFFFFF;
  --text-color: #000000;
  --sidebar-width: 250px;
  --sidebar-min-width: 200px;
  --sidebar-max-width: 400px;
  --sidebar-gap: 30px;
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  display: flex;
  min-height: 100vh;
  background-color: var(--background-color);
  color: var(--text-color);
}

/* Theme Styles */
body[data-theme="light"] {
  --primary-color: #202020;
  --background-color: #FFFFFF;
  --text-color: #000000;
}

body[data-theme="dark"] {
  --primary-color: #FFFFFF;
  --background-color: #202020;
  --text-color: #FFFFFF;
}

body[data-theme="system"] {
  --primary-color: #202020;
  --background-color: #FFFFFF;
  --text-color: #000000;
}

@media (prefers-color-scheme: dark) {
  body[data-theme="system"] {
    --primary-color: #FFFFFF;
    --background-color: #202020;
    --text-color: #FFFFFF;
  }
}

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background-color: var(--primary-color);
  color: white;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-brand img {
  height: 40px;
}

.theme-switcher {
  display: flex;
  gap: 0.5rem;
}

.theme-switcher button {
  background-color: transparent;
  border: 1px solid white;
  color: white;
  padding: 0.5rem 1rem;
  cursor: pointer;
}

.theme-switcher button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.theme-switcher select {
  padding: 0.5rem 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background-color: var(--background-color);
  color: var(--text-color);
  cursor: pointer;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-min-width);
  max-width: var(--sidebar-max-width);
  background-color: #f8f9fa;
  padding: 1rem;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid #ddd;
  top: 60px; /* Adjusted for navbar height */
  left: 0;
  z-index: 999;
}

.sidebar-resizer {
  width: 5px;
  background-color: #ccc;
  cursor: ew-resize;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
}

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

.sidebar nav ul li {
  margin: 0.5rem 0;
}

.sidebar nav ul li a {
  color: var(--text-color);
  text-decoration: none;
}

.sidebar nav ul li a:hover {
  color: var(--primary-color);
}

.sidebar nav ul li.folder summary {
  font-weight: bold;
  cursor: pointer;
}

.sidebar nav ul li.folder ul {
  margin-left: 1rem;
}

/* Main Content */
.content {
  margin-left: calc(var(--sidebar-width) + var(--sidebar-gap));
  padding: 20px;
  overflow-y: auto;
  margin-top: 60px; /* Adjusted for navbar height */
  width: calc(100% - var(--sidebar-width) - var(--sidebar-gap));
  transition: margin-left 0.3s ease, width 0.3s ease;
  padding-bottom: 80px; /* Add padding to avoid footer overlap */
}

/* Footer */
.footer {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  background: linear-gradient(135deg, #3498db, #2c3e50);
  color: white;
  text-align: center;
  padding: 20px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  font-size: 14px;
  height: 60px;
}

.footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: -15px;
  width: 30px;
  height: 100%;
  background: linear-gradient(135deg, #3498db, #2c3e50);
  clip-path: polygon(
    0% 0%,
    100% 10%,
    100% 90%,
    0% 100%
  );
  z-index: -1;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.footer img {
  width: 20px !important;
  height: auto !important;
}

.footer a {
  color: white;
  text-decoration: none;
  font-weight: bold;
  font-size: 10px;
  transition: opacity 0.3s ease;
}

.footer a:hover {
  opacity: 0.8;
}

/* GitHub Buttons */
.github-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.source-code-link {
  padding: 8px 16px;
  background-color: #24292e;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-size: 14px;
  display: flex;
  align-items: center;
  transition: background-color 0.3s ease;
}

.source-code-link:hover {
  background-color: #1c1f23;
}

.github-button {
  margin: 0 !important;
}

/* Project Owner Link */
.footer .project-owner {
  position: absolute;
  right: 20px;
  bottom: 10px;
  color: white;
  text-decoration: none;
}

.footer .project-owner:hover {
  text-decoration: underline;
}

/* Code Block Styling */
pre[class*="language-"] {
  background: #282a36;
  color: #f8f8f2;
  padding: 16px;
  border-radius: 4px;
  overflow-x: auto;
  position: relative;
}

pre[class*="language-"] button.copy-button {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #44475a;
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}

pre[class*="language-"] button.copy-button:hover {
  background: #6272a4;
}

/* Mobile Sidebar */
.mobile-sidebar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 80%;
  height: 100%;
  background: #2c3e50;
  z-index: 1000;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

.mobile-sidebar.active {
  transform: translateX(0);
}

.mobile-sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
}

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

.mobile-sidebar nav ul li {
  margin: 15px 0;
}

.mobile-sidebar nav ul li a {
  color: #ecf0f1;
  text-decoration: none;
  font-size: 16px;
  display: block;
  padding: 10px;
  border-radius: 4px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.mobile-sidebar nav ul li a:hover {
  background-color: #34495e;
  color: #ffffff;
}

.mobile-sidebar nav ul li.folder summary {
  font-weight: bold;
  cursor: pointer;
  padding: 10px;
  border-radius: 4px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.mobile-sidebar nav ul li.folder summary:hover {
  background-color: #34495e;
  color: #ffffff;
}

.mobile-sidebar nav ul li.folder ul {
  margin-left: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .content {
    margin-left: 0;
    width: 100%;
    padding-bottom: 80px;
  }

  .footer {
    left: 0;
    width: 100%;
    height: 60px;
  }

  .mobile-sidebar-toggle {
    display: block;
  }

  .mobile-sidebar {
    display: block;
  }
}