/* Custom enhancements to jQuery UI Autocomplete */
.ui-autocomplete {
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 5px 0;
  z-index: 999999;
}

.ui-autocomplete .ui-menu-item {
  padding: 8px 12px;
    font-size: 14px;
  line-height: 1.4;
    border-bottom: 1px solid #f0f0f0;
  margin: 0;
  cursor: pointer;
  list-style: none;
  color: #333;
}

.ui-autocomplete .ui-menu-item:last-child {
    border-bottom: none;
}

.ui-autocomplete .ui-menu-item .ui-menu-item-wrapper {
  padding: 0;
}

.ui-autocomplete .ui-menu-item .ui-menu-item-wrapper.ui-state-active {
  margin: 0;
  background: #f8f8f8;
  border: none;
  color: #000;
}

.ui-autocomplete .ui-menu-item:hover,
.ui-autocomplete .ui-menu-item.ui-state-focus,
.ui-autocomplete .ui-menu-item-wrapper:hover {
    background: #f8f8f8;
  border: none;
  color: #000;
}

/* Hide helper text that sometimes appears */
.ui-helper-hidden-accessible {
  display: none;
}

div.psych-submission-field {
  margin-bottom: 1rem;
}

/* Submission form validation styles */
.psych-submission-field.has-error input,
.psych-submission-field.has-error select,
.psych-submission-field.has-error textarea {
  border-color: #dc3545;
  background-color: #fff5f5;
}

.psych-submission-error-message {
  display: block;
  color: #dc3545;
  font-size: 0.875em;
  margin-top: 0.25em;
}

.psych-submission-messages {
  margin: 1em 0;
}

.psych-submission-error {
  padding: 0.75em 1.25em;
  margin: 1em 0;
  border: 1px solid #f5c6cb;
  background-color: #f8d7da;
  color: #721c24;
  border-radius: 0.25em;
}

.psych-submission-error p {
  margin: 0 0 0.5em 0;
  font-weight: bold;
}

.psych-submission-error ul {
  margin: 0.5em 0 0 0;
  padding-left: 1.5em;
}

.psych-submission-error li {
  margin: 0.25em 0;
}

.psych-submission-success {
  padding: 0.75em 1.25em;
  margin: 1em 0;
  border: 1px solid #d0e9c6;
  background-color: #dff0d8;
  color: #3c763d;
  border-radius: 0.25em;
}

.psych-submission-success p {
  margin: 0;
}

/* Location details visibility control */
.rwmb-field .location_details {
    display: block;
}

.rwmb-field.hidden {
    display: none;
} 

/* Search form styling */
.psych-search-form {
  margin-bottom: 20px;
}

.psych-search-form .location-field {
  position: relative;
  margin-bottom: 15px;
}

.psych-search-form input[type='text'] {
  width: 100%;
  padding: 10px;
  font-size: 16px;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.07);
}

.psych-search-form input[type='text']:focus {
  border-color: #007cba;
  box-shadow: 0 0 0 1px #007cba;
  outline: none;
}

/* Results table styling */
.psych-results-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.psych-results-table th,
.psych-results-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.psych-results-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #333;
}

.psych-results-table tr:hover {
  background: #f8f9fa;
}

.psych-results-table a {
  color: #007cba;
  text-decoration: none;
}

.psych-results-table a:hover {
  color: #00669b;
  text-decoration: underline;
}

/* Pagination styling */
.psych-pagination {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin: 20px 0;
}

.psych-pagination .page-number {
  padding: 8px 12px;
  border: 1px solid #ddd;
  background: #fff;
  color: #333;
  cursor: pointer;
  border-radius: 4px;
  font-size: 14px;
}

.psych-pagination .page-number:hover {
  background: #f8f9fa;
  border-color: #ccc;
}

.psych-pagination .page-number.active {
  background: #007cba;
  color: #fff;
  border-color: #006ba1;
}

/* Loading state */
.psych-search-loading {
  text-align: center;
  padding: 20px;
  color: #666;
}

/* Error message */
.psych-search-error {
  padding: 12px;
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
  border-radius: 4px;
  margin: 10px 0;
}

.psych-search-results {
  width: 100%;
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.psych-search__cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}

.psych-search__card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.psych-search__card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.psych-search__card-image {
  width: 100%;
  height: 200px;
  background: #f5f5f5;
  position: relative;
}

.psych-search__card-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.psych-search__card-placeholder {
  width: 100%;
  height: 100%;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.psych-search__card-content {
  padding: 1.5rem;
  flex-grow: 1;
}

.psych-search__card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 1rem;
  color: #333;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.psych-search__card-gender {
  display: inline-flex;
  align-items: center;
}

.psych-search__card-gender i {
  font-size: 1.1rem;
}

.psych-search__card-gender i.fa-mars {
  color: #4a90e2; /* Blue for male */
}

.psych-search__card-gender i.fa-venus {
  color: #e83e8c; /* Pink for female */
}

.psych-search__card-gender i.fa-venus-mars {
  color: #6f42c1; /* Purple for diverse */
}

.psych-search__card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: #666;
}

.psych-search__card-distance {
  padding: 0.25rem 0.5rem;
  background: #f0f0f0;
  border-radius: 4px;
}

.psych-search__card-address {
  flex-grow: 1;
}

.psych-search__card-section {
  margin-top: 1rem;
}

.psych-search__card-section-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: #555;
}

.psych-search__card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.psych-search__card-tag {
  font-size: 0.8rem;
  padding: 0.25rem 0.75rem;
  background: #f0f0f0;
  border-radius: 999px;
  color: #666;
}

.psych-search__card-tag--more {
  background: #e0e0e0;
}

.psych-search__card-actions {
  padding: 1rem 1.5rem;
  border-top: 1px solid #eee;
  background: #fafafa;
}

.psych-search__card-details-btn {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #007bff;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.psych-search__card-details-btn:hover {
  background: #0056b3;
}

/* Error and Empty States */
.psych-search__error,
.psych-search__empty {
  text-align: center;
  padding: 3rem 1rem;
  background: #f8f9fa;
  border-radius: 8px;
  margin: 2rem 0;
}

.psych-search__error p {
  color: #dc3545;
}

.psych-search__empty p {
  color: #6c757d;
}

/* Pagination */
.psych-search__pagination {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
}

.psych-search__pagination-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.psych-search__pagination-controls button {
  padding: 0.5rem 1rem;
  border: 1px solid #dee2e6;
  background: #fff;
  color: #007bff;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.psych-search__pagination-controls button:hover {
  background: #e9ecef;
}

.psych-search__pagination-controls button.active {
  background: #007bff;
  color: #fff;
  border-color: #007bff;
}

/* Responsive Design */
@media (max-width: 768px) {
  .psych-search__cards-grid {
    grid-template-columns: 1fr;
  }

  .psych-search__card-image {
    height: 150px;
  }
}

/* Filter Section */
.psych-search__filters {
  margin-bottom: 2rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
}

.psych-search__filters-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #333;
}

.psych-search__filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.psych-search__filter-group {
  margin-bottom: 1rem;
}

.psych-search__filter-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: #555;
}

.psych-search__filter-select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
}

.psych-search__filter-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.psych-search__filter-checkbox input[type='checkbox'] {
  margin: 0;
}

.psych-search__details-gender {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.psych-search__details-gender i {
    font-size: 1.5rem;
}

.psych-search__details-gender i.fa-mars {
    color: #4a90e2; /* Blue for male */
}

.psych-search__details-gender i.fa-venus {
    color: #e83e8c; /* Pink for female */
}

.psych-search__details-gender i.fa-venus-mars {
    color: #6f42c1; /* Purple for diverse */
}
