/* Search Results Page Styles - Extracted from EJS template */

.search-results-page {
  width: 100%;
  margin: 0;
  padding: 0;
}

.results-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
  align-items: flex-start;
}

.results-list {
  padding: 8px 16px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 2;
  min-width: 0;
  border-left: 1.5px solid #e0e0e0;
  box-shadow: -8px 0 16px -8px rgba(0,0,0,0.08);
  order: 2; /* Move results to the right on desktop */
}

.result-card {
  background: none;
  border: none;
  border-radius: 0;
  margin-bottom: 0;
  box-shadow: none;
  border-bottom: 1px solid #f0f0f0;
  transition: none;
}

.result-card:last-child {
  border-bottom: none;
}

.card-content {
  padding: 24px 0;
  gap: 0;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
}

.thumbnail-container {
  flex-shrink: 0;
  padding-right: 16px;
  width: 180px;
}

.home-thumbnail {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
}

.home-thumbnail-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  min-height: 120px;
  border-radius: 8px;
  background-color: #e5e5e5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  margin-top: 0;
  min-width: 0;
}

.listing-headline {
  font-size: 15px;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 2px;
  color: var(--hs-green);
  line-height: 1.2;
  word-break: break-word;
}

.location-info {
  font-size: 15px;
  margin: 0px 0 0px 0;
  font-weight: 500;
}

.rating-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 4px;
}

.rating-label {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: nowrap;
  font-size: inherit;
  line-height: inherit;
  font-weight: inherit;
}

.result-card .rating-label {
  font-size: 15px;
  line-height: 1.4;
  font-weight: 400;
}

.provider-name {
  display: inline-block;
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  font-size: inherit;
  font-weight: inherit;
}

.provider-link {
  font-weight: 500;
  margin-right: 4px;
  color: var(--hs-rust);
}

.heart-rating {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.heart-rating svg {
  width: 16px;
  height: 16px;
  margin-right: 1px;
  vertical-align: middle;
}

.heart-rating.no-gap svg {
  margin-right: 0 !important;
  gap: 0 !important;
  padding: 0 !important;
}

.rating-text {
  white-space: nowrap;
  margin-left: 4px;
  display: inline-block;
  font-size: inherit;
  font-weight: inherit;
}

.match-details {
  list-style: none;
  margin: 0;
  padding-left: 0;
  font-size: 15px;
  line-height: 1.4;
  margin-top: 4px;
}

.match-details.custom-bullets li {
  position: relative;
  padding-left: 1.5em;
  margin-bottom: 2px;
  text-indent: 0;
}

.match-details.custom-bullets li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #505e4b;
  font-size: 1.1em;
  line-height: 1.4;
  width: 1.5em;
  display: inline-block;
  text-align: center;
}

.card-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  margin-left: 16px;
}

.btn {
  min-width: 140px;
  font-size: 16px;
  text-align: center;
  display: block;
  padding: 12px 16px;
  border-radius: 8px;
  font-weight: 600;
  border: none;
  outline: none;
  text-decoration: none;
}

.btn:hover { 
  text-decoration: underline; 
}

.btn.primary { 
  background: var(--hs-rust); 
  color: var(--hs-offwhite); 
}

.btn.secondary { 
  background: var(--hs-sand); 
  color: #000; 
}

/* Chat Panel Styles */
.chat-panel {
  padding: 8px 16px 16px 16px;
  border-right: none;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 80px);
  max-height: 100vh;
  box-shadow: none;
  border-radius: 0;
  width: 33.333%;
  flex: 1;
  position: sticky;
  top: 0;
  margin-top: 0;
  order: 1; /* Keep chat on the left on desktop */
}

.chat-header {
  margin-top: 0;
  padding-top: 0;
  margin-bottom: 8px;
  height: 48px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 2;
  padding-top: 8px;
  padding-bottom: 8px;
}

.chat-header h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  max-height: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 0;
  padding-bottom: 0;
}

.message {
  margin-bottom: 0px;
}

.message-content {
  padding: 12px 16px;
  border-radius: 8px;
  max-width: 80%;
}

.ai-message .message-content {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: 15px;
  font-weight: 400;
  max-width: 100%;
}

.user-message .message-content {
  background: var(--light-grey);
  margin-left: auto;
}

.chat-input {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid #e0e0e0;
  z-index: 1;
}

.chat-input textarea {
  flex: 1;
  border-radius: 8px;
  border: 1px solid #ccc;
  padding: 10px;
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
  min-height: 40px;
  max-height: 120px;
  width: 100%;
  transition: border-color 0.2s ease;
}

.chat-input textarea:focus {
  outline: none;
  border-color: var(--hs-rust);
  box-shadow: 0 0 0 3px rgba(196, 102, 62, 0.1);
}

.chat-input .btn {
  margin: 0;
  height: 40px;
  padding: 0 18px;
  font-size: 15px;
  width: 100%;
}

.results-count-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0;
  padding-top: 8px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e0e0e0;
}

.results-count-text {
  color: var(--hs-rust);
  font-weight: 600;
  font-size: 15px;
  margin: 0;
}

.no-results {
  text-align: center;
  padding: 64px 32px;
}

.no-results h2 {
  font-size: 24px;
  margin-bottom: 16px;
}

.no-results p {
  margin-bottom: 24px;
}

.error-message {
  border: 1px solid #fcc;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
  color: #c33;
}

.error-message p {
  margin: 0;
  font-weight: 500;
}

/* Skeleton Loading Styles */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.skeleton-card {
  padding: 24px 0;
  border-bottom: 1px solid #f0f0f0;
}

.skeleton-thumbnail {
  width: 120px;
  height: 90px;
  border-radius: 8px;
  flex-shrink: 0;
}

.skeleton-title {
  height: 18px;
  width: 80%;
  margin-bottom: 8px;
}

.skeleton-text {
  height: 14px;
  width: 60%;
  margin-bottom: 6px;
}

.skeleton-text.short {
  width: 40%;
}

.skeleton-text.medium {
  width: 70%;
}

.skeleton-button {
  height: 36px;
  width: 100px;
  border-radius: 6px;
}

.skeleton-message {
  height: 16px;
  width: 90%;
  margin-bottom: 4px;
}

.skeleton-message.short {
  width: 60%;
}

.skeleton-message.medium {
  width: 75%;
}

/* Desktop button styling */
.chat-input .mobile-icon {
  display: none;
}

.chat-input .desktop-text {
  display: inline;
}

/* Mobile-First Layout - Cards above, chat below */
@media (max-width: 640px) {
  /* Reset the container to normal flow */
  .results-container {
    display: block !important;
    height: auto !important;
    min-height: auto !important;
  }
  
  /* Product cards take full screen minus chat height */
  .results-list {
    display: block !important;
    padding: 16px !important;
    margin-bottom: 220px !important; /* Default space, will be updated by JS */
    border-left: none !important;
    box-shadow: none !important;
    order: 1 !important; /* Results first on mobile */
  }
  
  /* Chat panel completely fixed at bottom, outside normal flow */
  .chat-panel {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    background: linear-gradient(to bottom, #faf9f6, var(--hs-offwhite)) !important;
    border-top: 5px solid var(--hs-sand) !important;
    /* height set via inline style for dynamic resizing */
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 1000 !important;
    display: flex !important;
    flex-direction: column !important;
    box-shadow: 0 -8px 24px rgba(0,0,0,0.15), 0 -2px 8px rgba(0,0,0,0.1) !important;
    transition: height 0.2s ease-out !important;
    order: 2 !important; /* Chat second on mobile (but fixed positioning overrides this) */
  }
  
  /* Hide chat header on mobile */
  .chat-header {
    display: none !important;
  }
  
  /* Drag handle for chat panel resizing */
  .chat-drag-handle {
    position: absolute !important;
    top: -8px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 40px !important;
    height: 4px !important;
    background: rgba(80, 94, 75, 0.3) !important;
    border-radius: 2px !important;
    cursor: grab !important;
    touch-action: pan-y !important;
    z-index: 1001 !important;
  }
  
  .chat-drag-handle:active {
    cursor: grabbing !important;
    background: var(--hs-green) !important;
  }
  
  /* Chat messages: scrollable area */
  .chat-messages {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 12px 16px 8px !important;
    border-bottom: 1px solid #e0e0e0 !important;
  }
  
  /* Input area at bottom of chat panel */
  .chat-input {
    padding: 12px 16px !important;
    background: white !important;
    display: flex !important;
    gap: 8px !important;
    align-items: flex-start !important;
    min-height: 60px !important;
    flex-shrink: 0 !important;
    border-top: none !important;
    margin-top: 0 !important;
    transition: height 0.2s ease-out !important;
  }
  
  .chat-input textarea {
    flex: 1 !important;
    min-height: 36px !important;
    max-height: 120px !important;
    resize: vertical !important;
    padding: 8px 12px !important;
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    font-size: 16px !important;
    width: auto !important;
    transition: height 0.2s ease-out !important;
  }
  
  .chat-input button {
    background: var(--hs-rust) !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    padding: 8px !important;
    width: 36px !important;
    height: 36px !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 36px !important;
  }
  
  /* Show only icon on mobile */
  .chat-input .desktop-text {
    display: none !important;
  }
  
  .chat-input .mobile-icon {
    display: inline !important;
    font-size: 16px !important;
  }
  
  /* Hide card images on mobile */
  .thumbnail-container {
    display: none;
  }
  
  /* Adjust card layout without images */
  .card-content {
    flex-direction: column;
    gap: 12px;
    padding: 16px 0;
  }
  
  .card-actions {
    flex-direction: row;
    gap: 8px;
    margin-left: 0;
    align-self: flex-start;
  }
  
  /* Smaller text and spacing on mobile */
  .message {
    margin-bottom: 8px;
  }
  
  .message-content {
    font-size: 14px;
    line-height: 1.4;
  }
  
  /* Consistent mobile font sizes for result cards */
  .listing-headline {
    font-size: 14px !important;
    line-height: 1.3 !important;
  }
  
  .location-info {
    font-size: 13px !important;
    line-height: 1.3 !important;
  }
  
  .rating-label, .rating-text {
    font-size: 13px !important;
    line-height: 1.3 !important;
  }
  
  .match-details {
    font-size: 13px !important;
    line-height: 1.3 !important;
  }
  
  .btn {
    font-size: 14px !important;
    padding: 8px 12px !important;
  }
  

}
