/* ==========================================================================
   FUNDIMTAANI — FUNDIS DIRECTORY REDESIGN (v2)
   Hero search band + sidebar filters + cover cards
   Palette: Deep Forest Green (#0F4C3A) & Ochre Amber (#D97706)
   ========================================================================== */

/* ---------- Hero band ---------- */
.fundi-hero {
  background:
    radial-gradient(900px 320px at 12% -40%, rgba(217, 119, 6, 0.28), transparent 60%),
    radial-gradient(700px 300px at 95% 120%, rgba(16, 185, 129, 0.22), transparent 60%),
    linear-gradient(135deg, #0A3327 0%, #0F4C3A 55%, #14573F 100%);
  color: #fff;
  border-radius: 0 0 28px 28px;
  position: relative;
  overflow: hidden;
}
.fundi-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
}
.fundi-hero .container { position: relative; z-index: 1; }
.fundi-hero h1 { color: #fff; letter-spacing: -0.02em; }
.fundi-hero .lead { color: rgba(255, 255, 255, 0.78); }
.fundi-hero .breadcrumb { --bs-breadcrumb-divider-color: rgba(255,255,255,.5); }
.fundi-hero .breadcrumb-item a { color: #FCD34D; text-decoration: none; }
.fundi-hero .breadcrumb-item.active { color: rgba(255, 255, 255, 0.75); }

.hero-search {
  background: #fff;
  border-radius: 9999px;
  padding: 6px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.25);
  max-width: 760px;
}
.hero-search .form-control,
.hero-search .form-select {
  border: 0;
  background: transparent;
  box-shadow: none !important;
  font-size: 0.95rem;
}
.hero-search .form-control:focus,
.hero-search .form-select:focus { background: transparent; }

/* The hero search is a borderless pill: its fields stay transparent in
   every state, so the dark-theme field tint (#192C26) and the teal focus
   ring never show as a mismatched patch. */
[data-theme="dark"] .hero-search .form-control,
[data-theme="dark"] .hero-search .form-select,
[data-theme="dark"] .hero-search .form-control:focus,
[data-theme="dark"] .hero-search .form-select:focus,
.hero-search .form-control:focus,
.hero-search .form-select:focus {
  background-color: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  outline: none !important;
}

/* Dark mode: the native dropdown list pops up with a light surface while
   options inherit the theme's light text, rendering them unreadable.
   Give the options an explicit dark surface + light text. */
[data-theme="dark"] .hero-search .form-select option {
  background-color: #1E293B;
  color: #F1F5F9;
}
.hero-search .search-divider {
  width: 1px;
  align-self: stretch;
  background: var(--border-subtle);
  margin: 8px 0;
}
.hero-search .btn-hero-search {
  border-radius: 9999px;
  padding: 0.7rem 1.6rem;
  font-weight: 700;
  background: var(--brand-accent);
  border: 0;
  color: #1a1207;
  white-space: nowrap;
}
.hero-search .btn-hero-search:hover { background: var(--brand-accent-hover); color: #fff; }

.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(4px);
  transition: all 0.18s ease;
}
.hero-chip:hover {
  background: var(--brand-accent);
  border-color: var(--brand-accent);
  color: #1a1207;
  transform: translateY(-1px);
}

.hero-stats { display: flex; gap: 26px; flex-wrap: wrap; }
.hero-stat { display: flex; align-items: center; gap: 10px; }
.hero-stat .stat-ico {
  width: 38px; height: 38px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.12);
  color: #FCD34D;
  flex-shrink: 0;
}
.hero-stat strong { display: block; font-size: 1.02rem; line-height: 1.1; color: #fff; }
.hero-stat span { font-size: 0.76rem; color: rgba(255, 255, 255, 0.65); }

/* ---------- Layout ---------- */
.fundi-layout { display: flex; gap: 22px; align-items: flex-start; }

.fundi-sidebar {
  width: 264px;
  flex-shrink: 0;
  position: sticky;
  top: 86px;
}
.filter-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.filter-card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: space-between;
}
.filter-card-head h2 { font-size: 0.95rem; font-weight: 800; margin: 0; color: var(--ink-heading); }
.filter-clear { font-size: 0.78rem; font-weight: 700; color: var(--color-danger); text-decoration: none; }
.filter-clear:hover { text-decoration: underline; }
.filter-section { padding: 14px 18px; border-bottom: 1px solid var(--border-subtle); }
.filter-section:last-child { border-bottom: 0; }
.filter-section > h3 {
  font-size: 0.72rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-muted); margin: 0 0 10px;
}
.filter-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.88rem; font-weight: 600; color: var(--ink-body);
  transition: background 0.15s ease;
  margin: 0 -10px;
}
.filter-opt:hover { background: var(--surface-subtle); }
.filter-opt input { accent-color: var(--brand-primary); width: 16px; height: 16px; flex-shrink: 0; }
.filter-opt .opt-ico {
  width: 30px; height: 30px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-primary-light); color: var(--brand-primary);
  flex-shrink: 0;
}
.filter-opt input:checked ~ .opt-label { color: var(--brand-primary); font-weight: 700; }
.filter-opt.is-checked { background: var(--brand-primary-light); }

/* ---------- Results toolbar ---------- */
.results-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.results-count { font-size: 0.92rem; color: var(--ink-muted); }
.results-count strong { color: var(--ink-heading); font-size: 1.05rem; }
.toolbar-right { display: flex; align-items: center; gap: 10px; }
.sort-select {
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  font-size: 0.85rem; font-weight: 600;
  background: var(--surface-card); color: var(--ink-body);
  cursor: pointer;
}
.btn-filters-mobile {
  display: none;
  align-items: center; gap: 8px;
  border: 1px solid var(--border-medium);
  background: var(--surface-card); color: var(--ink-body);
  border-radius: var(--radius-pill);
  padding: 8px 16px; font-weight: 700; font-size: 0.85rem;
}

/* ---------- Fundi cards ---------- */
.fundi-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 100%;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.fundi-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }

.fundi-cover {
  height: 108px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.fundi-cover-icon {
  position: absolute;
  right: -14px; bottom: -22px;
  color: rgba(255, 255, 255, 0.22);
  transform: rotate(-12deg);
  transition: transform 0.25s ease;
}
.fundi-card:hover .fundi-cover-icon { transform: rotate(-6deg) scale(1.08); }
.cover-p0 { background: linear-gradient(120deg, #0F4C3A, #10B981); }
.cover-p1 { background: linear-gradient(120deg, #B45309, #F59E0B); }
.cover-p2 { background: linear-gradient(120deg, #1D4ED8, #3B82F6); }
.cover-p3 { background: linear-gradient(120deg, #6D28D9, #A78BFA); }
.cover-p4 { background: linear-gradient(120deg, #BE123C, #F43F5E); }
.cover-p5 { background: linear-gradient(120deg, #0F766E, #14B8A6); }
.cover-p6 { background: linear-gradient(120deg, #C2410C, #FB923C); }
.cover-p7 { background: linear-gradient(120deg, #4338CA, #818CF8); }

.fundi-cover-top {
  position: absolute; top: 10px; left: 12px; right: 12px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
}
.fundi-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255, 255, 255, 0.94);
  color: #0F4C3A;
  font-size: 0.7rem; font-weight: 800;
  padding: 5px 11px; border-radius: 9999px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.fundi-badge-pro { background: #0F4C3A; color: #FCD34D; }
.fundi-fav {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.94);
  color: #64748B;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  transition: transform 0.15s ease, color 0.15s ease;
}
.fundi-fav:hover { transform: scale(1.1); color: #DC2626; }
.fundi-fav.is-active { color: #DC2626; }
.fundi-flag {
  position: absolute; right: 12px; bottom: 10px;
  font-size: 0.68rem; font-weight: 800;
  padding: 4px 10px; border-radius: 9999px;
  color: #fff;
}
.flag-danger { background: #DC2626; }
.flag-success { background: #16A34A; }

.fundi-body { padding: 0 18px 18px; display: flex; flex-direction: column; flex: 1; }
.fundi-id { display: flex; gap: 12px; margin-bottom: 10px; align-items: center; }
.fundi-avatar {
  margin-top: -26px;
  width: 56px; height: 56px;
  border-radius: 18px;
  background: #0F4C3A; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.15rem;
  border: 3px solid var(--surface-card);
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
  position: relative; z-index: 2;}
.fundi-name {
  font-size: 1.02rem; font-weight: 800; margin: 0 0 6px;
  color: var(--ink-heading);
  display: flex; align-items: center; gap: 6px;
}
.fundi-name .verified-tick { color: var(--brand-primary); flex-shrink: 0; }
.fundi-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.fundi-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.72rem; font-weight: 700;
  padding: 4px 10px; border-radius: 9999px;
  background: var(--surface-subtle); color: var(--ink-body);
  border: 1px solid var(--border-subtle);
}
.fundi-chip.trade { background: var(--brand-primary-light); color: var(--brand-primary); border-color: var(--brand-primary-border); }

.fundi-rating {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.83rem; margin-bottom: 10px; flex-wrap: wrap;
}
.rating-stars-gold { color: #F59E0B; display: inline-flex; gap: 1px; }
.fundi-rating strong { color: var(--ink-heading); }
.fundi-rating .rcount { color: var(--ink-muted); }
.fundi-exp { margin-left: auto; color: var(--ink-muted); font-size: 0.78rem; display: inline-flex; align-items: center; gap: 4px; }

.fundi-bio {
  font-size: 0.85rem; color: var(--ink-muted); line-height: 1.55;
  margin: 0 0 14px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

.fundi-foot {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  padding-top: 14px;
}
.fundi-rate {
  display: flex; align-items: center; gap: 7px;
  font-weight: 800; font-size: 0.92rem; color: var(--ink-heading);
  margin-bottom: 12px;
}
.fundi-rate-text { min-width: 0; }
.fundi-rate svg { color: var(--brand-accent); }
.fundi-actions { display: flex; gap: 8px; }
.btn-view-profile {
  flex: 1;
  background: var(--brand-primary);
  color: #fff !important;
  border: 0; border-radius: var(--radius-md);
  font-weight: 700; font-size: 0.86rem;
  padding: 10px 12px;
  text-align: center; text-decoration: none;
  transition: background 0.15s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-view-profile:hover { background: var(--brand-primary-hover); color: #fff !important; }
.btn-book {
  background: transparent;
  color: var(--brand-primary) !important;
  border: 1.5px solid var(--brand-primary);
  border-radius: var(--radius-md);
  font-weight: 700; font-size: 0.86rem;
  padding: 10px 12px;
  text-align: center; text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-book:hover { background: var(--brand-primary); color: #fff !important; }
.btn-wa {
  width: 44px; height: 42px; flex-shrink: 0;
  border-radius: var(--radius-md);
  background: var(--brand-whatsapp);
  color: #fff !important;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease;
}
.btn-wa:hover { background: var(--brand-whatsapp-hover); transform: scale(1.05); }

/* ---------- Empty state ---------- */
.fundi-empty {
  background: var(--surface-card);
  border: 1px dashed var(--border-medium);
  border-radius: var(--radius-xl);
  padding: 56px 24px;
  text-align: center;
}
.fundi-empty .empty-ico {
  width: 76px; height: 76px; border-radius: 24px;
  background: var(--brand-primary-light); color: var(--brand-primary);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 18px;
}
.fundi-empty h3 { font-weight: 800; color: var(--ink-heading); margin-bottom: 8px; }
.fundi-empty p { color: var(--ink-muted); max-width: 440px; margin: 0 auto 22px; font-size: 0.92rem; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
  .fundi-sidebar { display: none; }
  .btn-filters-mobile { display: inline-flex; }
  .fundi-results { width: 100%; }
}
@media (max-width: 575.98px) {
  .hero-search { border-radius: 18px; }
  .hero-search .search-divider { display: none; }
  .hero-search .btn-hero-search { width: 100%; margin-top: 6px; }
  .fundi-hero { border-radius: 0 0 20px 20px; }
}

/* ---------- Dark mode ---------- */
[data-theme="dark"] .hero-search { background: #1E293B; box-shadow: 0 14px 34px rgba(0,0,0,0.5); }
[data-theme="dark"] .hero-search .form-control,
[data-theme="dark"] .hero-search .form-select { color: #F1F5F9; }
[data-theme="dark"] .hero-search .form-control::placeholder { color: #94A3B8; }
[data-theme="dark"] .hero-search .search-divider { background: #334155; }
[data-theme="dark"] .fundi-fav { background: #1E293B; color: #94A3B8; }
[data-theme="dark"] .fundi-fav.is-active { color: #F87171; }
[data-theme="dark"] .fundi-avatar { border-color: #1E293B; }
[data-theme="dark"] .fundi-badge { background: rgba(30, 41, 59, 0.95); color: #FCD34D; }
[data-theme="dark"] .fundi-badge-pro { background: #FCD34D; color: #1a1207; }
[data-theme="dark"] .sort-select { background: #1E293B; border-color: #334155; color: #E2E8F0; }
[data-theme="dark"] .btn-filters-mobile { background: #1E293B; border-color: #334155; color: #E2E8F0; }
[data-theme="dark"] .filter-opt:hover { background: #1E293B; }
[data-theme="dark"] .fundi-chip { background: #1E293B; border-color: #334155; color: #CBD5E1; }

/* ---------- AJAX transitions & entrance animations ---------- */
@keyframes fundi-card-in {
  from { opacity: 0; transform: translateY(16px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.fundi-card {
  animation: fundi-card-in 0.5s cubic-bezier(0.22, 0.61, 0.36, 1) backwards;
}
#fundis-results { transition: opacity 0.2s ease; }
#fundis-results.is-loading { opacity: 0.35; pointer-events: none; }
#fundis-results.is-swapping { opacity: 0; }
.hero-chip.active {
  background: var(--brand-accent);
  border-color: var(--brand-accent);
  color: #1a1207;
}
@media (prefers-reduced-motion: reduce) {
  .fundi-card { animation: none; }
  #fundis-results { transition: none; }
}

/* ---------- Live search suggestions ---------- */
.search-suggest-wrap {
  position: relative;
}
.search-suggest {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.25);
  z-index: 70;
  text-align: left;
  max-height: 340px;
  overflow-y: auto;
  padding: 6px;
}
.ss-group {
  padding: 8px 12px 4px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 700;
  color: #6b7280;
}
.ss-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 9px;
  padding: 8px 12px;
  cursor: pointer;
  color: inherit;
}
.ss-item:hover,
.ss-item.active {
  background: rgba(16, 185, 129, 0.1);
}
.ss-item-main {
  font-weight: 600;
  font-size: 0.92rem;
  color: #111827;
}
.ss-item-sub {
  font-size: 0.78rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-theme="dark"] .search-suggest {
  background: #1e293b;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.6);
}
[data-theme="dark"] .ss-group {
  color: #94a3b8;
}
[data-theme="dark"] .ss-item-main {
  color: #f1f5f9;
}
[data-theme="dark"] .ss-item-sub {
  color: #94a3b8;
}
[data-theme="dark"] .ss-item:hover,
[data-theme="dark"] .ss-item.active {
  background: rgba(16, 185, 129, 0.16);
}

.fundi-chips-under { margin: 0 0 10px; padding-left: calc(56px + 12px); }

/* Scrollable filter options with auto-hiding scrollbars (admin style, 5px) */
:root {
  --scroll-thumb: rgba(15, 76, 58, .28);
  --scroll-thumb-hover: rgba(15, 76, 58, .5);
}
[data-theme="dark"] {
  --scroll-thumb: rgba(16, 185, 129, .32);
  --scroll-thumb-hover: rgba(16, 185, 129, .55);
}
.filter-opts-scroll {
  max-height: 240px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  padding-right: 4px;
}
.filter-opts-scroll:hover {
  scrollbar-color: var(--scroll-thumb) transparent;
}
.filter-opts-scroll::-webkit-scrollbar { width: 5px; }
.filter-opts-scroll::-webkit-scrollbar-track,
.filter-opts-scroll::-webkit-scrollbar-corner { background: transparent; }
.filter-opts-scroll::-webkit-scrollbar-thumb { background: transparent; border-radius: 9999px; }
.filter-opts-scroll:hover::-webkit-scrollbar-thumb { background: var(--scroll-thumb); }
html.is-scrolling .filter-opts-scroll { scrollbar-color: var(--scroll-thumb) transparent; }
html.is-scrolling .filter-opts-scroll::-webkit-scrollbar-thumb { background: var(--scroll-thumb); }
.filter-opts-scroll::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover) !important; }

/* Selected filter option: subtle tint, not a solid fill */
.filter-opt.is-checked { background: rgba(15, 76, 58, 0.08); }
[data-theme="dark"] .filter-opt.is-checked { background: rgba(16, 185, 129, 0.13); }

/* Collapsible filter sections */
.filter-section > h3 { margin: 0 0 10px; }
.filter-sec-toggle {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  background: none; border: 0; padding: 0; cursor: pointer;
  font-size: 0.72rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-muted);
}
.filter-chev {
  width: 8px; height: 8px; flex-shrink: 0;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px); transition: transform 0.2s ease;
}
.filter-section:not(.is-open) .filter-chev { transform: rotate(-45deg); }
.filter-section:not(.is-open) .filter-sec-body { display: none; }
