/* =========================================================
   Página Cursos — listagem + filtros
   ========================================================= */

.courses-page {
  background: #fff;
  padding: 32px 0 60px;
}

.courses-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.courses-page-head h1 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 700;
  color: var(--gray-900);
  margin: 0;
}

.sort-box {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--gray-200);
  height: 42px;
  overflow: hidden;
}
.sort-box .sort-label {
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  height: 100%;
  display: flex;
  align-items: center;
  white-space: nowrap;
}
.sort-box select {
  padding: 0 36px 0 14px;
  font-size: 13px;
  color: var(--gray-700);
  height: 100%;
  cursor: pointer;
  appearance: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 12px center;
  min-width: 130px;
}

.courses-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 28px;
  align-items: start;
}

/* ----- Sidebar filtros ----- */
.filters-sidebar {
  border: 1px solid var(--gray-200);
  background: #fff;
}
.filter-group {
  border-bottom: 1px solid var(--gray-200);
  padding: 14px 16px;
}
.filter-group:last-of-type { border-bottom: 0; }
.filter-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  cursor: pointer;
  user-select: none;
}
.filter-group-head h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0;
}
.filter-group-head .toggle-icon {
  width: 16px;
  height: 2px;
  background: var(--primary);
  position: relative;
}
.filter-group.collapsed .filter-body { display: none; }
.filter-group.collapsed .toggle-icon::after {
  content: '';
  position: absolute;
  left: 7px;
  top: -7px;
  width: 2px;
  height: 16px;
  background: var(--primary);
}

.filter-list { max-height: 220px; overflow-y: auto; }
.filter-list label,
.filter-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 13px;
  color: var(--gray-700);
  cursor: pointer;
}
.filter-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}
.filter-check .stars-filter {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  color: #f1c40f;
  font-size: 11px;
}
.filter-check .stars-filter .muted { color: #ddd; }

.filter-actions {
  padding: 16px;
  border-top: 1px solid var(--gray-200);
}
.btn-show-results {
  display: block;
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  cursor: pointer;
  text-align: center;
}
.btn-show-results:hover { background: var(--primary-dark); }
.btn-reset {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 12px;
  font-size: 13px;
  color: var(--gray-500);
  cursor: pointer;
  text-decoration: underline;
}
.btn-reset:hover { color: var(--primary); }

/* ----- Coluna direita: meta + grelha ----- */
.courses-results {
  min-width: 0;
  width: 100%;
  display: block; /* NÃO é a grelha de cards */
}
.results-meta {
  display: block;
  width: 100%;
  font-size: 14px;
  color: var(--gray-500);
  margin-bottom: 18px;
  line-height: 1.5;
  white-space: normal;
  writing-mode: horizontal-tb;
}
.results-meta strong { color: var(--gray-800); font-weight: 700; }

/* grelha de cards vem de course-card.css (.courses-grid) */
.courses-grid-page {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.course-card-page {
  background: #fff;
  cursor: pointer;
  position: relative;
  transition: box-shadow .2s;
}
.course-card-page:hover {
  box-shadow: 0 8px 28px rgba(0,0,0,.1);
  z-index: 5;
}
.course-card-page .thumb {
  position: relative;
  height: 160px;
  overflow: hidden;
  background: var(--gray-100);
}
.course-card-page .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.course-card-page .badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 9px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
}
.badge.hot { background: #e74c3c; }
.badge.new { background: #27ae60; }
.badge.special { background: #e67e22; }

.course-card-page .body { padding: 14px 14px 16px; }
.course-card-page .cat {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 4px;
}
.course-card-page .title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
  line-height: 1.35;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 40px;
}
.course-card-page .stats {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.course-card-page .stats span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--gray-500);
  background: var(--gray-100);
  padding: 4px 10px;
}
.course-card-page .foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.course-card-page .stars {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  color: var(--gray-700);
}
.course-card-page .stars i { color: #f1c40f; font-size: 11px; }
.course-card-page .stars i.empty { color: #ddd; }
.course-card-page .price {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-900);
}
.course-card-page .price.free { color: #27ae60; }
.course-card-page .price .old {
  font-size: 12px;
  color: var(--gray-400);
  text-decoration: line-through;
  font-weight: 400;
  margin-right: 4px;
}

/* Popup hover (fixed) */
.course-popup-fixed {
  position: fixed;
  width: 300px;
  background: #fff;
  box-shadow: 0 12px 40px rgba(0,0,0,.16);
  padding: 18px;
  z-index: 5000;
  display: none;
  pointer-events: auto;
}
.course-popup-fixed.show { display: block; }
.cp-instructor {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.cp-instructor img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}
.cp-instructor span {
  font-size: 12px;
  color: var(--gray-600);
  font-weight: 500;
}
.cp-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
  line-height: 1.35;
  margin-bottom: 8px;
}
.cp-desc {
  font-size: 12px;
  color: var(--gray-500);
  line-height: 1.55;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cp-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 11px;
  color: var(--gray-600);
  margin-bottom: 14px;
}
.cp-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.cp-meta i { color: var(--gray-400); }
.btn-preview {
  display: block;
  width: 100%;
  text-align: center;
  padding: 11px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  cursor: pointer;
}
.btn-preview:hover { background: var(--primary-dark); }
.cp-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cp-wish {
  font-size: 12px;
  color: var(--gray-600);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.cp-wish:hover { color: var(--primary); }
.cp-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-900);
}
.cp-price.free { color: #27ae60; }
.cp-price .old {
  font-size: 12px;
  color: var(--gray-400);
  text-decoration: line-through;
  font-weight: 400;
  margin-right: 4px;
}

.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-500);
  font-size: 15px;
}

@media (max-width: 1100px) {
  .courses-grid-page { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .courses-layout { grid-template-columns: 1fr; }
  .filters-sidebar { order: 2; }
  .courses-results { order: 1; }
  .course-popup-fixed { display: none !important; }
}
@media (max-width: 600px) {
  .courses-grid-page { grid-template-columns: 1fr; }
}
