/* ==========================================================
   TurtleEdu — Unified College Card / Category Page Stylesheet
   Loaded via <link> on colleges.php and every colleges-*.php
   ========================================================== */

/* ---------- Hero ---------- */
.courses-hero,
section.hero {
  background: linear-gradient(135deg, #035bff 0%, #0240b3 50%, #0f172a 100%);
  padding: 130px 5% 64px;
  text-align: center;
  color: #fff;
  position: relative;
  overflow: hidden;
  font-family: 'Nunito', sans-serif;
}
.courses-hero::before,
section.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(96, 165, 250, .25) 0%, transparent 55%),
    radial-gradient(circle at 80% 70%, rgba(74, 222, 128, .15) 0%, transparent 50%);
  pointer-events: none;
}
.courses-hero h1,
section.hero h1 {
  font-family: 'Sora', 'Nunito', sans-serif;
  font-size: clamp(1.7rem, 3.4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.18;
  margin: 0 auto 14px;
  position: relative;
  max-width: 920px;
  letter-spacing: -0.4px;
  color: #fff;
}
.courses-hero p,
section.hero > p {
  font-size: 1.04rem;
  color: rgba(255, 255, 255, .82);
  line-height: 1.6;
  max-width: 720px;
  margin: 0 auto;
  position: relative;
}
section.hero .stats {
  display: flex;
  justify-content: center;
  gap: 36px;
  flex-wrap: wrap;
  margin-top: 28px;
  position: relative;
}
section.hero .stat { text-align: center; min-width: 110px; }
section.hero .stat-n {
  font-family: 'Sora', 'Nunito', sans-serif;
  font-size: 1.9rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}
section.hero .stat-l {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, .68);
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-top: 5px;
}
@media (max-width: 768px) {
  .courses-hero,
  section.hero { padding: 110px 18px 50px; }
  section.hero .stats { gap: 22px; }
  section.hero .stat-n { font-size: 1.55rem; }
}

/* ---------- Filter / search bar (used on colleges.php) ---------- */
.filter-bar {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 16px 5%;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 4px 18px rgba(15, 23, 42, .04);
}
.filter-inner { max-width: 1280px; margin: 0 auto; }
.filter-row-1 {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.filter-row-2 { display: flex; flex-wrap: wrap; gap: 8px; }
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 320px;
}
.search-wrap > i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.85rem;
  pointer-events: none;
}
#q,
#city,
#sort {
  padding: 11px 14px 11px 38px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.92rem;
  font-family: 'Nunito', sans-serif;
  background: #f8fafc;
  outline: none;
  transition: all .15s;
  width: 100%;
}
#city,
#sort {
  padding-left: 14px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
#q:focus,
#city:focus,
#sort:focus {
  border-color: #035bff;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(3, 91, 255, .15);
}
.city-wrap { flex: 1 1 200px; max-width: 220px; }
#sort { flex: 0 0 130px; }
.filter-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: #475569;
  font-weight: 700;
}
#count { color: #035bff; }
#clearBtn {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.78rem;
  display: none;
}
#clearBtn.on { display: inline-flex; }
#clearBtn:hover { background: #fee2e2; }

.chip {
  background: #f1f5f9;
  color: #475569;
  padding: 8px 14px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  border: 1.5px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.chip:hover { background: #e2e8f0; }
.chip b {
  background: rgba(255, 255, 255, .8);
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #475569;
}
.chip.active {
  background: #035bff;
  color: #fff;
  border-color: #035bff;
  box-shadow: 0 4px 14px rgba(3, 91, 255, .25);
}
.chip.active b { background: rgba(255, 255, 255, .25); color: #fff; }

@media (max-width: 640px) {
  .filter-row-1 { gap: 8px; }
  .search-wrap, .city-wrap { flex: 1 1 100%; max-width: 100%; }
  #sort { flex: 0 0 100%; }
  .filter-meta { width: 100%; justify-content: space-between; margin-left: 0; }
}

/* ---------- College grid (both colleges.php and category pages) ---------- */
.colleges-wrap,
.courses-main {
  padding: 36px 5% 48px;
  background: #f8fafc;
}
.college-grid,
#grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 22px;
  max-width: 1280px;
  margin: 0 auto;
}

/* Unified card — wins over older rules thanks to specificity */
.college-grid .college-card,
.courses-main .college-card,
#grid .card {
  background: #fff !important;
  border-radius: 16px !important;
  padding: 22px 22px 18px !important;
  box-shadow: 0 2px 12px rgba(15, 23, 42, .06) !important;
  border: 1.5px solid #e8edf5 !important;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  position: relative !important;
  overflow: hidden !important;
}
.college-grid .college-card::before,
.courses-main .college-card::before,
#grid .card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #035bff, #12b76a);
  opacity: 0;
  transition: opacity .25s;
}
.college-grid .college-card:hover,
.courses-main .college-card:hover,
#grid .card:hover {
  transform: translateY(-4px) !important;
  box-shadow: 0 14px 36px rgba(3, 91, 255, .14) !important;
  border-color: rgba(3, 91, 255, .3) !important;
}
.college-grid .college-card:hover::before,
.courses-main .college-card:hover::before,
#grid .card:hover::before { opacity: 1; }

/* Card content */
.college-card .college-logo { display: flex; align-items: center; }
.college-card .college-logo img {
  width: 56px !important;
  height: 56px !important;
  border-radius: 14px !important;
  border: 2px solid #e8f0fe !important;
  background: #fff !important;
  margin: 0 !important;
  padding: 0 !important;
  object-fit: cover;
  box-shadow: 0 4px 10px rgba(3, 91, 255, .1) !important;
  flex-shrink: 0;
}
.college-card .college-name {
  font-family: 'Sora', 'Nunito', sans-serif !important;
  font-weight: 800 !important;
  font-size: 0.98rem !important;
  color: #0f172a !important;
  line-height: 1.3 !important;
  letter-spacing: -0.2px !important;
  min-height: 2.5rem;
  display: flex;
  align-items: flex-start;
  margin: 0 !important;
}
.college-card .college-loc {
  font-size: 0.83rem !important;
  color: #64748b !important;
  font-weight: 600 !important;
  display: flex;
  align-items: center;
  gap: 6px;
}
.college-card .college-loc i { color: #035bff; font-size: 0.78rem; }
.college-card .college-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 8px;
}
.college-card .college-tag {
  background: #ecfdf5;
  color: #047857;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 50px;
  border: 1px solid #a7f3d0;
  letter-spacing: 0.2px;
}
.college-card .college-tag:nth-child(2n) {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

.college-card .college-actions {
  display: flex !important;
  gap: 8px !important;
  margin-top: auto !important;
  padding-top: 14px !important;
  border-top: 1px solid #f1f5f9 !important;
}
.college-card .btn-apply,
.college-card .btn-details,
#grid .card .btn-d,
#grid .card .btn-c {
  flex: 1;
  text-align: center !important;
  padding: 11px 12px !important;
  border-radius: 9px !important;
  font-weight: 800 !important;
  font-size: 0.85rem !important;
  text-decoration: none !important;
  transition: all .2s !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  font-family: 'Nunito', sans-serif !important;
  border: none !important;
  cursor: pointer !important;
}
.college-card .btn-apply,
#grid .card .btn-d {
  background: linear-gradient(135deg, #12b76a, #059669) !important;
  color: #fff !important;
  border: none !important;
  box-shadow: 0 4px 12px rgba(18, 183, 106, .25) !important;
}
.college-card .btn-apply:hover,
#grid .card .btn-d:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(18, 183, 106, .35) !important;
  color: #fff !important;
}
.college-card .btn-details {
  background: #fff !important;
  color: #035bff !important;
  border: 1.5px solid #035bff !important;
}
.college-card .btn-details:hover {
  background: #035bff !important;
  color: #fff !important;
}
#grid .card .btn-c {
  flex: 0 0 48px !important;
  background: #fff !important;
  color: #0f172a !important;
  border: 1.5px solid #e2e8f0 !important;
  font-size: 1rem !important;
}
#grid .card .btn-c:hover {
  border-color: #12b76a !important;
  background: #ecfdf5 !important;
  color: #047857 !important;
}

/* colleges.php uses a slightly different card head structure */
#grid .card .card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
#grid .card .avatar {
  width: 52px !important;
  height: 52px !important;
  border-radius: 14px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #fff !important;
  font-family: 'Sora', 'Nunito', sans-serif !important;
  font-weight: 800 !important;
  font-size: 1rem !important;
  flex-shrink: 0;
  letter-spacing: -0.5px;
}
#grid .card .card-title { flex: 1; min-width: 0; }
#grid .card .cname {
  font-family: 'Sora', 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.96rem;
  color: #0f172a;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
#grid .card .cloc {
  font-size: 0.82rem;
  color: #64748b;
  font-weight: 600;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
}
#grid .card .cloc i { color: #035bff; font-size: 0.76rem; }
#grid .card .card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}
#grid .card .badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 5px 11px;
  border-radius: 50px;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
#grid .card .actions { display: flex; gap: 6px; flex-shrink: 0; }
#grid .card.hide { display: none !important; }

/* Empty state */
.empty-state, #emptyState, #empty {
  display: none;
  text-align: center;
  padding: 60px 20px;
  color: #64748b;
}
.empty-state.on, #emptyState.on, #empty.on { display: block; }
.empty-state h3, #emptyState h3 { font-size: 1.2rem; color: #0f172a; margin-bottom: 8px; }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .courses-main, .colleges-wrap { padding: 28px 16px 36px; }
  .college-grid, #grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .college-grid .college-card,
  .courses-main .college-card,
  #grid .card {
    padding: 16px 14px 14px !important;
    gap: 8px !important;
    border-radius: 14px !important;
  }
  .college-card .college-logo img { width: 44px !important; height: 44px !important; border-radius: 11px !important; }
  .college-card .college-name { font-size: 0.85rem !important; min-height: auto; }
  .college-card .college-loc { font-size: 0.76rem !important; }
  .college-card .college-tag { font-size: 0.62rem; padding: 3px 8px; }
  .college-card .college-actions { gap: 6px !important; padding-top: 10px !important; }
  .college-card .btn-apply,
  .college-card .btn-details,
  #grid .card .btn-d {
    font-size: 0.72rem !important;
    padding: 8px 8px !important;
  }
  #grid .card .avatar { width: 40px !important; height: 40px !important; font-size: 0.78rem !important; border-radius: 10px !important; }
  #grid .card .cname { font-size: 0.84rem; }
  #grid .card .cloc { font-size: 0.74rem; }
  #grid .card .badge { font-size: 0.6rem; padding: 4px 8px; }
  #grid .card .btn-c { flex: 0 0 38px !important; font-size: 0.85rem !important; }
}
@media (max-width: 380px) {
  .college-grid, #grid { grid-template-columns: 1fr; }
}
