/* ==========================================================================
   Changan Elements – Dealer Locator
   ========================================================================== */

.changan-dealer-locator *,
.changan-dealer-locator *::before,
.changan-dealer-locator *::after {
  box-sizing: border-box;
}

/* ── Screen-reader only ────────────────────────────────────────────────── */
.cdl-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;
}

/* ── Layout ────────────────────────────────────────────────────────────── */
.cdl-layout {
  display: grid;
  /* Width comes from the widget's "Sidebar Width" control via a CSS
     variable (set on this same element), falling back to 200px. */
  grid-template-columns: var(--cdl-sidebar-w, 200px) 1fr;
  gap: 24px;
  align-items: start;
}

/* Mobile: search/filter panel stacks ON TOP, dealer cards below.
   Because the control only sets a variable (not the property itself),
   this rule now reliably wins on small screens. */
@media (max-width: 768px) {
  .cdl-layout {
    grid-template-columns: 1fr;
  }
}

/* ── Sidebar ───────────────────────────────────────────────────────────── */
/* ── Sidebar ───────────────────────────────────────────────────────────── */
.cdl-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px; /* consistent gap between ALL sidebar children */
}

.cdl-sidebar__sticky {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cdl-btn-clear {
  margin-top: auto;
}

@media (max-width: 768px) {
  .cdl-sidebar {
    width: 100% !important;
  }

  .cdl-btn-clear {
    margin-top: 12px;
  }
}

/* ── Inputs ────────────────────────────────────────────────────────────── */
.cdl-search-input,
.cdl-city-select {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.9rem;
  background-color: #ffffff;
  border: 1px solid #dddddd;
  border-radius: 4px;
  color: #555555;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.cdl-city-select {
  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='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}

.cdl-search-input:focus,
.cdl-city-select:focus {
  border-color: #f47b20;
  box-shadow: 0 0 0 3px rgba(244, 123, 32, 0.15);
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.cdl-btn-search,
.cdl-btn-clear {
  width: 100%;
  padding: 11px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
  line-height: 1;
}

.cdl-btn-search {
  background-color: #f47b20;
  color: #ffffff;
  border: none;
}

.cdl-btn-search:hover {
  background-color: #d9691a;
}

.cdl-btn-clear {
  background-color: transparent;
  color: #555555;
  border: 1px solid #cccccc;
}

.cdl-btn-clear:hover {
  background-color: #f5f5f5;
}

/* ── Main area ─────────────────────────────────────────────────────────── */
.cdl-main {
  flex: 1;
  min-width: 0;
}

/* ── Grid ──────────────────────────────────────────────────────────────── */
.cdl-grid {
  display: grid;
  gap: 20px;
  /* grid-template-columns set responsively by Elementor controls */
  grid-template-columns: repeat(3, 1fr);
}

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

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

/* ── Card ──────────────────────────────────────────────────────────────── */
.cdl-card {
  background-color: #ffffff;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.cdl-card:hover {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.11);
  transform: translateY(-2px);
}

/* Hidden cards (JS-controlled) */
.cdl-card[hidden] {
  display: none;
}

/* ── Card title ────────────────────────────────────────────────────────── */
.cdl-card__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a4f8a;
  margin: 0 0 10px;
  line-height: 1.3;
}

/* Title is now a link to the dealer's own page — kept visually identical
   to the plain heading it replaced (no color/underline change), the only
   difference being the pointer cursor a link naturally gets. */
/* !important here is deliberate and narrowly scoped: your site has a
   global `a { color: #c36; }` rule from elsewhere (not this plugin) that
   matches the <a> directly. .cdl-card__title's own color only reaches
   that <a> via inheritance, and inheritance always loses to ANY rule
   that directly targets the child element — no specificity or
   !important on the parent (.cdl-card__title) can win that fight, only
   a rule targeting the <a> itself can. */
.cdl-card__title a {
  color: inherit !important;
  text-decoration: none !important;
}

/* ── Divider ───────────────────────────────────────────────────────────── */
.cdl-card__divider {
  border: none;
  border-top: 1px solid #e8e8e8;
  margin: 10px 0 16px;
}

/* ── Meta grid ─────────────────────────────────────────────────────────── */
.cdl-card__meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: start;
}

/* Street and phone span full width on narrow cards */
@media (max-width: 480px) {
  .cdl-card__meta {
    grid-template-columns: 1fr;
  }
}

.cdl-card__meta-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 0.875rem;
  color: #555555;
  line-height: 1.4;
}

.cdl-card__meta-item a {
  color: #f47b20;
  text-decoration: none;
  transition: color 0.2s ease;
}

.cdl-card__meta-item a:hover {
  color: #d9691a;
  text-decoration: underline;
}

/* ── Meta icons ────────────────────────────────────────────────────────── */
.cdl-card__meta-icon {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  margin-top: 1px;
  color: #888888;
}

.cdl-card__meta-icon i,
.cdl-card__meta-icon svg {
  display: block;
  font-size: 14px;
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.cdl-card__meta-item--phone .cdl-card__meta-icon,
.cdl-card__meta-item--website .cdl-card__meta-icon {
  color: #f47b20;
}

/* ── No results ────────────────────────────────────────────────────────── */
.cdl-no-results {
  padding: 32px 0;
  text-align: center;
  color: #999999;
  font-size: 0.95rem;
}

.cdl-no-results[hidden] {
  display: none;
}

/* ── Pagination ────────────────────────────────────────────────────────── */
.cdl-pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.cdl-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 0.875rem;
  font-weight: 500;
  background-color: #ffffff;
  color: #555555;
  border: 1px solid #cccccc;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
  line-height: 1;
}

.cdl-page-btn:hover:not(.is-active) {
  background-color: #f5f5f5;
}

.cdl-page-btn.is-active {
  background-color: #f47b20;
  border-color: #f47b20;
  color: #ffffff;
  pointer-events: none;
}

.cdl-page-btn:focus-visible {
  outline: 2px solid #f47b20;
  outline-offset: 2px;
}

/* Ellipsis gap between page groups (e.g. 1 2 3 … 13) */
.cdl-page-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 36px;
  color: #999999;
  font-size: 0.875rem;
  user-select: none;
}

/* ── Reduced motion ────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .cdl-card,
  .cdl-btn-search,
  .cdl-btn-clear,
  .cdl-page-btn {
    transition: none !important;
  }
}
