/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
/* Responsive Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 20px auto;
}
.image-container {
  text-align: center;
  margin: 20px 0;
}
/* Traversal Methods Layout */
.traversal-methods {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.traversal-method {
  flex: 1;
  min-width: 250px;
  background-color: #fff;
  border: 2px solid #4caf50;
  border-radius: 5px;
  padding: 15px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.traversal-method h3 {
  color: #4caf50;
  margin-bottom: 10px;
  font-size: 18px;
}

.traversal-method ol {
  padding-left: 20px;
}

.traversal-method li {
  margin-bottom: 10px;
  line-height: 1.5;
}

.image-container img {
  width: 100%;
  max-width: 600px; /* Adjust this value as needed */
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

body {
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
}

/* Navigation */
.topnav {
  background-color: #4caf50;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.logo {
  color: white;
  font-size: 24px;
  font-weight: bold;
  padding: 14px 0;
}

.nav-links {
  display: flex;
}

.nav-links a {
  color: white;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
  font-size: 17px;
  transition: background-color 0.3s;
}

.nav-links a:hover {
  background-color: #45a049;
}

.nav-links a.active {
  background-color: #367c39;
}

.icon {
  display: none;
  color: white;
  text-decoration: none;
  padding: 14px 16px;
  cursor: pointer; /* Add cursor pointer for better UX */
}

.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 24px;
  width: 30px;
}

.bar {
  height: 4px;
  width: 100%;
  background-color: white;
  border-radius: 2px;
}

/* Sidebar */
.sidebar {
  height: 100%;
  width: 250px;
  position: fixed;
  z-index: 1;
  top: 56px;
  left: 0;
  background-color: #fff;
  overflow-x: hidden;
  padding-top: 20px;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
  transition: 0.3s; /* Add transition for smooth sidebar toggle */
}

.sidebar a {
  padding: 10px 15px;
  text-decoration: none;
  font-size: 16px;
  color: #333;
  display: block;
  transition: 0.3s;
  border-left: 4px solid transparent;
}

.sidebar a:hover {
  background-color: #f1f1f1;
  border-left: 4px solid #4caf50;
}

.sidebar a.active {
  background-color: #e9f5e9;
  border-left: 4px solid #4caf50;
  color: #4caf50;
  font-weight: bold;
}

/* Main Content */
.main-content {
  margin-left: 250px;
  padding: 20px;
  max-width: 1200px;
  transition: margin-left 0.3s; /* Add transition for smooth content shift */
}

h1 {
  color: #333;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #4caf50;
}

h2 {
  color: #4caf50;
  margin: 25px 0 15px;
}

h3 {
  color: #333;
  margin: 20px 0 10px;
}

p {
  margin-bottom: 15px;
}

/* Cards and Boxes */
.intro-card {
  background-color: #fff;
  padding: 20px;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.definition-box {
  background-color: #e9f5e9;
  padding: 15px;
  border-left: 4px solid #4caf50;
  margin-bottom: 20px;
  border-radius: 0 5px 5px 0;
}

.topic-box {
  background-color: #fff;
  padding: 10px 15px;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
  display: inline-block;
}

.topic-box h2 {
  margin: 0;
  color: #4caf50;
}

.types-box,
.sub-box {
  background-color: #fff;
  padding: 15px;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.two-column {
  display: flex;
  gap: 20px;
  margin-top: 15px;
}

.column {
  flex: 1;
}

/* Operations */
.operation {
  display: flex;
  margin-bottom: 15px;
  background-color: #fff;
  padding: 10px 15px;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.op-name {
  font-weight: bold;
  min-width: 120px;
  color: #4caf50;
}

.op-desc {
  flex: 1;
}

/* Diagrams */

/* Array Visual */
.array-visual {
  margin: 20px 0;
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
}

.array-box {
  display: flex;
  border-top: 2px solid #4caf50;
  border-bottom: 2px solid #4caf50;
  margin-bottom: 20px;
}

.array-cell {
  width: 40px;
  height: 40px;
  border-left: 1px solid #4caf50;
  border-right: 1px solid #4caf50;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
}

.memory-note {
  text-align: center;
  color: #666;
}

/* Linked List Visual */
.linked-list-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 20px 0;
}

.node {
  display: flex;
  border: 2px solid #4caf50;
  border-radius: 5px;
  overflow: hidden;
}

.data,
.pointer {
  padding: 10px;
  text-align: center;
}

.data {
  background-color: #e9f5e9;
  min-width: 80px;
}

.pointer {
  border-left: 1px solid #4caf50;
  min-width: 80px;
}

.arrow {
  margin: 0 10px;
  font-size: 20px;
  color: #4caf50;
}

.ll-visual {
  display: flex;
  align-items: center;
  margin: 15px 0;
}

.address-labels {
  display: flex;
  justify-content: space-around;
  width: 100%;
  margin-top: 5px;
  color: #666;
}

.node.doubly {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
}

.prev-pointer,
.next-pointer {
  padding: 10px;
  text-align: center;
  border-left: 1px solid #4caf50;
  min-width: 60px;
}

.arrow.double {
  display: flex;
  flex-direction: column;
}

.ll-visual.circular {
  position: relative;
}

.circular-arrow {
  position: absolute;
  bottom: -20px;
  left: 0;
  width: 100%;
  text-align: center;
  color: #4caf50;
  font-size: 24px;
}

/* Code Examples */
.code-example {
  margin: 20px 0;
}

.code-example h3 {
  margin-bottom: 10px;
}

pre {
  background-color: #f8f8f8;
  padding: 15px;
  border-radius: 5px;
  overflow-x: auto;
  border: 1px solid #ddd;
}

code {
  font-family: "Courier New", Courier, monospace;
  color: #333;
}

/* Navigation Buttons */
.navigation-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 40px;
}

.next-page {
  display: flex;
  justify-content: flex-end;
  margin-top: 40px;
}

.btn {
  display: inline-block;
  background-color: #4caf50;
  color: white;
  padding: 10px 20px;
  text-decoration: none;
  border-radius: 5px;
  transition: background-color 0.3s;
}

.btn:hover {
  background-color: #45a049;
}

/* Highlight */
.highlight {
  color: #4caf50;
  font-weight: bold;
}

/* Footer */
footer {
  background-color: #333;
  color: white;
  text-align: center;
  padding: 20px;
  margin-top: 40px;
  margin-left: 250px;
  transition: margin-left 0.3s; /* Add transition for smooth footer shift */
}

/* Responsive Design */
@media screen and (max-width: 768px) {
  .nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    position: absolute;
    top: 56px;
    left: 0;
    background-color: #4caf50;
    z-index: 1001; /* Ensure nav is above sidebar */
  }

  .nav-links.responsive {
    display: flex;
  }

  .icon {
    display: block;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    top: 0;
    padding-top: 10px;
    margin-bottom: 20px;
    display: none;
    z-index: 999; /* Lower z-index than nav */
  }

  .sidebar.responsive {
    display: block;
  }

  .main-content {
    margin-left: 0;
    padding: 15px;
  }

  footer {
    margin-left: 0;
  }

  .two-column {
    flex-direction: column;
  }

  .diagram-branches,
  .sub-branches {
    flex-direction: column;
  }

  .node {
    margin-bottom: 40px;
  }
}

@media screen and (max-width: 438px) {
  .navigation-buttons {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 0 10px;
  }

  .navigation-buttons .btn {
    width: 100%;
    text-align: center;
    font-size: 16px;
    padding: 10px;
    gap: 10px;
  }

  h1 {
    font-size: 22px;
    text-align: center;
  }

  .btn {
    font-size: 16px;
    padding: 10px 14px;
  }

  .main-content {
    padding: 10px;
  }
}

