/* ----------------- Global Layout ----------------- */
body {
  font-family: system-ui, sans-serif;
  background-color: #f3f4f6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
}

/* ----------------- Index Page ----------------- */
body.index-page main {
  flex: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 1rem;
  text-align: center;
}

/* ----------------- Courses Page ----------------- */
/* Find this block in your style.css */
body.courses-page .main1-content {
  flex: 1;
  width: 100%;
  padding: 20px 0;
  /* Ensure there is NO 'overflow: hidden' or 'overflow: auto' here */
}

/* ----------------- Other Pages ----------------- */
body.other-page main {
  flex: 1;
  width: 100%;
  padding: 3rem 40px;
  /* full width with padding */
  text-align: left;
  box-sizing: border-box;
}


header {
  background-color: #1d4ed8;
  /* Tailwind blue-700 */
  color: white;
  padding: 1rem 0;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);

  /* --- Added for Sticky Nav Bar --- */
  position: sticky;
  /* Enables the sticky behavior */
  top: 0;
  /* Defines the distance from the top to "stick" at */
  z-index: 1000;
  /* Ensures the header stays on top of other content */
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

header nav a {
  margin-left: 1.5rem;
  text-decoration: none;
  color: white;
}

header nav a:hover {
  text-decoration: underline;
}

footer {
  background-color: #111827;
  /* Tailwind gray-900 */
  color: white;
  text-align: center;
  padding: 1.5rem 0;
}

footer a {
  margin: 0 0.5rem;
  color: white;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

img.logo {
  width: 100px;
  height: 100px;
  border-radius: 9999px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  margin-right: 0.5rem;
}

.btn {
  display: inline-block;
  padding: 12px 24px;
  margin-top: 10px;
  font-size: 16px;
  font-weight: bold;
  color: #fff;
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  border: none;
  border-radius: 50px;
  text-decoration: none;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
  background: linear-gradient(135deg, #43e97b, #38f9d7);
}

/* ----------------- Index Page Grid ----------------- */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 2rem;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 768px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.card {
  background: white;
  padding: 1.5rem;
  border-radius: 1rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  text-align: left;
}

.card h3 {
  font-size: 1.25rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.card a {
  color: #1d4ed8;
  text-decoration: none;
}

.card a:hover {
  text-decoration: underline;
}

/* ----------------- Courses Page Specific ----------------- */
.courses-page .main1-content {
  width: 100%;
  padding: 20px 0;
}

.courses-page .year-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 24px;
  background: #e0e7ff;
  border-radius: 8px;
  margin: 0 0 20px 0;
  position: sticky;
  top: 140px;
  z-index: 100;
}

.courses-page .year-nav a {
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 6px;
  background: #ffffff;
  color: #1e3a8a;
  font-weight: 500;
  transition: all 0.3s ease;
}

.courses-page .year-nav a:hover {
  background: #3b82f6;
  color: #fff;
}

.courses-page .year-nav a.active {
  background: #1e3a8a;
  color: #fff;
}

/* ----------------- Two-Column Layout - Full Width ----------------- */
.courses-page .layout {
  display: flex;
  align-items: flex-start;
  width: 100%;
  max-width: 100%;
  gap: 24px;
  padding: 0 40px;
  box-sizing: border-box;
}

.courses-page .sidebar {
  /* ... existing styles ... */
  position: sticky;
  top: 170px;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
}

.courses-page .sidebar h2 {
  margin-bottom: 16px;
  color: #1e40af;
  font-size: 1.2rem;
  padding: 8px 0;
  position: sticky;
  top: 0;
  background: #f8fafc;
  /* Match sidebar background to cover scrolling links */
  z-index: 10;
  /* Ensure it stays above the scrolling links */
  /* Remove or set margin-bottom to 0 so it sticks right above the links */
  margin-top: -16px;
  /* Counteract the sidebar's padding-top to stick to the edge */
  margin-bottom: 16px;
  /* Keep spacing below the fixed heading */
}

.courses-page .sidebar a {
  display: block;
  color: #111827;
  text-decoration: none;
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  transition: 0.3s;
}

.courses-page .sidebar a:hover {
  background: #e0e7ff;
  color: #1e3a8a;
}

/* Main Content Area */
.courses-page .main1-content>.layout>div:not(.sidebar) {
  flex: 1;
  background: #ffffff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* ----------------- Responsive Design ----------------- */
@media (max-width: 1024px) {
  .courses-page .layout {
    padding: 0 20px;
  }
}

@media (max-width: 768px) {
  .courses-page .layout {
    flex-direction: column;
    gap: 15px;
  }

  .

  /* Sidebar Styling */
  .courses-page .sidebar {
    flex: 0 0 240px;
    background: #f8fafc;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 130px;

    /* --- Added for Scroll Bar --- */
    max-height: calc(100vh - 150px);
    /* Adjust this height as needed (e.g., 100vh - header height - top offset - bottom padding) */
    overflow-y: auto;
    /* Adds a vertical scrollbar when content overflows */
  }

  .courses-page .main1-content>.layout>div:not(.sidebar) {
    width: 100%;
  }
}

/* Make body a full-height flex container */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  /* full viewport height */
  margin: 0;
}

/* Make main content grow to push footer down */
main,
.main1-content {
  flex: 1;
  /* fills remaining space */
}


.topic-block {
  background: #fff;
  border-radius: 15px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  margin: 40px 0;
  padding: 25px;
  transition: all 0.3s ease;
}

.topic-block:hover {
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.12);
  transform: translateY(-3px);
}

.topic-title {
  color: #ff6600;
  font-size: 1.6em;
  margin-bottom: 15px;
  border-left: 5px solid #ff9800;
  padding-left: 10px;
  font-weight: 700;
}

.topic-content {
  display: block;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
}

.topic-image {
  flex: 1 1 250px;
  max-width: 300px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.topic-text {
  flex: 2 1 400px;
  color: #333;
  font-size: 1rem;
  line-height: 1.7;
}

.quote-box {
  background: #fff8e1;
  /* soft warm background */
  border-left: 6px solid #ff9800;
  /* highlight accent */
  padding: 20px 25px;
  margin: 30px 0;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  font-style: italic;
  color: #333;
  line-height: 1.7;
  position: relative;
}

.quote-box::before {
  content: "“";
  font-size: 40px;
  color: #ff9800;
  position: absolute;
  top: 10px;
  left: 15px;
  opacity: 0.3;
}

.quote-box p {
  margin: 0;
  padding-left: 20px;
}

.sub-topic-title {
  color: #2c3e50;
  font-size: 1.8em;
  margin-bottom: 15px;
  text-align: center;
}

.data-list {
  list-style: none;
  /* remove default bullets */
  padding: 0;
  flex: 1 1 300px;
  /*responsive widht */

}

.data-list li {
  background: #ffffff;
  margin: 10px 0;
  padding: 15px 20px;
  border-left: 5px solid #3498db;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  font-size: 1.1em;
}

.data-list li::before {
  content: "✔";
  /* icon before each item */
  color: #3498db;
  font-weight: bold;
  margin-right: 10px;
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
}

.data-list li:hover {
  transform: translateX(5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.image-container {
  flex: 1 1 300px;
  /* responsive width */
  text-align: center;
}

.image-container img {
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@media (max-width: 700px) {
  .content-container {
    flex-direction: column;
    align-items: center;
  }
}

.sub-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 30px;
  align-items: flex-start;
  max-width: 900px;
  margin: 0 auto;
}

.binary-table {
  width: 30%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 1.1em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  background: #f9fafb;
  border-radius: 8px;
  overflow: hidden;
}

.binary-table th,
.binary-table td {
  padding: 12px 18px;
  text-align: center;
}

.binary-table thead {
  background: linear-gradient(90deg, #4e54c8 0%, #8f94fb 100%);
  color: #fff;
}

.binary-table tbody tr:nth-child(even) {
  background: #eef1f7;
}

.binary-table tbody tr:hover {
  background: #d1e7fd;
  transition: background 0.2s;
}

.binary-table td {
  font-family: 'Fira Mono', 'Consolas', monospace;
  font-size: 1.05em;
}