*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: 'Georgia', serif;
  background-color: #fff;
  color: #222;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

html {
  scroll-behavior: smooth;
}

code,
pre {
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  background: #f4f4f4;
  padding: 1rem;
  border-left: 4px solid #ccc;
  white-space: pre-wrap;
  overflow-x: auto;
  word-wrap: break-word;  /* Prevent code from overlapping */
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

h1 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: 1rem;
  color: #666;
}

article h2 {
  font-size: 1.4rem;
  margin-top: 2rem;
  color: #444;
}

footer {
  text-align: center;
  margin-top: 3rem;
  font-size: 0.9rem;
  color: #888;
}

/* CONTAINER */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem;
}

/* NAVBAR */
.navbar {
  background-color: #2c3e50;
  color: white;
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.nav-logo {
  font-size: 1.3rem;
  font-weight: bold;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: white;
  text-decoration: none;
  font-size: 1rem;
  transition: color 0.3s;
}

.nav-links a:hover {
  color: #1abc9c;
}

/* LAYOUT */
.main-layout {
  display: flex;
  flex-direction: row;
  gap: 2rem;
  flex-wrap: wrap;
}

.sidebar {
  width: 250px;
  height: calc(100vh - 3.5rem);
  background-color: #f9f9f9;
  border-right: 1px solid #ddd;
  padding: 1rem;
  overflow-y: auto;
  position: sticky;
  top: 3.5rem;
  flex-shrink: 0;
  z-index: 100;
}

.sidebar-title {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: #444;
  text-align: center;
}

.manual-toc ul {
  list-style: none;
  padding-left: 0;
}

.manual-toc li {
  margin-bottom: 0.75rem;
}

.manual-toc a {
  color: #2c3e50;
  text-decoration: none;
  font-size: 0.95rem;
}

.manual-toc a:hover {
  color: #1abc9c;
}

.content-area {
  flex: 1;
  padding: 2rem;
  max-width: 100%;
}

.right-panel {
  width: 250px;
  background-color: #f1f1f1;
  border-left: 1px solid #ccc;
  padding: 1rem;
  position: sticky;
  top: 3.5rem;
  height: calc(100vh - 3.5rem);
  overflow-y: auto;
  flex-shrink: 0;
}

/* BUTTONS */
.next-button,
.previous-button {
  padding: 12px 25px;
  font-size: 16px;
  border-radius: 5px;
  color: white;
  text-decoration: none;
  text-align: center;
  display: inline-block;
  transition: background-color 0.3s ease;
  margin: 1rem 0;
}

.next-button {
  background-color: #1abc9c;
}

.next-button:hover {
  background-color: #16a085;
}

.previous-button {
  background-color: #3498db;
}

.previous-button:hover {
  background-color: #2980b9;
}

/* READ MORE BUTTON */
.read-more-btn {
  display: inline-block;
  padding: 10px 20px;
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  background-color: #007acc;
  border: none;
  border-radius: 6px;
  text-decoration: none;
  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.read-more-btn:hover {
  background-color: #005fa3;
  transform: translateY(-2px);
}

.read-more-btn:active {
  transform: translateY(0);
  background-color: #004d80;
}

/* Code Block Styling */
/* General Code Block Styling */
code,
pre {
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  background: #f4f4f4;
  padding: 1rem;
  border-left: 4px solid #ccc;
  white-space: pre-wrap; /* Ensures wrapping of long code */
  word-wrap: break-word; /* Break long words like URLs or code that does not have spaces */
  overflow-x: auto; /* Allows horizontal scrolling */
  max-width: 100%; /* Prevents overflowing the container */
  display: block; /* Forces the code to act like a block element */
  box-sizing: border-box; /* Ensures padding and borders are included in width/height */
}

/* 📱 MOBILE STYLES */
@media (max-width: 768px) {
  .main-layout {
    flex-direction: column;
    gap: 1rem;
  }

  .sidebar,
  .right-panel {
    width: 100%;
    height: auto;
    position: relative;
    border: none;
    padding: 1rem;
    margin-bottom: 1rem;
  }

  .content-area {
    padding: 1rem;
    width: 100%;
  }

  .nav-container {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-links {
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
  }

  .container {
    padding: 1rem;
  }

  h1 {
    font-size: 1.6rem;
  }

  article h2 {
    font-size: 1.2rem;
  }

  .next-button,
  .previous-button {
    width: 100%;
    font-size: 14px;
    padding: 12px;
  }

   code,
  pre {
    font-size: 0.85rem;
    word-wrap: break-word; /* Prevents overflow and forces wrapping on mobile */
    white-space: pre-wrap; /* Ensures the code block wraps properly on small screens */
    overflow-x: auto; /* Adds scrollable area if content is too long */
    max-width: 100%; /* Ensures code does not exceed container width */
    padding: 0.8rem; /* Adjust padding to fit mobile screens */
  }
}

/*side bar */
/* Sidebar Styles */
.right-sidebar {
  width: 250px;
  background-color: #f1f1f1;
  border-left: 1px solid #ccc;
  padding: 1rem;
  position: fixed;
  top: 3.5rem;
  right: 0;
  height: 100%;
  box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
  z-index: 100;
}

.sidebar-title {
  text-align: center;
  margin-bottom: 2rem;
}

.sidebar-title h3 {
  font-size: 1.6rem;
  color: #333;
}

.sidebar-menu {
  list-style: none;
  padding-left: 0;
}

.sidebar-menu li {
  margin-bottom: 1rem;
}

.sidebar-menu li a {
  display: block;
  text-decoration: none;
  color: #2c3e50;
  font-size: 1.1rem;
  padding: 10px;
  border-radius: 4px;
  transition: color 0.3s, transform 0.3s;
}

.sidebar-menu li a:hover {
  color: #1abc9c;  /* Hover color */
  transform: translateX(5px); /* Slightly move to the right */
}

/* Smooth Text Animation on Hover */
.sidebar-menu li a::before {
  content: "";
  display: block;
  width: 0%;
  height: 2px;
  background-color: #1abc9c;
  transition: width 0.3s ease;
}

.sidebar-menu li a:hover::before {
  width: 100%; /* Grow underline on hover */
}

/* Responsive Sidebar */
@media (max-width: 768px) {
  .right-sidebar {
    width: 100%;
    position: relative;
    height: auto;
  }

  .sidebar-title h3 {
    font-size: 1.4rem;
  }

  .sidebar-menu li a {
    font-size: 1rem;
  }
}
