/* Native conversational search (ported from search-module iframe) */
#vf-search {
  font-family: Inter, "Segoe UI", "Helvetica Neue", sans-serif;
  color: #333;
  background: #fff;
  width: 100%;
}
#vf-search .vf-search-hero.hero {
  border-radius: 0;
}

/* reset scoped */
#vf-search,
#vf-search * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

#vf-search body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  background: #ffffff;
  color: #333;
}

#vf-search .hero {
  position: relative;
  height: 330px;
  overflow: hidden;
  background: linear-gradient(110deg, #2e4c38 0%, #4a7a5c 55%, #8bbf94 100%);
}

#vf-search .hero-image {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  -o-object-fit: cover;
  object-fit: cover;
  -o-object-position: center;
  object-position: center;
}

#vf-search .hero-image:not([src]) {
  display: none;
}

#vf-search .hero-inner {
  position: relative;
  z-index: 2;
  max-width: 1400px;
  height: 100%;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#vf-search .hero-text {
  max-width: 720px;
  text-align: center;
  color: #ffffff;
}

#vf-search .hero-text h1 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 12px;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

#vf-search .hero-text p {
  font-size: clamp(15px, 1.6vw, 18px);
  line-height: 1.45;
  opacity: 0.95;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
  #vf-search .hero {
    height: 220px;
  }
}

#vf-search .container {
  max-width: 1400px;
  margin: -90px auto 0;
  padding: 0 20px 24px;
  position: relative;
  z-index: 2;
}

/* Search Section */
#vf-search .search-section {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 24px;
}

#vf-search .search-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  position: relative;
}

#vf-search .search-input-wrapper {
  flex: 1;
  min-width: 0;
  position: relative;
}

#vf-search .search-input {
  width: 100%;
  padding: 14px 50px 14px 18px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s;
}

#vf-search .location-btn-inline {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  font-size: 20px;
  color: #666;
  transition: color 0.3s;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

#vf-search .location-btn-inline:hover {
  color: #4caf50;
}

#vf-search .location-btn-inline.active {
  color: #4caf50;
}

#vf-search .location-btn-inline:focus {
  outline: 2px solid #4caf50;
  outline-offset: 2px;
}

#vf-search .search-input:focus {
  outline: none;
  border-color: #4caf50;
}

#vf-search .search-input::placeholder {
  color: #999;
}

#vf-search .btn {
  padding: 14px 28px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

#vf-search .btn-primary {
  background: #fdb44b;
  color: white;
  width: 100%;
  flex-shrink: 0;
  min-height: 48px;
}

@media (min-width: 640px) {
  #vf-search .search-box {
    flex-direction: row;
    align-items: stretch;
  }

  #vf-search .search-box .btn-primary {
    width: auto;
  }
}

#vf-search .btn-primary:hover {
  background: #fca726;
}

#vf-search .btn-secondary {
  background: #f0f0f0;
  color: #333;
}

#vf-search .btn-secondary:hover {
  background: #e0e0e0;
}

#vf-search .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Filters */
#vf-search .filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

#vf-search .filter-btn {
  padding: 8px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 20px;
  background: white;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
}

#vf-search .filter-btn.active {
  background: #4caf50;
  color: white;
  border-color: #4caf50;
}

/* AI Response */
#vf-search .ai-response {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 24px;
  display: none;
}

#vf-search .ai-response.show {
  display: block;
}

#vf-search .ai-response h3 {
  margin-bottom: 12px;
  font-size: 18px;
}

#vf-search .ai-response p {
  line-height: 1.6;
  font-size: 15px;
}

/* Layout */
#vf-search .content-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 968px) {
  #vf-search .content-layout {
    grid-template-columns: 1fr;
  }
}

/* Map column: map + skyscraper ad stacked, sticky together on scroll. */
#vf-search .map-column {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

#vf-search .map-container {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  height: 600px;
}

#vf-search #map {
  width: 100%;
  height: 100%;
}

/* Placement 8 — Skyscraper (wide) 160x600, below the map. Desktop only. */
#vf-search .map-ad {
  display: flex;
  justify-content: center;
}

#vf-search .map-ad[hidden] {
  display: none;
}

#vf-search .map-ad__inner {
  position: relative;
  width: 160px;
  height: 600px;
}

#vf-search .map-ad__label {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  padding: 2px 5px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  border-bottom-right-radius: 3px;
}

.map-ad__link,
#vf-search .map-ad img {
  display: block;
  width: 160px;
  height: 600px;
}

#vf-search .map-ad img {
  object-fit: contain;
}

/* Desktop-only (≥768px), matching SOW / theme ad breakpoint. */
@media (max-width: 767px) {
  #vf-search .map-ad {
    display: none !important;
  }

  /* Avoid scroll-trap: sticky full-height map eats the phone viewport. */
  #vf-search .map-column {
    position: static;
    order: 2;
  }

  #vf-search .clinic-list {
    order: 1;
  }

  #vf-search .content-layout {
    display: flex;
    flex-direction: column;
  }

  #vf-search .map-container {
    height: min(52vh, 420px);
  }

  #vf-search .clinic-list {
    padding: 16px;
  }

  #vf-search .filters {
    gap: 8px;
  }

  #vf-search .filter-btn {
    padding: 10px 14px;
    font-size: 13px;
    max-width: 100%;
  }

  #vf-search .page-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 10px 14px;
  }

  #vf-search .btn-primary,
  #vf-search .location-btn-inline,
  #vf-search button.filter-btn {
    min-height: 44px;
  }
}

/* Clinic List */
#vf-search .clinic-list {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#vf-search .clinic-card {
  padding: 20px;
  border: 2px solid #f0f0f0;
  border-radius: 8px;
  margin-bottom: 16px;
  cursor: pointer;
  transition: all 0.3s;
}

#vf-search .clinic-card:hover {
  border-color: #4caf50;
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.15);
}

#vf-search .clinic-card.selected {
  border-color: #4caf50;
  background: #f1f8f4;
}

#vf-search .clinic-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 12px;
}

#vf-search .clinic-name {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}

#vf-search .clinic-name-link {
  color: inherit;
  text-decoration: none;
}

#vf-search .clinic-name-link:hover {
  color: #2e7d32;
  text-decoration: underline;
}

#vf-search .clinic-distance {
  color: #4caf50;
  font-weight: 600;
  font-size: 14px;
}

#vf-search .clinic-rating {
  color: #ff9800;
  font-size: 14px;
  font-weight: 500;
}

#vf-search .clinic-rating-none {
  color: #999;
  font-size: 13px;
  font-style: italic;
}

#vf-search .clinic-address {
  color: #666;
  font-size: 14px;
  margin-bottom: 8px;
}

#vf-search .clinic-services,
#vf-search .clinic-card-services {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 4px;
}

#vf-search .service-tag {
  padding: 4px 12px;
  background: #f0f0f0;
  border-radius: 12px;
  font-size: 12px;
  color: #666;
  white-space: nowrap;
  line-height: 1.3;
}

#vf-search .service-tag.emergency {
  background: #ffebee;
  color: #c62828;
}

#vf-search .clinic-status {
  font-size: 13px;
  margin-top: 8px;
}

#vf-search .status-open,
#vf-search .clinic-status-open {
  color: #4caf50;
}

#vf-search .status-closed,
#vf-search .clinic-status-closed {
  color: #f44336;
}

/* Enhanced Clinic Card Styles */

/* Card header with expand button in top-right */
#vf-search .clinic-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

/* 2.1 Expanded card state */
#vf-search .clinic-card.expanded {
  background: #fafafa;
}

#vf-search .clinic-card-details {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition:
    max-height 0.3s ease-in-out,
    opacity 0.3s ease-in-out;
}

#vf-search .clinic-card-details.show {
  max-height: 1000px;
  opacity: 1;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e0e0e0;
}

/* 2.2 Expand/collapse button - smaller, in top-right */
#vf-search .clinic-card-expand-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  min-width: 32px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease-in-out;
  color: #666;
  font-size: 16px;
  flex-shrink: 0;
}

#vf-search .clinic-card-expand-btn:hover {
  background: #f0f0f0;
}

#vf-search .clinic-card-expand-btn.expanded {
  transform: rotate(180deg);
}

/* 2.3 Contact information styling */
#vf-search .clinic-card-contact {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  margin-bottom: 4px;
}

#vf-search .clinic-card-contact-item,
#vf-search .clinic-contact-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14px;
  color: #666;
}

#vf-search .clinic-card-contact-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

#vf-search .clinic-card-contact a {
  color: #4caf50;
  text-decoration: none;
  transition: color 0.2s;
}

#vf-search .clinic-card-contact a:hover {
  color: #45a049;
  text-decoration: underline;
}

#vf-search .clinic-card-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
}

#vf-search .clinic-card-status-indicator.open {
  background: #e8f5e9;
  color: #2e7d32;
}

#vf-search .clinic-card-status-indicator.closed {
  background: #ffebee;
  color: #c62828;
}

/* 2.4 Opening hours and emergency hours */
#vf-search .clinic-card-hours {
  margin-top: 12px;
}

#vf-search .clinic-card-hours-title {
  font-weight: 600;
  font-size: 14px;
  color: #333;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

#vf-search .clinic-card-hours-table {
  display: table;
  width: 100%;
  font-size: 13px;
  color: #666;
}

#vf-search .clinic-card-hours-row {
  display: table-row;
}

#vf-search .clinic-card-hours-day {
  display: table-cell;
  padding: 4px 8px 4px 0;
  font-weight: 500;
}

#vf-search .clinic-card-hours-time {
  display: table-cell;
  padding: 4px 0;
  text-align: right;
}

#vf-search .clinic-card-emergency-hours {
  background: #fff3e0;
  border-left: 4px solid #ff9800;
  padding: 12px;
  border-radius: 6px;
  margin-top: 12px;
}

#vf-search .clinic-card-emergency-hours-title {
  font-weight: 600;
  font-size: 14px;
  color: #e65100;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

#vf-search .clinic-card-emergency-hours-text {
  font-size: 13px;
  color: #666;
}

#vf-search .clinic-card-description {
  margin-top: 12px;
  padding: 12px;
  background: #f9f9f9;
  border-radius: 6px;
}

#vf-search .clinic-card-description-title {
  font-weight: 600;
  font-size: 14px;
  color: #333;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

#vf-search .clinic-card-description-text {
  font-size: 13px;
  color: #666;
  line-height: 1.5;
}

/* 2.5 Smooth transition animations */
#vf-search .clinic-card {
  transition:
    all 0.2s ease-in-out,
    border-color 0.2s ease-in-out;
}

#vf-search .clinic-card-expand-btn {
  transition:
    transform 0.2s ease-in-out,
    background 0.2s ease-in-out;
}

/* 2.6 Responsive design breakpoints */
@media (max-width: 768px) {
  #vf-search .clinic-card {
    padding: 16px;
  }

  #vf-search .clinic-header {
    flex-direction: column;
    gap: 8px;
  }

  #vf-search .clinic-card-contact {
    gap: 12px;
  }

  #vf-search .clinic-card-contact-item {
    font-size: 15px;
  }

  #vf-search .clinic-card-expand-btn {
    min-width: 44px;
    min-height: 44px;
  }

  #vf-search .clinic-services,
  #vf-search .clinic-card-services {
    gap: 6px;
    margin-top: 14px;
  }

  #vf-search .service-tag {
    font-size: 12px;
    padding: 5px 10px;
  }

  #vf-search .clinic-card-hours-table {
    font-size: 14px;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  #vf-search .clinic-card {
    padding: 18px;
  }

  #vf-search .clinic-card-contact {
    gap: 10px;
  }

  #vf-search .clinic-card-hours-table {
    font-size: 13px;
  }
}

/* Pagination */
#vf-search .pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}

#vf-search .page-btn {
  padding: 8px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  transition: all 0.3s;
}

#vf-search .page-btn:hover {
  border-color: #4caf50;
}

#vf-search .page-btn.active {
  background: #4caf50;
  color: white;
  border-color: #4caf50;
}

/* Loading */
#vf-search .loading {
  text-align: center;
  padding: 40px;
  display: none;
}

#vf-search .loading.show {
  display: block;
}

#vf-search .spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #4caf50;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

/* Empty State */
#vf-search .empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #999;
  display: none;
}

#vf-search .empty-state.show {
  display: block;
}

#vf-search .empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

/* Mapbox Popup */
#vf-search .mapboxgl-popup-content {
  padding: 16px;
  border-radius: 8px;
}

#vf-search .popup-clinic-name {
  font-weight: 600;
  margin-bottom: 8px;
}

#vf-search .popup-clinic-address {
  font-size: 13px;
  color: #666;
  margin-bottom: 8px;
}

#vf-search .popup-clinic-distance {
  color: #4caf50;
  font-size: 13px;
  font-weight: 600;
}
