/* ── DCD Location Finder ── */

#dcd-wrapper {
  display: flex;
  width: 100%;
  height: 82vh;
  min-height: 500px;
  max-height: 900px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 14px;
  color: #1a1a1a;
  box-sizing: border-box;
}

/* Override WordPress block theme p margin */
#dcd-wrapper p {
  margin-top: 0;
  margin-bottom: 0;
}

/* ── Sidebar ── */

#dcd-sidebar {
  width: 380px;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-right: 1px solid #e0e0e0;
}

#dcd-search {
  padding: 14px 16px 10px;
  border-bottom: 1px solid #e0e0e0;
  background: #fff;
}

.dcd-title {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 10px;
  color: #111;
}

.dcd-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.dcd-field--zip {
  flex: 1;
}

.dcd-field--radius {
  width: 110px;
  flex-shrink: 0;
}

.dcd-row .dcd-field {
  margin-bottom: 0;
}

.dcd-field {
  margin-bottom: 10px;
}

.dcd-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #666;
  margin-bottom: 3px;
}

#dcd-zip,
#dcd-radius {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  color: #1a1a1a;
  box-sizing: border-box;
  transition: border-color 0.15s;
}

#dcd-zip:focus,
#dcd-radius:focus {
  outline: none;
  border-color: #333;
}

/* Checkboxes */

.dcd-checkboxes {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 4px 0;
  max-height: 140px;
  overflow-y: auto;
  padding: 6px 8px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: #fafafa;
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
}

.dcd-checkboxes::-webkit-scrollbar {
  width: 5px;
}

.dcd-checkboxes::-webkit-scrollbar-track {
  background: transparent;
}

.dcd-checkboxes::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.dcd-checkbox {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 400;
  color: #333;
}

.dcd-checkbox input[type="checkbox"] {
  accent-color: #111;
  width: 15px;
  height: 15px;
  margin: 0;
}

/* Google Places autocomplete dropdown z-index fix */
.pac-container {
  z-index: 99999;
}

/* ── Results ── */

#dcd-results {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  min-height: 0;
}

/* ── Autocomplete filter ── */

#dcd-filter-wrap {
  padding: 8px 14px 6px;
  border-bottom: 1px solid #ebebeb;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 1;
}

#dcd-filter {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  color: #1a1a1a;
  box-sizing: border-box;
  transition: border-color 0.15s;
}

#dcd-filter:focus {
  outline: none;
  border-color: #333;
}

.dcd-results-count {
  font-size: 11px;
  font-weight: 700;
  color: #666;
  padding: 10px 14px 4px;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #f0f0f0;
}

/* Cards */

.dcd-card {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid #ebebeb;
  cursor: pointer;
  transition: background 0.12s;
}

.dcd-card:hover {
  background: #fafafa;
}

.dcd-card--active {
  background: #f0f0f0;
}

.dcd-card--active:hover {
  background: #e8e8e8;
}

.dcd-card-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #111;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  margin-top: 2px;
}

.dcd-card-body {
  min-width: 0;
}

.dcd-card-name {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 1px;
  line-height: 1.3;
}

.dcd-card-chain {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: #555;
  background: #eee;
  padding: 1px 5px;
  border-radius: 3px;
  margin-bottom: 2px;
}

.dcd-card-address {
  font-size: 13px;
  color: #444;
  margin: 1px 0;
  line-height: 1.3;
}

.dcd-card-phone a,
.dcd-card-email a {
  color: #111;
  text-decoration: none;
  font-size: 13px;
}

.dcd-card-phone a:hover,
.dcd-card-email a:hover {
  text-decoration: underline;
}

.dcd-card-dist {
  font-size: 11px;
  color: #999;
  margin: 2px 0 0;
}

.dcd-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #ebebeb;
}

.dcd-card-directions,
.dcd-card-call {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  justify-content: center;
  padding: 9px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.dcd-card-directions {
  background: #111;
  color: #fff;
}

.dcd-card-directions:hover {
  background: #333;
  color: #fff;
  text-decoration: none;
}

.dcd-card-call {
  background: #f0f0f0;
  color: #111;
}

.dcd-card-call:hover {
  background: #e0e0e0;
  color: #111;
  text-decoration: none;
}

/* ── Map ── */

#dcd-map {
  flex: 1;
  height: 100%;
  min-height: 0;
}

/* ── InfoWindow ── */

.dcd-info {
  /* font-family: inherit; */
  font-size: 13px;
  line-height: 1.5;
  max-width: 260px;
}

.dcd-info h4 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  margin: 0 0 4px;
  font-size: 14px;
}

.dcd-info p {
  margin: 4px 0;
}

.dcd-info a {
  color: #1a73e8;
  text-decoration: none;
}

.dcd-info a:hover {
  text-decoration: underline;
}

/* ── Chain filter header ── */

.dcd-chains-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.dcd-chains-header label {
  margin-bottom: 0;
}

.dcd-chains-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dcd-chains-action {
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.dcd-chains-action:hover {
  color: #111;
  text-decoration: none;
}

.dcd-chains-sep {
  font-size: 10px;
  color: #ccc;
}

.dcd-chains-toggle {
  background: none;
  border: none;
  padding: 0 0 0 2px;
  font-size: 11px;
  color: #aaa;
  cursor: pointer;
  line-height: 1;
}

.dcd-chains-toggle:hover {
  color: #333;
}

/* ── Mobile tab bar (hidden on desktop) ── */

#dcd-tabs {
  display: none;
}

/* ── Responsive ── */

@media (max-width: 768px) {
  #dcd-wrapper {
    flex-direction: column;
    height: 100svh;
    max-height: none;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  /* Tab bar */
  #dcd-tabs {
    display: flex;
    flex-shrink: 0;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    padding: 6px 8px;
    gap: 6px;
  }

  .dcd-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 0 11px;
    font-size: 14px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: #888;
    transition: background 0.15s, color 0.15s;
  }

  .dcd-tab--active {
    background: #111;
    color: #fff;
  }

  .dcd-tab-icon {
    width: 18px;
    height: 18px;
    display: block;
    flex-shrink: 0;
  }

  /* Sidebar fills remaining height when tab is active */
  #dcd-sidebar {
    flex: 1;
    width: 100%;
    min-width: 0;
    min-height: 0;
    border-right: none;
    border-bottom: none;
    overflow: hidden;
  }

  /* Map hidden by default on mobile — JS shows it when Map tab clicked */
  #dcd-map {
    display: none;
    flex: 1;
    height: auto;
    min-height: 0;
  }

  /* Search panel: slightly tighter on mobile */
  #dcd-search {
    padding: 12px 14px;
  }

  .dcd-title {
    font-size: 14px;
  }

  /* Larger touch targets for inputs */
  #dcd-zip,
  #dcd-radius,
  #dcd-filter {
    padding: 11px 12px;
    font-size: 16px; /* prevents iOS zoom on focus */
  }

  .dcd-checkbox {
    padding: 4px 0;
    font-size: 14px;
  }

  .dcd-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
  }

  .dcd-checkboxes {
    max-height: 160px;
  }

  /* Cards: larger and more readable on mobile */
  .dcd-card {
    padding: 14px 16px;
    gap: 12px;
  }

  .dcd-card-num {
    width: 28px;
    height: 28px;
    font-size: 12px;
    margin-top: 1px;
    flex-shrink: 0;
  }

  .dcd-card-name {
    font-size: 16px;
    margin-bottom: 3px;
  }

  .dcd-card-chain {
    font-size: 11px;
    padding: 2px 7px;
    margin-bottom: 4px;
  }

  .dcd-card-address {
    font-size: 14px;
    line-height: 1.45;
  }

  .dcd-card-phone a,
  .dcd-card-email a {
    font-size: 14px;
  }

  .dcd-card-dist {
    font-size: 12px;
    margin-top: 4px;
  }

  .dcd-results-count {
    font-size: 12px;
    padding: 12px 16px 6px;
  }

  /* Infowindow: wider and larger text on mobile */
  .dcd-info {
    font-size: 14px;
    max-width: min(80vw, 300px);
    line-height: 1.55;
  }

  .dcd-info h4 {
    font-size: 16px;
    margin-bottom: 6px;
  }

  .dcd-info p {
    margin: 5px 0;
  }

  .dcd-info a {
    font-size: 14px;
    font-weight: 600;
  }
}
