.categories {
    max-width: 95%;
    min-width: 75%;
    margin: 1rem auto;
    padding: 1rem;
    background-color: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 0.1rem 0.3rem rgba(0, 0, 0, 0.2);
    font-size: clamp(0.75rem, 2vw, 0.875rem); /* Responsive base font size */
    flex: 1;
}

.categories * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.categories .container {
    width: 100%;
    padding: 0.5rem;
}


.categories h1 {
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    margin-bottom: 0.25rem;
}

.categories p {
    font-size: clamp(0.75rem, 2vw, 0.8rem);
}

/* Topic sections as true vertical columns */
.categories .topic-section {
  background-color: #fff;
  border-radius: 0.3rem;
  box-shadow: 0 0.05rem 0.1rem rgba(0,0,0,0.05);
  margin-bottom: 0.75rem;
  overflow: hidden;
  align-items: left;

  column-count: 1;   /* default: 1 column */
  column-gap: 1rem;  /* spacing between columns */
}

@media (min-width: 600px) {
  .categories .topic-section {
    column-count: 2; /* 2 columns on medium screens */
  }
}

@media (min-width: 900px) {
  .categories .topic-section {
    column-count: 3; /* 3 columns on large screens */
  }
}

/* Subtopics should flow vertically inside columns */
.categories .subtopic {
  break-inside: avoid;
  display: block;
  margin-bottom: 1rem;
}
.subtopic {
  display: block;
  margin-bottom: 1rem;
  margin-top: .1rem;
  padding: 1rem;
  background-color: #f9f9f9; 
  border: 1px solid #ddd;   
  border-radius: 8px;  
  color: #004aad;    
}

.categories .topic-header {
  column-span: all;  /* spans across all multi-columns */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem;
  margin-top: 1rem;
  margin-bottom: 1rem;
  background-color: #e3f2fd; 
  color: #004aad;
}

.categories .topic-header h2 {
    margin-left: 1rem;
    flex-grow: 1;
    font-size: clamp(1rem, 2.25vw, 1.5rem);
    min-width: 40%; /* Ensures text doesn't get too squished */
    color: #004aad;
}



.heading-title {
  display: block;
  margin-bottom: 10px; /* space between heading and list */
  font-size: clamp(0.9rem, 2.25vw, 1.2rem);
}

.link-list {
  counter-reset: item;
  list-style: none;
  padding-left: 0;
  margin: 0;
  font-size: clamp(0.8rem, 2.25vw, 1rem);
}

.link-list li {
  counter-increment: item;
  margin-bottom: 0.4rem;
  position: relative;
  padding-left: 1.4rem; /* reduced from 2rem */
}

.link-list li::before {
  content: counter(item) ".";
  position: absolute;
  left: 0;
  top: 0;
  line-height: 1.5;
  font-weight: bold;
  color: #555;
}


/* Make link take full block space so text wraps properly */
.link-list li a {
  display: block;
  padding: 4px 6px;
  color: #004aad;
  text-decoration: none;
  background-color: #f9f9f9;
  border-radius: 6px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  word-wrap: break-word;
}


.link-list li a:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  background-color: #eaeaea;
}



.grade-navbar {
    background-color: #ffffff;
    padding: 0.5rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 60px; /* Set this to match your main navbar height */
    z-index: 999; /* Lower than main navbar's z-index */
    width: 100%;
}

.grade-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0;
}

.grade-btn {
    display: inline-block;
    padding: 0.8rem 1.2rem;
    background-color: transparent;
    color: #004aad; /* Cobalt blue text color */
    text-decoration: none;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 600;
    font-size: 1rem;
    border-radius: 0;
    transition: all 0.3s ease;
    text-align: center;
    flex-grow: 1;
    min-width: 120px;
    box-sizing: border-box;
    position: relative;
}

/* Add separator between grade buttons */
.grade-btn:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 20px;
    width: 1px;
    background-color: #e0e0e0;
}

/* Underline effect on hover */
.grade-btn::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background-color: #004aad;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.grade-btn:hover::before {
    width: 70%; /* Line grows on hover */
}

/* Current tab has permanent underline instead of background */
.grade-btn.current {
    color: #004aad;
    background-color: transparent;
    font-weight: 700;
}

.grade-btn.current::before {
    width: 70%; /* Line stays visible for current tab */
}

.grade-btn.current:hover::before {
    width: 85%; /* Line grows a bit more on hover for current tab */
}

/* Remove separator from the last button */
.grade-btn:last-child::after {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .grade-btn {
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
        min-width: 100px;
    }
}

@media (max-width: 768px) {
    .grade-container {
        gap: 0;
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 0.5rem;
        -ms-overflow-style: none;  /* Hide scrollbar for IE and Edge */
        scrollbar-width: none;  /* Hide scrollbar for Firefox */
    }
    
    /* Hide scrollbar for Chrome, Safari and Opera */
    .grade-container::-webkit-scrollbar {
        display: none;
    }
    
    .grade-btn {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
        min-width: 110px;
        flex-grow: 0;
        flex-shrink: 0;
    }
    
    .grade-btn::before {
        height: 2px; /* Thinner line on mobile */
    }
}

@media (max-width: 480px) {
    .grade-btn {
        padding: 0.7rem;
        font-size: 0.7rem;
        min-width: 80px;
    }
}


/* Education Navigation Bar */
.edu-navbar {
    background-color: transparent;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
}

.nav-btn {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background-color: transparent;
    color: #0077cc;
    text-decoration: none;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: clamp(0.9rem, 2vw, 2.0rem);
    font-weight: 600;
    border-radius: 4px;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
}

/* Underline effect on hover */
.nav-btn::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background-color: #0077cc;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-btn:hover::before {
    width: 70%; /* Line grows on hover */
}

/* Current tab has permanent underline */
.nav-btn.current {
    color: #0077cc;
    background-color: transparent;
    font-weight: 700;
}

.nav-btn.current::before {
    width: 70%; /* Line stays visible for current tab */
}

.nav-btn.current:hover::before {
    width: 85%; /* Line grows a bit more on hover for current tab */
}

/* Section Navigation */
.section-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.section-nav-btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    background-color: transparent;
    color: #0077cc;
    text-decoration: none;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 500;
    font-size: clamp(0.7rem, 2vw, 1.2rem);
    border-radius: 4px;
    transition: all 0.3s ease;
    position: relative;
}

/* Underline effect on hover */
.section-nav-btn::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: #0077cc;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.section-nav-btn:hover::before {
    width: 80%; /* Line grows on hover */
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .nav-btn {
        width: 100%;
        padding: 0.7rem 1rem;
    }
    
    .section-nav {
        gap: 0.8rem;
        /* Ensure buttons stay in a row and wrap when needed */
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .section-nav-btn {
        padding: 0.5rem 0.9rem;
        flex-shrink: 1;
        min-width: fit-content;
    }
}

@media (max-width: 480px) {
    .section-nav {
        /* Keep buttons in a row that wraps to next line */
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }
    
    .section-nav-btn {
        padding: 0.5rem 0.8rem;        
        width: auto;
        text-align: center;
    }
}

/* Extra small devices adjustment */
@media (max-width: 360px) {
    .section-nav {
        gap: 0.4rem;
    }
    
    .section-nav-btn {
        padding: 0.4rem 0.7rem;
    }
}

html {
  scroll-padding-top: 120px; /* height of your navbar */
}
