/* grid container */
#course-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: stretch; /* ensures equal height per row */
}

/* each card container */
.course-item {
  box-sizing: border-box;
  display: flex;
}

/* Smartphones: 1 per row */
@media screen and (max-width: 576px) {
  .course-item {
    flex: 1 1 100%;
  }
}

/* Tablets: 2 per row */
@media screen and (min-width: 577px) and (max-width: 1023px) {
  .course-item {
    flex: 1 1 calc(50% - 20px);
  }
}

/* Desktop: 4 per row */
@media screen and (min-width: 1024px) {
  .course-item {    
	flex: 1 1 calc(25% - 20px); /* 4 per row, minus gap */
  }
}

/* actual card */
.course-card {
  border: 1px solid #ddd;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 100%; /* equal height fix */
}

/* course image */
.course-card img {
  display: block;
  width: 100%;
  height: auto;
}

/* info container (green box) */
.course-info {
  background: #4CAF50;
  color: #fff;
  padding: 15px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* course text */
.course-info p {font-size: 13px;
  margin: 0 0 10px;
  line-height: 1.4;
}

/* wrap long titles properly */
.course-title {font-size: 13px;
  word-break: break-word;
  white-space: normal;
  margin-bottom: 10px;
}

/* sign-up button */
.signup-button {
  display: inline-block;
  background: #eee;
  color: #000;
  padding: 8px 12px;
  text-decoration: none;
  font-weight: bold;
  align-self: flex-start;
}

/* search box */
#search-container {
  margin-bottom: 20px;
}

#search-container label {
  font-weight: bold;
  margin-right: 10px;
}

/* pagination */
#pagination {
  margin-top: 20px;
  text-align: center;
}

#pagination button {
  margin: 0 4px;
  padding: 6px 10px;
  border: none;
  background: #eee;
  cursor: pointer;
}

#pagination button.active {
  background: #4CAF50;
  color: #fff;
}
