/* RTL/font is set globally via base/base.html — the per-page `body { ... !important }`
   block was hostile to inner LTR contexts (forms, code blocks) and has been removed. */

.counselor-page-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Modern Header Section */
.page-header {
  background: linear-gradient(135deg, #00A693 0%, #005B5D 100%);
  color: white;
  padding: 8rem 0 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  /* min-height: 45vh pushed the first counselor card below the fold on
     mobile. Reduced to 28vh + intrinsic content height; large screens still
     get a generous hero via the 8rem top padding. */
  min-height: 28vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 768px) {
  /* Tighter hero on phones so the first card lands above the fold. */
  .page-header { min-height: auto; padding: 5rem 0 2rem; }
}

.page-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>') repeat;
  opacity: 0.3;
  z-index: 0;
}

.page-header::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(0,166,147,0.95) 0%, rgba(0,91,93,0.95) 100%);
  z-index: 1;
}

.page-header > .counselor-page-container {
  position: relative;
  z-index: 10;
}

.page-title {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  text-shadow: 0 2px 4px rgba(0,0,0,0.18);
  /* Solid white reads on the inverted teal hero; gradient-clip faded the
     title's right edge into invisibility on long Persian phrases. */
  color: #ffffff;
}

.page-subtitle {
  font-size: var(--ds-text-xl);
  opacity: 0.95;
  max-width: 700px;
  margin: 0 auto;
  font-weight: 400;
  line-height: 1.6;
}

/* Enhanced Filter Section */
.filter-section {
  background: linear-gradient(135deg, var(--ds-surface) 0%, var(--ds-surface-2) 100%);
  padding: 3rem 0;
  border-bottom: 1px solid var(--ds-line);
  box-shadow: var(--ds-shadow-sm);
}

.filter-form {
  display: flex;
  gap: 1.5rem;
  align-items: end;
  flex-wrap: wrap;
  background: white;
  padding: 2rem;
  border-radius: 20px;
  box-shadow: var(--ds-shadow-lg);
  border: 1px solid var(--ds-line);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  min-width: 200px;
}

.filter-label {
  font-size: var(--ds-text-base);
  font-weight: 700;
  color: var(--ds-ink);
}

.filter-input {
  padding: 16px 20px;
  border: 2px solid var(--ds-line);
  border-radius: 12px;
  font-size: var(--ds-text-base);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  background: white;
}

.filter-input:focus {
  outline: none;
  border-color: var(--ds-brand);
  box-shadow: 0 0 0 4px rgba(0,166,147,0.1);
  transform: translateY(-1px);
}

.filter-input::placeholder {
  color: var(--ds-muted);
}

.filter-btn {
  background: linear-gradient(135deg, var(--ds-brand) 0%, var(--ds-brand-800) 100%);
  color: white;
  border: none;
  padding: 16px 32px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: var(--ds-text-base);
  box-shadow: var(--ds-shadow-md);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  white-space: nowrap;
}

.filter-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--ds-shadow-lg);
}

.filter-btn:active {
  transform: translateY(0);
}

/* Modern Counselor Cards */
.counselors-section {
  background: var(--ds-surface-2);
  padding: 4rem 0;
}

.counselors-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
}

@media (max-width: 1400px) {
  .counselors-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1024px) {
  .counselors-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .counselors-grid {
    grid-template-columns: 1fr;
  }
}

.counselor-card {
  background: var(--ds-surface);
  border-radius: 18px;
  padding: 1.25rem;
  box-shadow: var(--ds-shadow-md);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  border: 1px solid var(--ds-line);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.counselor-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(135deg, var(--ds-brand) 0%, var(--ds-brand-800) 100%);
  transform: scaleX(0);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.counselor-card:hover::before {
  transform: scaleX(1);
  opacity: 1;
}

/* Premium tier shows at-rest accent (50% opacity), full on hover.
   Helps users scan a grid for premium counselors without hovering each. */
.counselor-card.is-premium::before {
  transform: scaleX(1);
  background: linear-gradient(135deg, var(--ds-accent, #FF8552) 0%, var(--ds-brand) 100%);
  opacity: 0.6;
}
.counselor-card.is-premium:hover::before {
  opacity: 1;
}

.counselor-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--ds-shadow-xl);
  border-color: var(--ds-brand);
  background: linear-gradient(135deg, var(--ds-surface) 0%, var(--ds-brand-50) 100%);
}

.counselor-header {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.counselor-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ds-brand) 0%, var(--ds-brand-800) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--ds-text-3xl);
  font-weight: bold;
  flex-shrink: 0;
  box-shadow: var(--ds-shadow-lg);
  border: 4px solid white;
  position: relative;
}

.counselor-avatar::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ds-brand), var(--ds-brand-800));
  z-index: -1;
}

.counselor-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  /* Near-natural — real counselor portraits must read true; trust depends on
     a clean human face. (Previously saturate(0.25) + hue-rotate(-15deg) + a
     teal multiply overlay to mask seeded solid-color avatars, which shifted
     skin tones green and made real photos look sickly.) */
  filter: saturate(0.95);
}

.counselor-avatar {
  position: relative;
  isolation: isolate;
}
.counselor-avatar > * { position: relative; z-index: 0; }

.counselor-info h3 {
  font-size: var(--ds-text-xl);
  font-weight: 800;
  color: var(--ds-ink);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.premium-badge {
  /* Amber tier marker — was --ds-success (green), which read as a generic
     verified-tick rather than a premium signal. Falls back to --ds-warning
     because that is the canonical amber in the design system. */
  color: var(--ds-warning);
  font-size: var(--ds-text-base);
  margin-right: 0.5rem;
}

.counselor-location {
  color: var(--ds-muted);
  font-size: var(--ds-text-sm);
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.counselor-location i {
  color: var(--ds-brand);
}

.counselor-bio {
  color: var(--ds-muted);
  line-height: 1.6;
  margin-bottom: 1rem;
  font-size: var(--ds-text-sm);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.counselor-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  padding-top: 1rem;
  margin-top: auto;
}

.stat-item {
  text-align: center;
  padding: 0.75rem 0.5rem;
  background: var(--ds-surface-2);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.stat-item:hover {
  background: var(--ds-brand-50);
  transform: translateY(-2px);
}

.stat-number {
  font-size: var(--ds-text-2xl);
  font-weight: 800;
  color: var(--ds-brand);
  display: block;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: var(--ds-text-sm);
  color: var(--ds-muted);
  font-weight: 600;
}

.activity-areas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.area-label {
  background: var(--ds-brand-50);
  color: var(--ds-brand);
  padding: 0.4rem 0.8rem;
  border-radius: 10px;
  font-size: var(--ds-text-sm);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
  border: 1px solid rgba(0,166,147,0.2);
}

.area-label:hover {
  background: var(--ds-brand);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--ds-shadow-md);
}

/* Card footer — single row of equal-width pill buttons.
   Was previously two separate containers stacked vertically with the primary
   action stretched to 100 % width and the secondary call/chat below it; that
   layout took twice the vertical space and the two zones competed visually. */
.counselor-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--ds-line);
  width: 100%;
  flex-wrap: nowrap;
}

.counselor-contact-buttons {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.btn {
  padding: 9px 12px;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
  font-size: var(--ds-text-sm);
  border: none;
  cursor: pointer;
  min-height: 44px;
  flex: 1 1 0;
  min-width: 0;
}
.btn > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.btn-profile {
  flex: 2 1 0;
  background: linear-gradient(135deg, var(--ds-brand) 0%, var(--ds-brand-800) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(0, 166, 147, 0.25);
}
.btn-profile:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 166, 147, 0.35);
  color: white;
  text-decoration: none;
}

.btn-call,
.btn-chat {
  background: var(--ds-brand-50, #E6F7F4);
  color: var(--ds-brand);
  border: 1px solid rgba(0, 166, 147, 0.25);
}
.btn-call:hover,
.btn-chat:hover {
  background: var(--ds-brand);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 166, 147, 0.25);
  text-decoration: none;
}

/* Enhanced No Results */
.no-results {
  text-align: center;
  padding: 6rem 2rem;
  color: var(--ds-muted);
  background: white;
  border-radius: 24px;
  box-shadow: var(--ds-shadow-md);
  margin: 2rem 0;
}

.no-results i.no-results-icon {
  font-size: 4rem;
  color: var(--ds-line);
  margin-bottom: 2rem;
  display: block;
}

.no-results h3 {
  color: var(--ds-ink);
  margin-bottom: 1.5rem;
  font-size: var(--ds-text-3xl);
  font-weight: 700;
}

.no-results p {
  font-size: var(--ds-text-lg);
  margin-bottom: 2.5rem;
  line-height: 1.6;
}

.no-results .btn {
  background: linear-gradient(135deg, var(--ds-brand) 0%, var(--ds-brand-800) 100%);
  color: white;
  padding: 1rem 2.5rem;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 700;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--ds-shadow-md);
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: var(--ds-text-base);
}

.no-results .btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--ds-shadow-lg);
  color: white;
}

/* Enhanced Active Filters */
.active-filters {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.filter-tag {
  background: var(--ds-brand-50);
  color: var(--ds-brand);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: var(--ds-text-sm);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid rgba(0,166,147,0.2);
  transition: all 0.3s ease;
}

.filter-tag:hover {
  background: var(--ds-brand);
  color: white;
}

.filter-tag .remove {
  cursor: pointer;
  font-weight: bold;
  font-size: var(--ds-text-lg);
  padding: 0.25rem;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.filter-tag .remove:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
  .page-header {
    padding: 6rem 0 3rem;
    min-height: 40vh;
  }
  
  .page-title {
    font-size: 2.5rem;
  }
  
  .page-subtitle {
    font-size: var(--ds-text-lg);
  }
  
  .filter-form {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    padding: 1.5rem;
  }
  
  .filter-group {
    min-width: auto;
  }
  
  .counselor-card {
    padding: 1.5rem;
    min-height: 450px;
  }
  
  .counselor-header {
    gap: 1rem;
  }
  
  .counselor-avatar {
    width: 70px;
    height: 70px;
    font-size: var(--ds-text-2xl);
  }
  
  .counselor-info h3 {
    font-size: var(--ds-text-lg);
  }
  
  .counselor-location {
    font-size: var(--ds-text-sm);
  }
  
  .counselor-page-container {
    padding: 0 1rem;
  }
}

@media (max-width: 480px) {
  .page-header {
    padding: 5rem 0 2.5rem;
    min-height: 35vh;
  }
  
  .page-title {
    font-size: var(--ds-text-2xl);
    margin-bottom: 1rem;
  }
  
  .page-subtitle {
    font-size: var(--ds-text-base);
    padding: 0 1rem;
  }
  
  .counselors-section {
    padding: 2.5rem 0;
  }
  
  .counselor-card {
    border-radius: 20px;
    padding: 1.25rem;
    /* Dropped min-height: 420px — left empty whitespace below cards
       whose counselor has no bio. Cards now size to content on mobile. */
  }
  
  .counselor-header {
    gap: 0.75rem;
  }
  
  .counselor-avatar {
    width: 60px;
    height: 60px;
    font-size: var(--ds-text-2xl);
  }
  
  .counselor-info h3 {
    font-size: var(--ds-text-base);
  }
  
  .counselor-location {
    font-size: var(--ds-text-sm);
  }
  
  .filter-form {
    padding: 1.25rem;
    border-radius: 16px;
  }
  
  .filter-input {
    padding: 14px 18px;
    font-size: var(--ds-text-base);
  }
  
  .filter-btn {
    padding: 14px 28px;
    font-size: var(--ds-text-base);
  }
  
  .counselor-page-container {
    padding: 0 0.75rem;
  }
  
  .stat-number {
    font-size: var(--ds-text-xl);
  }
  
  .stat-label {
    font-size: var(--ds-text-sm);
  }
  
  .btn {
    font-size: var(--ds-text-sm);
    padding: 8px 12px;
    min-height: 44px;
  }
}

/* Loading Animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.page-header {
  animation: fadeIn 0.5s ease-out;
}

.filter-section {
  animation: fadeInUp 0.6s ease-out 0.1s backwards;
}

.counselor-card {
  animation: fadeInUp 0.5s ease-out backwards;
}

.counselor-card:nth-child(1) { animation-delay: 0.05s; }
.counselor-card:nth-child(2) { animation-delay: 0.1s; }
.counselor-card:nth-child(3) { animation-delay: 0.15s; }
.counselor-card:nth-child(4) { animation-delay: 0.2s; }
.counselor-card:nth-child(5) { animation-delay: 0.25s; }
.counselor-card:nth-child(6) { animation-delay: 0.3s; }
.counselor-card:nth-child(7) { animation-delay: 0.35s; }
.counselor-card:nth-child(8) { animation-delay: 0.4s; }
.counselor-card:nth-child(9) { animation-delay: 0.45s; }

/* Utility Classes for Icons */
.fas, .far {
  display: inline-block !important;
  font-style: normal !important;
  font-variant: normal !important;
  text-rendering: auto !important;
  -webkit-font-smoothing: antialiased !important;
}

/* Ensure all text is visible */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

select.filter-input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: 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='%2364748b' d='M6 8L0 2h12L6 8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 20px center;
  padding-left: 50px;
  cursor: pointer;
}
