/* ========== Counsellor Finder Styling ========== */
#counsellor-finder {
  max-width: 1200px;
  margin: 0 auto;
  font-family: "Inter", "Segoe UI", sans-serif;
  padding: 40px 20px;
  color: #333;
}

/* --- Filter bar --- */
#counsellor-finder .filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

/* --- Active Filters Bar --- */
#cf-active-filters {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 12px 20px;
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.cf-active-label {
  font-size: 14px;
  font-weight: 600;
  color: #666;
}

.cf-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cf-tag {
  background: #eef2ff;
  color: #4338ca;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cf-remove-tag {
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.cf-remove-tag:hover {
  opacity: 1;
}

#counsellor-finder .filters label {
  display: flex;
  flex-direction: column;
  font-weight: 500;
  color: var(--cf-filter-label);
  font-size: 14px;
}

#counsellor-finder .filters select {
  margin-top: 6px;
  padding: 10px 14px;
  border: 1px solid #ccc;
  border-radius: 10px;
  min-width: 180px;
  font-size: 14px;
  background-color: var(--cf-filter-sel-bg);
  color: var(--cf-filter-sel-txt);
  transition: border-color 0.2s, box-shadow 0.2s;
}

#counsellor-finder .filters select:focus {
  outline: none;
  border-color: var(--cf-secondary);
  box-shadow: 0 0 0 2px rgba(var(--cf-secondary-rgb, 168, 150, 199), 0.25);
}

/* --- Clear Filters Button --- */
#cf-clear-filters {
  background-color: var(--cf-primary);
  color: var(--cf-btn-text);
  padding: 10px 22px;
  border: none;
  border-radius: 50px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  margin-top: 0;
  line-height: 1.2;
  position: relative;
  top: -10px !important;
}

#cf-clear-filters:hover {
  filter: brightness(0.9);
  transform: translateY(-1px);
}

/* --- Counsellor Grid --- */
.counsellor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 30px;
}

/* Force 3 columns on Desktop */
@media (min-width: 1025px) {
  .counsellor-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

/* --- Individual Card --- */
.counsellor-card {
  background: var(--cf-card-bg);
  border: 1px solid #e2e2e2;
  border-radius: 16px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}

.counsellor-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

/* --- Image (perfect 1:1 ratio) --- */
.counsellor-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  /* keeps it square */
  object-fit: cover;
  display: block;
}

.counsellor-card-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.counsellor-card h3 {
  font-size: 18px;
  margin: 16px 20px 12px;
  color: var(--cf-card-title);
  font-weight: 700;
}

.counsellor-card h3 sub {
  font-size: 0.7em;
  color: var(--cf-card-text);
  margin-left: 4px;
}

.counsellor-card .cf-degree {
  margin: -4px 20px 12px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--cf-card-text);
}

.cf-info-section {
  background: #f4f7f9;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 0 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cf-info-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: #4a5568;
  line-height: 1.4;
}

.cf-icon {
  display: flex;
  align-items: center;
  margin-top: 2px;
  color: #718096;
  flex-shrink: 0;
}

.counsellor-card p {
  margin: 0 20px 10px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--cf-card-text);
}

.counsellor-card strong {
  color: var(--cf-card-title);
}

/* --- Buttons (pill style, vertically centered) --- */
.counsellor-card .counsellor-actions {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 20px 20px;
}

.counsellor-card .btn {
  flex: 1;
  text-align: center;
  text-decoration: none;
  border-radius: 50px;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  /* vertically centers text */
}

.counsellor-card .btn.secondary {
  background-color: transparent;
  border: 2px solid var(--cf-primary);
  color: var(--cf-secondary);
}

.counsellor-card .btn.secondary:hover {
  background-color: rgba(var(--cf-primary-rgb, 181, 169, 199), 0.1);
}

.counsellor-card .btn {
  background-color: var(--cf-primary);
  color: #fff;
}

.counsellor-card .btn:hover {
  filter: brightness(0.9);
}

/* --- Responsive Filters --- */
@media (max-width: 768px) {
  #counsellor-finder {
    padding: 30px 15px;
  }

  #counsellor-finder .filters {
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
  }

  #counsellor-finder .filters label {
    width: 100%;
  }

  #counsellor-finder .filters select {
    width: 100%;
    min-width: unset;
  }

  #cf-clear-filters {
    width: 100%;
    margin-top: 8px;
  }

  .counsellor-grid {
    grid-template-columns: 1fr;
  }
}

/* ========== Mobile Filter Side Panel ========== */
.cf-mobile-filter-toggle {
  display: none;
  margin-bottom: 24px;
}

.cf-filter-mobile-header {
  display: none;
}

@media (max-width: 768px) {
  .cf-mobile-filter-toggle {
    display: block;
  }

  .cf-mobile-filter-toggle .btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--cf-primary);
    color: var(--cf-btn-text);
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }

  #counsellor-finder .filters {
    position: fixed;
    top: 0;
    left: -100%;
    /* Start off-screen */
    width: 85%;
    max-width: 320px;
    height: 100vh;
    background: #fff;
    z-index: 100001;
    padding: 30px 20px;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.15);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 0 !important;
    border-radius: 0 20px 20px 0;
  }

  #counsellor-finder .filters.active {
    left: 0;
  }

  .cf-filter-mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
  }

  .cf-filter-mobile-header h3 {
    margin: 0;
    font-size: 20px;
    color: #333;
    font-weight: 700;
  }

  #cf-close-filters {
    background: #f5f5f5;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: background 0.2s;
  }

  #cf-close-filters:hover {
    background: #eeeeee;
    color: #000;
  }

  #counsellor-finder .filters label {
    margin-bottom: 20px;
  }

  #cf-clear-filters {
    top: 0 !important;
    margin-top: 10px !important;
    width: 100%;
    border-radius: 12px;
  }

  /* Overlay */
  .cf-filter-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 100000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .cf-filter-overlay.active {
    display: block;
    opacity: 1;
  }
}

/* ========= Modal Styles (Centered Fix) ========= */
.cf-modal {
  position: fixed;
  inset: 0;
  /* shorthand for top:0; right:0; bottom:0; left:0 */
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
  overflow-y: auto;
}

.cf-modal-content {
  background: #fff;
  border-radius: 16px;
  max-width: 800px;
  width: 100%;
  padding: 30px;
  position: relative;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  animation: cfModalFadeIn 0.25s ease-out;
  transform: translateY(0);
  max-height: 90vh;
  overflow-y: auto;
}

/* Smooth fade-in animation */
@keyframes cfModalFadeIn {
  from {
    transform: translateY(-10px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Close button */
.cf-modal-close {
  position: absolute;
  top: 12px;
  right: 18px;
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: #666;
}

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

.cf-modal-body h2 {
  margin-top: 0;
  font-size: 24px;
}

/* --- Side Panel Layout --- */
.cf-side-layout {
  display: flex !important;
  flex-direction: row !important;
  gap: 40px !important;
  align-items: flex-start !important;
}

.cf-side-layout .filters {
  flex: 0 0 280px !important;
  flex-direction: column !important;
  align-items: stretch !important;
  margin-bottom: 0 !important;
  position: sticky;
  top: 40px;
}

.cf-side-layout .cf-main-content {
  flex: 1 !important;
}

@media (max-width: 900px) {
  .cf-side-layout {
    flex-direction: column !important;
  }

  .cf-side-layout .filters {
    flex: none !important;
    position: static;
    width: 100%;
  }
}

.cf-bio-content p {
  line-height: 1.6;
}
