/* ============================================================
   Directory page — additional styles
   Extends ../styles.css (tokens + shared components)
   ============================================================ */

/* Active nav link */
.site-nav a.active,
.mobile-nav a.active {
  color: var(--yqg-primary);
  font-weight: var(--yqg-w-semibold);
}

/* Screen-reader only */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ---- Category page hero ---- */
.cat-page-hero {
  background: var(--yqg-primary);
  padding: 48px var(--yqg-pad-x) 44px;
  text-align: center;
  position: relative;
}
.cat-page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--yqg-overlay);
}
.cat-page-hero .container { position: relative; z-index: 1; }
.cat-breadcrumb {
  margin-bottom: 20px;
}
.cat-breadcrumb a {
  font-size: 13px;
  font-weight: var(--yqg-w-medium);
  color: rgba(255,255,255,.72);
  transition: color .12s;
}
.cat-breadcrumb a:hover { color: #fff; }
.cat-hero-icon {
  width: 60px;
  height: 60px;
  max-width: 60px;
  border-radius: 16px;
  background: rgba(255,255,255,.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  overflow: hidden;
  flex-shrink: 0;
}
.cat-hero-icon svg { width: 28px; height: 28px; min-width: 28px; color: #fff; }
.cat-page-hero h1 {
  font-size: 36px;
  font-weight: var(--yqg-w-bold);
  letter-spacing: -0.025em;
  color: #fff;
  line-height: 1.15;
  margin-bottom: 10px;
}
.cat-page-hero p {
  font-size: var(--yqg-fs-lead);
  color: rgba(255,255,255,.78);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Category empty state */
.cat-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 64px 24px;
}
.cat-empty-title {
  font-size: var(--yqg-fs-h3);
  font-weight: var(--yqg-w-semibold);
  color: var(--yqg-ink);
  margin-bottom: 10px;
}
.cat-empty-sub {
  font-size: var(--yqg-fs-body);
  color: var(--yqg-muted);
  margin-bottom: 24px;
  line-height: 1.6;
}

/* ---- Directory hero ---- */
.dir-hero {
  background: var(--yqg-primary);
  padding: 60px var(--yqg-pad-x) 52px;
  position: relative;
}
.dir-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--yqg-overlay);
}
.dir-hero .container { position: relative; z-index: 1; }

.dir-hero-text {
  text-align: center;
  margin-bottom: 32px;
}
.dir-hero-text h1 {
  font-size: 40px;
  font-weight: var(--yqg-w-bold);
  letter-spacing: -0.025em;
  color: #fff;
  line-height: 1.15;
  margin-bottom: 12px;
}
.dir-hero-text p {
  font-size: var(--yqg-fs-lead);
  color: rgba(255,255,255,0.78);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Search bar */
.dir-search {
  max-width: 760px;
  margin: 0 auto 20px;
}
.dir-search-inner {
  display: flex;
  align-items: center;
  background: var(--yqg-surface);
  border-radius: 12px;
  padding: 8px;
  gap: 0;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.dir-search-icon {
  width: 18px;
  height: 18px;
  color: var(--yqg-muted);
  flex-shrink: 0;
  margin: 0 4px 0 10px;
}
.dir-search-inner input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  font-family: var(--yqg-font);
  font-size: var(--yqg-fs-body);
  color: var(--yqg-ink);
  background: transparent;
  padding: 10px 12px;
}
.dir-search-inner input::placeholder { color: var(--yqg-muted); }
.dir-search-divider {
  width: 1px;
  height: 26px;
  background: var(--yqg-line);
  flex-shrink: 0;
}
.dir-search-inner select {
  border: none;
  outline: none;
  font-family: var(--yqg-font);
  font-size: var(--yqg-fs-small);
  font-weight: var(--yqg-w-medium);
  color: var(--yqg-muted);
  background: transparent;
  padding: 0 16px;
  cursor: pointer;
  white-space: nowrap;
  -webkit-appearance: none;
  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 d='M1 1l5 5 5-5' stroke='%23718096' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
}
.dir-search-btn {
  font-size: var(--yqg-fs-small);
  padding: 11px 24px;
  white-space: nowrap;
}

/* Quick pills */
.dir-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.dir-pill {
  font-size: var(--yqg-fs-meta);
  font-weight: var(--yqg-w-medium);
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--yqg-r-pill);
  padding: 6px 14px;
  transition: background 0.12s, border-color 0.12s;
}
.dir-pill:hover {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.4);
  color: #fff;
}

/* ---- Browse by category ---- */
.dir-categories {
  background: var(--yqg-surface);
  padding: 44px var(--yqg-pad-x);
  border-bottom: 1px solid var(--yqg-line);
}
.cat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
.cat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 16px 18px;
  background: var(--yqg-page);
  border: 1px solid var(--yqg-line);
  border-radius: var(--yqg-r-card);
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  color: var(--yqg-ink);
}
.cat-card:hover {
  border-color: var(--yqg-primary);
  box-shadow: 0 4px 16px rgba(26,95,122,.1);
  background: rgba(26,95,122,.03);
}
.cat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(26,95,122,.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cat-icon svg {
  width: 22px;
  height: 22px;
  stroke: var(--yqg-primary);
}
.cat-name {
  font-size: var(--yqg-fs-small);
  font-weight: var(--yqg-w-semibold);
  color: var(--yqg-ink);
  line-height: 1.3;
}
.cat-count {
  font-size: 11px;
  color: var(--yqg-muted);
}

/* ---- Listings section ---- */
.dir-listings {
  background: var(--yqg-page);
  padding-bottom: 56px;
}
.dir-listings-toolbar {
  padding-top: 44px;
  padding-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}
.dir-listings-toolbar h2 {
  font-size: 22px;
  font-weight: var(--yqg-w-bold);
  letter-spacing: -0.02em;
  color: var(--yqg-ink);
  margin-bottom: 4px;
}
.dir-listings-meta {
  font-size: var(--yqg-fs-small);
  color: var(--yqg-muted);
}
.dir-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dir-sort select {
  font-family: var(--yqg-font);
  font-size: var(--yqg-fs-small);
  font-weight: var(--yqg-w-medium);
  color: var(--yqg-ink);
  background: var(--yqg-surface);
  border: 1px solid var(--yqg-line);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  outline: none;
}

/* View toggle */
.view-toggle {
  display: flex;
  border: 1px solid var(--yqg-line);
  border-radius: 8px;
  overflow: hidden;
}
.view-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-family: var(--yqg-font);
  font-size: var(--yqg-fs-small);
  font-weight: var(--yqg-w-medium);
  color: var(--yqg-muted);
  background: var(--yqg-surface);
  border: none;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  border-right: 1px solid var(--yqg-line);
}
.view-toggle-btn:last-child { border-right: none; }
.view-toggle-btn svg { width: 16px; height: 16px; }
.view-toggle-btn.active {
  background: var(--yqg-primary);
  color: #fff;
}
.view-toggle-btn:not(.active):hover {
  background: var(--yqg-page);
  color: var(--yqg-ink);
}

/* ---- Map view layout ---- */
.map-view-container {
  display: flex;
  height: 620px;
  border-top: 1px solid var(--yqg-line);
}
.map-sidebar {
  width: 360px;
  flex-shrink: 0;
  overflow-y: auto;
  border-right: 1px solid var(--yqg-line);
  background: var(--yqg-surface);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#gmap {
  flex: 1;
  min-width: 0;
}

/* Map sidebar listing cards */
.map-listing-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--yqg-line);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: var(--yqg-surface);
}
.map-listing-card:hover,
.map-listing-card.active {
  border-color: var(--yqg-primary);
  box-shadow: 0 2px 10px rgba(26,95,122,.12);
}
.map-listing-photo {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--yqg-page-alt);
  display: flex;
  align-items: center;
  justify-content: center;
}
.map-listing-photo img { width: 100%; height: 100%; object-fit: cover; }
.map-listing-photo--avatar {
  font-family: var(--yqg-font);
  font-size: 22px;
  font-weight: var(--yqg-w-bold);
  color: #fff;
}
.map-listing-body { flex: 1; min-width: 0; }
.map-listing-body .listing-name { font-size: var(--yqg-fs-small); margin-bottom: 2px; }
.map-listing-body .listing-cat  { font-size: 12px; }
.map-listing-body .listing-badges { margin-bottom: 4px; }

/* ---- Responsive ---- */
@media (max-width: 960px) {
  .cat-grid { grid-template-columns: repeat(4, 1fr); }
  .listing-grid { grid-template-columns: 1fr 1fr; }
  .dir-hero-text h1 { font-size: 30px; }
  .dir-search-inner { flex-wrap: wrap; }
  .dir-search-inner input { order: 1; width: 100%; }
  .dir-search-divider { display: none; }
  .dir-search-inner select { order: 2; padding-left: 10px; }
  .dir-search-btn { order: 3; margin-left: auto; }
  .map-view-container { flex-direction: column; height: auto; }
  .map-sidebar { width: 100%; height: 260px; flex-direction: row; overflow-x: auto; overflow-y: hidden; flex-wrap: nowrap; border-right: none; border-bottom: 1px solid var(--yqg-line); }
  .map-sidebar { gap: 10px; }
  .map-listing-card { min-width: 260px; }
  #gmap { height: 400px; min-height: 400px; }
}

@media (max-width: 600px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .listing-grid { grid-template-columns: 1fr; }
  .dir-listings-toolbar { flex-direction: column; align-items: flex-start; }
  .dir-toolbar-right { width: 100%; justify-content: space-between; }
}

/* Listing grid */
.listing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* Listing card */
.listing-card {
  background: var(--yqg-surface);
  border: 1px solid var(--yqg-line);
  border-radius: var(--yqg-r-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s, border-color 0.15s;
  cursor: pointer;
}
.listing-card:hover {
  box-shadow: var(--yqg-shadow-hover);
  border-color: #c9d8e4;
}
.listing-card--featured {
  border-color: var(--yqg-primary);
  box-shadow: 0 0 0 1px var(--yqg-primary), var(--yqg-shadow-card);
}
.listing-photo {
  height: 90px;
  background: var(--yqg-page-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.listing-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 16px 32px;
}
.listing-photo--avatar {
  font-family: var(--yqg-font);
  font-size: 30px;
  font-weight: var(--yqg-w-bold);
  color: #fff;
}
.listing-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.listing-badges {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  min-height: 22px;
}
.badge {
  font-size: 11px;
  font-weight: var(--yqg-w-bold);
  padding: 3px 8px;
  border-radius: var(--yqg-r-pill);
  letter-spacing: 0.02em;
}
.badge--featured {
  background: var(--yqg-primary);
  color: #fff;
}
.badge--verified {
  background: rgba(26,95,122,.1);
  color: var(--yqg-primary);
}
.listing-name {
  font-size: var(--yqg-fs-body);
  font-weight: var(--yqg-w-semibold);
  color: var(--yqg-ink);
  margin-bottom: 3px;
}
.listing-cat {
  font-size: var(--yqg-fs-meta);
  color: var(--yqg-muted);
  margin-bottom: 10px;
}
.listing-desc {
  font-size: var(--yqg-fs-small);
  color: var(--yqg-muted);
  line-height: 1.55;
  flex: 1;
  margin-bottom: 6px;
}
.listing-meta {
  font-size: var(--yqg-fs-meta);
  font-weight: var(--yqg-w-medium);
  color: var(--yqg-ink);
  margin-bottom: 14px;
}
.listing-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--yqg-line);
}
.listing-rating {
  font-size: var(--yqg-fs-meta);
  font-weight: var(--yqg-w-bold);
  color: var(--yqg-cta);
}
.listing-footer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.listing-link {
  font-size: var(--yqg-fs-meta);
  font-weight: var(--yqg-w-semibold);
  color: var(--yqg-primary);
  transition: opacity 0.12s;
}
.listing-link:hover { opacity: 0.7; }
.listing-map-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--yqg-fs-meta);
  font-weight: var(--yqg-w-medium);
  color: var(--yqg-muted);
  background: none;
  border: 1px solid var(--yqg-line);
  border-radius: 6px;
  padding: 3px 8px;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}
.listing-map-btn:hover { color: var(--yqg-primary); border-color: var(--yqg-primary); }
.listing-card:hover { box-shadow: 0 4px 16px rgba(26,95,122,.1); }

/* "Get listed first" CTA card */
.listing-card--cta {
  border-style: dashed;
  border-color: #c5d5de;
  background: rgba(26,95,122,.02);
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
}
.listing-card--cta:hover {
  box-shadow: none;
  border-color: var(--yqg-primary);
}
.listing-cta-inner {
  text-align: center;
  padding: 32px 24px;
}
.listing-cta-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
}
.listing-cta-icon svg { width: 44px; height: 44px; }
.listing-cta-title {
  font-size: var(--yqg-fs-body);
  font-weight: var(--yqg-w-semibold);
  color: var(--yqg-ink);
  margin-bottom: 6px;
}
.listing-cta-sub {
  font-size: var(--yqg-fs-small);
  color: var(--yqg-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ---- Responsive ---- */
@media (max-width: 960px) {
  .cat-grid { grid-template-columns: repeat(4, 1fr); }
  .listing-grid { grid-template-columns: 1fr 1fr; }
  .dir-hero-text h1 { font-size: 30px; }
  .dir-search-inner { flex-wrap: wrap; }
  .dir-search-inner input { order: 1; width: 100%; }
  .dir-search-divider { display: none; }
  .dir-search-inner select { order: 2; padding-left: 10px; }
  .dir-search-btn { order: 3; margin-left: auto; }
}

@media (max-width: 600px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .listing-grid { grid-template-columns: 1fr; }
  .dir-listings-header { flex-direction: column; align-items: flex-start; }
}
