/* ──────────────────────────────────────────────────
   Directory Layout (sidebar + main)
────────────────────────────────────────────────── */

.directory-layout {
  display: flex;
  align-items: flex-start;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
  gap: 2.5rem;
}

/* ──────────────────────────────────────────────────
   Filter Panel — desktop sidebar
────────────────────────────────────────────────── */

.filter-panel {
  width: 248px;
  flex-shrink: 0;
  position: sticky;
  top: 5.5rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  background: var(--warm-white);
  border: 1px solid var(--green-200);
  border-radius: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--green-200) transparent;
}

.filter-panel::-webkit-scrollbar {
  width: 4px;
}
.filter-panel::-webkit-scrollbar-track { background: transparent; }
.filter-panel::-webkit-scrollbar-thumb { background: var(--green-200); border-radius: 4px; }

.filter-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.25rem 0.9rem;
  border-bottom: 1px solid var(--green-100);
  position: sticky;
  top: 0;
  background: var(--warm-white);
  z-index: 2;
  border-radius: 16px 16px 0 0;
}

.filter-panel-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--green-900);
  letter-spacing: -0.01em;
}

.filter-panel-title svg {
  color: var(--green-600);
}

.filter-panel-close {
  display: none; /* hidden on desktop */
  background: none;
  border: none;
  font-size: 1.15rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  line-height: 1;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.filter-panel-close:hover {
  color: var(--green-800);
  background: var(--green-50);
}

.filter-panel-body {
  padding: 0.5rem 1.25rem 1.25rem;
}

/* ── Filter Section ── */
.filter-section {
  border-bottom: 1px solid var(--green-100);
}

.filter-section:last-of-type {
  border-bottom: none;
}

.filter-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  padding: 1rem 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.855rem;
  font-weight: 600;
  color: var(--green-800);
  letter-spacing: -0.01em;
  transition: color 0.15s;
}

.filter-section-toggle:hover {
  color: var(--green-600);
}

.toggle-chevron {
  flex-shrink: 0;
  transition: transform 0.2s ease;
  color: var(--green-500);
}

.filter-section.collapsed .toggle-chevron {
  transform: rotate(-90deg);
}

.filter-section-body {
  padding-bottom: 1rem;
}

.filter-section.collapsed .filter-section-body {
  display: none;
}

/* ── Checkbox labels ── */
.filter-check-label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0;
  cursor: pointer;
  user-select: none;
}

.filter-check-label:hover .check-text {
  color: var(--green-700);
}

.filter-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.check-box {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  border: 1.5px solid var(--green-300);
  border-radius: 4px;
  background: var(--warm-white);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  position: relative;
}

.filter-check-label:hover .check-box {
  border-color: var(--green-500);
}

.filter-checkbox:checked + .check-box {
  background: var(--green-700);
  border-color: var(--green-700);
}

.filter-checkbox:checked + .check-box::after {
  content: '';
  display: block;
  width: 5px;
  height: 9px;
  border: 2px solid white;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translateY(-1px);
}

.check-text {
  font-size: 0.84rem;
  color: var(--text-secondary);
  transition: color 0.15s;
  line-height: 1.3;
}

/* ── Country select ── */
.filter-select {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--green-200);
  border-radius: 9px;
  font-family: inherit;
  font-size: 0.84rem;
  color: var(--text-primary);
  background: var(--warm-white);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a9488' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 16px;
  padding-right: 2rem;
  transition: border-color 0.15s;
}

.filter-select:focus {
  outline: none;
  border-color: var(--green-400);
  box-shadow: 0 0 0 3px rgba(63, 145, 100, 0.08);
}

/* ── Clear all button ── */
.filter-actions {
  padding-top: 1.25rem;
}

.filter-clear-btn {
  display: block;
  width: 100%;
  padding: 0.6rem;
  background: none;
  border: 1px solid var(--green-200);
  border-radius: 9px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.filter-clear-btn:hover {
  background: var(--green-50);
  border-color: var(--green-400);
  color: var(--green-700);
}

/* ── Backdrop (mobile only) ── */
.filter-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 199;
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.25s;
}

.filter-backdrop.show {
  display: block;
  opacity: 1;
}

/* ──────────────────────────────────────────────────
   Main Content Area
────────────────────────────────────────────────── */

.directory-main {
  flex: 1;
  min-width: 0;
}

/* ── Toolbar ── */
.directory-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--green-100);
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* ── Filter toggle button (for mobile / also shown on desktop to open drawer) ── */
.filter-toggle-btn {
  display: none; /* hidden on desktop — sidebar is always visible */
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  background: var(--warm-white);
  border: 1px solid var(--green-200);
  border-radius: 100px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--green-800);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s;
}

.filter-toggle-btn:hover,
.filter-toggle-btn.has-filters {
  background: var(--green-100);
  border-color: var(--green-400);
  color: var(--green-700);
}

.filter-badge {
  min-width: 18px;
  height: 18px;
  background: var(--green-700);
  color: white;
  border-radius: 10px;
  font-size: 0.68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ── Category quick pills ── */
.category-pills {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  padding-bottom: 2px; /* prevent clipping */
}

.category-pills::-webkit-scrollbar {
  display: none;
}

.cat-pill {
  padding: 0.42rem 0.9rem;
  background: var(--warm-white);
  border: 1px solid var(--green-200);
  border-radius: 100px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}

.cat-pill:hover {
  background: var(--green-50);
  border-color: var(--green-400);
  color: var(--green-700);
}

.cat-pill.active {
  background: var(--green-700);
  border-color: var(--green-700);
  color: white;
  font-weight: 600;
}

/* ── Sort select ── */
.sort-select {
  padding: 0.45rem 1.8rem 0.45rem 0.75rem;
  background: var(--warm-white);
  border: 1px solid var(--green-200);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--green-800);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a9488' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 14px;
  transition: border-color 0.15s;
}

.sort-select:focus {
  outline: none;
  border-color: var(--green-400);
}

/* ── Result info ── */
.result-info {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ──────────────────────────────────────────────────
   Certification Badges on Brand Cards
────────────────────────────────────────────────── */

.brand-cert-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.75rem;
}

.cert-badge {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.18rem 0.55rem;
  background: var(--green-50);
  border: 1px solid var(--green-200);
  border-radius: 4px;
  color: var(--green-600);
  line-height: 1.4;
}

/* Certification chip in active-filters area */
.active-filter.cert-chip {
  background: var(--green-100);
  border-color: var(--green-400);
}

/* ── Clear btn in empty state ── */
.clear-btn {
  display: inline-flex;
  margin-top: 1rem;
  padding: 0.6rem 1.4rem;
  background: var(--green-700);
  color: white;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.clear-btn:hover {
  background: var(--green-800);
}

/* ──────────────────────────────────────────────────
   Mobile — Filter drawer
────────────────────────────────────────────────── */

@media (max-width: 900px) {
  /* Layout becomes single column */
  .directory-layout {
    display: block;
    padding: 0 1.25rem 3rem;
  }

  /* Filter panel becomes off-canvas drawer */
  .filter-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(320px, 88vw);
    max-height: 100vh;
    border-radius: 0 16px 16px 0;
    border-top: none;
    border-left: none;
    border-bottom: none;
    border-right: 1px solid var(--green-200);
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
    box-shadow: 4px 0 32px rgba(26, 58, 42, 0.12);
  }

  .filter-panel.open {
    transform: translateX(0);
  }

  /* Show close button on mobile */
  .filter-panel-close {
    display: flex;
  }

  /* Show filter toggle button on mobile */
  .filter-toggle-btn {
    display: flex;
  }

  /* Toolbar adjustments */
  .directory-toolbar {
    gap: 0.5rem;
  }

  .toolbar-left {
    overflow: hidden;
  }

  .category-pills {
    padding: 2px 0;
  }

  .sort-select {
    font-size: 0.78rem;
  }

  .result-info {
    display: none; /* Less clutter on mobile */
  }
}

@media (max-width: 600px) {
  .directory-toolbar {
    flex-wrap: nowrap;
  }

  .toolbar-right {
    gap: 0.4rem;
  }
}
