.td-directory-wrapper {
  --td-primary: #2c6e49;
  --td-primary-hover: #24573a;
  --td-secondary: #f4a261;
  --td-secondary-hover: #e76f51;
  --td-card: #ffffff;
  --td-bg: #f9fafb;
  --td-border: #e5e7eb;
  --td-badge-bg: #e9f5ee;
  --td-badge-text: #111827;
  --td-filter-bg: #ffffff;
  --td-filter-text: #111827;
  --td-radius-card: 12px;
  --td-radius-button: 8px;
  --td-radius-chip: 16px;
  --td-shadow-card: 0 8px 20px rgba(0, 0, 0, 0.08);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--td-filter-text);
}

.td-directory-scope {
  color: var(--td-filter-text);
}

.td-directory-shell {
  display: grid;
  gap: 20px;
  padding: 12px;
}

.td-search-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  background: #fff;
  padding: 16px;
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius-card);
  box-shadow: var(--td-shadow-card);
}

.td-search-bar input {
  padding: 10px 12px;
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius-button);
  width: 100%;
}

.td-search-input {
  flex: 1 1 240px;
}

.td-search-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.td-filter-shell {
  position: relative;
  background: var(--td-filter-bg);
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius-card);
  box-shadow: var(--td-shadow-card);
  padding: 14px;
}

.td-filter-row {
  display: grid;
  gap: 8px;
}

.td-filter-pill {
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius-chip);
  background: #fff;
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  min-width: 140px;
  text-align: left;
}

.td-pill-label {
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #6b7280;
}

.td-pill-value {
  font-weight: 600;
}

.td-popover {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 10;
  background: #fff;
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius-card);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  padding: 12px;
  margin-top: 8px;
  min-width: 280px;
}

.td-popover-options {
  max-height: 240px;
  overflow: auto;
  display: grid;
  gap: 6px;
  margin: 8px 0;
}

.td-option {
  display: flex;
  gap: 8px;
  align-items: center;
}

.td-popover-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.td-active-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.td-chip {
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius-chip);
  padding: 6px 10px;
  background: #fff;
  cursor: pointer;
}

.td-grid {
  display: grid;
  gap: 16px;
}

.td-grid[data-cols-desktop="4"] {
  grid-template-columns: repeat(4, 1fr);
}

.td-grid[data-cols-desktop="3"] {
  grid-template-columns: repeat(3, 1fr);
}

.td-grid[data-cols-desktop="2"] {
  grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 960px) {
  .td-grid[data-cols-tablet="3"] {
    grid-template-columns: repeat(3, 1fr);
  }

  .td-grid[data-cols-tablet="2"] {
    grid-template-columns: repeat(2, 1fr);
  }

  .td-grid[data-cols-tablet="1"] {
    grid-template-columns: repeat(1, 1fr);
  }
}

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

  .td-grid {
    grid-template-columns: repeat(1, 1fr) !important;
  }
}

.td-card {
  background: var(--td-card);
  border-radius: var(--td-radius-card);
  padding: 16px;
  box-shadow: var(--td-shadow-card);
  border: 1px solid var(--td-border);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.td-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
}

.td-card-image {
  width: 100%;
  border-radius: var(--td-radius-card);
  margin-bottom: 12px;
  object-fit: cover;
  max-height: 200px;
}

.td-credentials {
  color: #4b5563;
  margin: 4px 0;
}

.td-tagline {
  margin: 4px 0 10px;
  color: #111827;
}

.td-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.td-badge {
  display: inline-block;
  background: var(--td-badge-bg);
  color: var(--td-badge-text);
  padding: 4px 10px;
  border-radius: var(--td-radius-chip);
  font-size: 12px;
}

.td-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.td-button {
  border: none;
  border-radius: var(--td-radius-button);
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
}

.td-button.primary {
  background: var(--td-primary);
  color: #fff;
}

.td-button.primary:hover {
  background: var(--td-primary-hover);
}

.td-button.ghost {
  background: #fff;
  border: 1px solid var(--td-border);
  color: #111827;
  transition: background 0.15s ease, color 0.15s ease;
}

.td-pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 12px;
}

.td-pagination .td-button {
  min-width: 42px;
}

.td-empty,
.td-error {
  text-align: center;
  padding: 20px;
  background: #fff;
  border-radius: var(--td-radius-card);
  border: 1px solid var(--td-border);
}

.td-card.skeleton {
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 37%, #f3f4f6 63%);
  background-size: 400% 100%;
  animation: td-shimmer 1.4s ease infinite;
  min-height: 180px;
}

@keyframes td-shimmer {
  0% {
    background-position: 100% 0;
  }

  100% {
    background-position: -100% 0;
  }
}

/* ==========================================================================
   Testimonials Styles
   ========================================================================== */

/* Testimonials inside profile card - reset margin since card provides spacing */
.td-profile__card-body .td-testimonials {
  margin: 0;
}

.td-testimonials {
  /* Use profile CSS variables if available, with fallbacks */
  --td-testimonial-bg: var(--tdp-testimonial-bg, #f9fafb);
  --td-testimonial-border: var(--tdp-testimonial-border, #e5e7eb);
  --td-testimonial-quote: var(--tdp-testimonial-quote, var(--tdp-primary, #2c6e49));
  --td-testimonial-text: var(--tdp-testimonial-text, #374151);
  --td-testimonial-name: var(--tdp-testimonial-name, #111827);
  --td-testimonial-position: var(--tdp-testimonial-position, #6b7280);
  --td-testimonial-star: var(--tdp-testimonial-star, #fbbf24);
  --td-testimonial-star-empty: var(--tdp-testimonial-star-empty, #d1d5db);
  --td-testimonial-radius: var(--tdp-radius-sm, 8px);
  --td-testimonial-shadow: none;
  --td-testimonial-gap: 24px;
}

/* Testimonial Card */
.td-testimonial {
  background: var(--td-testimonial-bg);
  border: 1px solid var(--td-testimonial-border);
  border-radius: var(--td-testimonial-radius);
  box-shadow: var(--td-testimonial-shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.td-testimonial__quote {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--td-testimonial-text);
  position: relative;
  padding-left: 32px;
  margin-bottom: 20px;
  flex-grow: 1;
}

.td-testimonial__quote::before {
  content: '"';
  position: absolute;
  left: 0;
  top: -6px;
  font-size: 3.5rem;
  font-family: Georgia, serif;
  color: var(--td-testimonial-quote);
  opacity: 0.25;
  line-height: 1;
}

.td-testimonial__author {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--td-testimonial-border);
}

.td-testimonial__avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.td-testimonial__avatar-placeholder {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--td-testimonial-quote) 0%, rgba(44, 110, 73, 0.7) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.td-testimonial__info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.td-testimonial__name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--td-testimonial-name);
}

.td-testimonial__position {
  font-size: 0.85rem;
  color: var(--td-testimonial-position);
}

.td-testimonial__rating {
  display: flex;
  gap: 3px;
  margin-bottom: 14px;
}

.td-testimonial__star {
  color: var(--td-testimonial-star);
  font-size: 1.1rem;
}

.td-testimonial__star--empty {
  color: var(--td-testimonial-star-empty);
}

/* Grid Layouts */
.td-testimonials__grid {
  display: grid;
  gap: var(--td-testimonial-gap);
}

.td-testimonials__grid--cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.td-testimonials__grid--cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.td-testimonials__grid--cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* Responsive Grid */
@media (max-width: 1024px) {
  .td-testimonials__grid--cols-4 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {

  .td-testimonials__grid--cols-3,
  .td-testimonials__grid--cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 540px) {

  .td-testimonials__grid--cols-2,
  .td-testimonials__grid--cols-3,
  .td-testimonials__grid--cols-4 {
    grid-template-columns: 1fr;
  }
}

/* Slider Layout */
.td-testimonials__slider {
  position: relative;
  overflow: hidden;
}

.td-testimonials__track {
  display: flex;
  gap: var(--td-testimonial-gap);
  transition: transform 0.4s ease;
}

.td-testimonials__slide {
  flex: 0 0 calc((100% - var(--td-testimonial-gap) * (var(--td-slider-cols, 1) - 1)) / var(--td-slider-cols, 1));
  min-width: 0;
}

.td-testimonials__slider--cols-1 {
  --td-slider-cols: 1;
}

.td-testimonials__slider--cols-2 {
  --td-slider-cols: 2;
}

.td-testimonials__slider--cols-3 {
  --td-slider-cols: 3;
}

.td-testimonials__slider--cols-4 {
  --td-slider-cols: 4;
}

@media (max-width: 1024px) {
  .td-testimonials__slider--cols-4 {
    --td-slider-cols: 3;
  }
}

@media (max-width: 768px) {

  .td-testimonials__slider--cols-3,
  .td-testimonials__slider--cols-4 {
    --td-slider-cols: 2;
  }
}

@media (max-width: 540px) {

  .td-testimonials__slider--cols-2,
  .td-testimonials__slider--cols-3,
  .td-testimonials__slider--cols-4 {
    --td-slider-cols: 1;
  }
}

/* Slider Controls */
.td-testimonials__controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
}

.td-testimonials__arrow {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--td-testimonial-bg);
  border: 1px solid var(--td-testimonial-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.td-testimonials__arrow:hover {
  background: var(--td-primary, #2c6e49);
  border-color: var(--td-primary, #2c6e49);
  color: #fff;
}

.td-testimonials__arrow:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.td-testimonials__dots {
  display: flex;
  gap: 8px;
}

.td-testimonials__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--td-testimonial-border);
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  padding: 0;
}

.td-testimonials__dot:hover {
  transform: scale(1.2);
}

.td-testimonials__dot--active {
  background: var(--td-primary, #2c6e49);
}

/* Featured Layout */
.td-testimonials__featured {
  max-width: 800px;
  margin: 0 auto;
}

.td-testimonial--featured {
  text-align: center;
  padding: 40px 48px;
  background: linear-gradient(135deg, var(--td-testimonial-bg) 0%, #f9fafb 100%);
}

.td-testimonial--featured .td-testimonial__quote {
  font-size: 1.25rem;
  line-height: 1.75;
  padding: 0;
  margin-bottom: 28px;
}

.td-testimonial--featured .td-testimonial__quote::before {
  position: static;
  display: block;
  margin-bottom: 16px;
  font-size: 4rem;
  opacity: 0.2;
}

.td-testimonial--featured .td-testimonial__author {
  justify-content: center;
}

.td-testimonial--featured .td-testimonial__avatar,
.td-testimonial--featured .td-testimonial__avatar-placeholder {
  width: 64px;
  height: 64px;
  font-size: 1.4rem;
}

.td-testimonial--featured .td-testimonial__info {
  text-align: left;
}

.td-testimonial--featured .td-testimonial__name {
  font-size: 1.1rem;
}

.td-testimonial--featured .td-testimonial__rating {
  justify-content: center;
}

/* Featured Slider */
.td-testimonials__featured-slider .td-testimonial--featured {
  min-height: 280px;
}

/* Empty State */
.td-testimonials__empty {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
  font-style: italic;
}