/* Courses List Block Styles */
.courses-list-container {
  margin: 20px 0;
}

.courses-loading {
  text-align: center;
  padding: 20px;
  font-style: italic;
  color: #666;
}

.courses-content {
  display: block !important;
}

.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  max-width: 100%;
  margin: 0 auto;
}

/* Dynamic grid based on course count */
.courses-grid.courses-1 {
  grid-template-columns: minmax(280px, 600px);
  justify-content: center;
  max-width: 600px;
}

.courses-grid.courses-2 {
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  max-width: calc(2 * 280px + 1 * 20px + 100px);
}

.courses-grid.courses-3 {
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  max-width: calc(3 * 280px + 2 * 20px + 100px);
}

.courses-grid.courses-4 {
  grid-template-columns: repeat(4, minmax(280px, 1fr));
  max-width: calc(4 * 280px + 3 * 20px + 100px);
}

/* Responsive grid adjustments */
@media (min-width: 900px) and (max-width: 1199px) {
  .courses-grid.courses-4 {
    grid-template-columns: repeat(3, minmax(280px, 1fr));
    max-width: calc(3 * 280px + 2 * 20px + 100px);
  }
}

@media (min-width: 600px) and (max-width: 899px) {
  .courses-grid.courses-3,
  .courses-grid.courses-4 {
    grid-template-columns: repeat(2, minmax(280px, 1fr));
    max-width: calc(2 * 280px + 1 * 20px + 100px);
  }
}

@media (max-width: 599px) {
  .courses-grid.courses-1,
  .courses-grid.courses-2,
  .courses-grid.courses-3,
  .courses-grid.courses-4 {
    grid-template-columns: 1fr;
    max-width: 100%;
  }
}

.course-item {
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 0;
  background-color: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}

.course-item:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.course-title {
  font-size: 20px;
  font-weight: bold;
  margin: 0 0 10px 0;
  color: #1d2327;
}

.course-number {
  font-size: 14px;
  color: #7fd3f0;
  margin: 0 0 10px 0;
  font-weight: 500;
}

.course-description {
  font-size: 16px;
  color: #50575e;
  margin: 0 0 15px 0;
  line-height: 1.5;
  flex-grow: 1;
}

.course-details {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: auto;
}

.course-info {
  flex: 1;
  min-width: 200px;
}

.course-info-item {
  font-size: 14px;
  color: #50575e;
  margin-bottom: 4px;
}

.course-info-label {
  font-weight: 500;
  color: #1d2327;
}

.course-spots {
  font-weight: 500;
}

.course-spots.low-spots {
  color: #d63638;
}

.course-spots.medium-spots {
  color: #dba617;
}

.course-spots.high-spots {
  color: #00a32a;
}

.course-price-item {
  font-weight: 600;
  color: #1d2327;
}

.course-price {
  color: rgb(255, 0, 102);
  font-weight: 700;
}

.course-register-btn {
  background-color: rgb(255, 0, 102);
  color: rgb(255, 255, 255) !important;
  border: none;
  border-radius: 10px;
  padding: 10px 30px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  font-family: Raleway, sans-serif;
  text-decoration: none;
  text-align: center;
  display: inline-block;
  letter-spacing: -0.1px;
  line-height: 25.2px;
  height: 45px;
  box-sizing: border-box;
  transition: all 0.3s ease;
  word-break: break-word;
}

.course-register-btn:hover {
  background-color: rgb(230, 0, 92);
  text-decoration: none;
  color: rgb(255, 255, 255) !important;
}

.course-register-btn:active {
  background-color: rgb(200, 0, 80);
  color: rgb(255, 255, 255) !important;
}

.course-register-btn:focus {
  color: rgb(255, 255, 255) !important;
}

.course-register-btn:visited {
  color: rgb(255, 255, 255) !important;
}

.course-register-btn.disabled {
  background-color: #ddd;
  color: #999;
  cursor: not-allowed;
}

.course-register-btn.disabled:hover {
  background-color: #ddd;
  color: #999;
}

.course-register-btn-substitute {
  background-color: #dba617;
}

.course-register-btn-substitute:hover {
  background-color: #c89615;
  color: rgb(255, 255, 255) !important;
}

.course-register-btn-substitute:active {
  background-color: #b08513;
  color: rgb(255, 255, 255) !important;
}

.courses-error {
  background-color: #fcf2f3;
  border: 1px solid #f1aeb5;
  color: #d63638;
  padding: 15px;
  border-radius: 4px;
  margin: 20px 0;
}

.courses-empty {
  text-align: center;
  padding: 40px 20px;
  color: #666;
  font-style: italic;
}

/* Responsive design */
@media (max-width: 768px) {
  .course-details {
    flex-direction: column;
    align-items: stretch;
  }

  .course-register-btn {
    width: 100%;
    justify-content: center;
    margin-top: 10px;
  }

  .course-item {
    padding: 15px;
  }
}

/* More Info Button */
.course-more-info-btn {
  background-color: #00a2ec;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 30px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  font-family: Raleway, sans-serif;
  text-decoration: none;
  text-align: center;
  display: inline-block;
  letter-spacing: -0.1px;
  line-height: 25.2px;
  height: 45px;
  box-sizing: border-box;
  transition: all 0.3s ease;
  word-break: break-word;
}

.course-more-info-btn:hover {
  background-color: #005a87;
}

.course-more-info-btn:active {
  background-color: #004f75;
}

/* Course Modal Styles */
.course-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.course-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.course-modal-content {
  background-color: #fff;
  padding: 30px;
  border-radius: 8px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.course-modal-overlay.active .course-modal-content {
  transform: scale(1);
}

.course-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #666;
}

.course-modal-close:hover {
  color: #000;
}

.course-modal-header {
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.course-modal-header h3 {
  margin: 0;
  font-size: 24px;
}

.course-modal-body {
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 20px;
}

.course-modal-info p {
  margin: 10px 0;
}

.course-modal-price {
  color: rgb(255, 0, 102);
  font-weight: 700;
  font-size: 18px;
}

.course-long-description {
  margin-top: 15px;
  padding: 15px;
  background-color: #f9f9f9;
  border-radius: 5px;
  border-left: 4px solid #7fd3f0;
}

.course-modal-footer {
  text-align: center;
  padding-top: 15px;
  border-top: 1px solid #eee;
}

@media (max-width: 768px) {
  .course-more-info-btn {
    width: 100%;
    justify-content: center;
    margin-top: 10px;
  }

  .course-modal-content {
    width: 95%;
    padding: 20px;
    max-height: 90vh;
  }
}
