/* AdoPet Forms Styles
 * ---------------------
 * Search forms, inputs, floating labels, filters, buttons and location
 * widgets shared across the catalogue and LOST/FOUND experiences.
 *
 * NOTE: All selectors are kept identical to the legacy
 * adopet-search-form.css / adopet-public.css files; only the file
 * boundaries changed.
 */

/* Search Form Container */
.adopet-search-form {
    background-color: var(--adopet-background);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.search-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* Location and Distance Section */
.location-section {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
}

.location-input-wrapper {
    position: relative;
}

.location-input-wrapper .geolocation-button {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--adopet-primary);
}

.location-input-wrapper .geolocation-button:hover {
    color: var(--adopet-primary-dark);
}

/* Species Selection */
.species-buttons {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

/* Initial state */
.species-button,
.criteria-button {
    padding: 8px 16px !important;
    margin: 4px !important;
    border: 1px solid #ab1c2d !important;
    border-radius: 4px !important;
    background-color: #ffffff !important;
    color: #000000 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    position: relative !important;
    font-weight: 500 !important;
}

/* Hover state */
.species-button:hover,
.criteria-button:hover {
    background-color: #ab1c2d !important;
    color: #ffffff !important;
}

/* Focus state */
.species-button:focus,
.criteria-button:focus {
    background-color: #ab1c2d !important;
    color: #ffffff !important;
    outline: none !important;
}

/* Selected state */
.species-button.selected,
.criteria-button.selected {
    background-color: #000000 !important;
    color: #ffffff !important;
    border-color: #000000 !important;
}

/* Selected hover state */
.species-button.selected:hover,
.criteria-button.selected:hover {
    background-color: #333333 !important;
    border-color: #333333 !important;
}

/* Criteria buttons container */
.criteria-buttons {
    display: flex !important;
    gap: 0.625rem !important;
    margin-top: 0.625rem !important;
    flex-wrap: wrap !important;
    background-color: var(--primary-bg) !important;
    padding: 4px !important;
    border-radius: 6px !important;
}

/* Helper label */
.inline-filters-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.inline-filters-label::after {
    content: none;
}

.species-button.selected .species-icon {
    filter: brightness(0) invert(1);
}

/* Additional Filters */
.filters {
    grid-column: 1 / -1;
}

.filters h4 {
    margin: 0 0 15px;
    color: var(--adopet-text);
    font-size: 1.1em;
}

.filter-section {
    margin-bottom: 20px;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-section > label {
    display: block;
    margin-bottom: 10px;
    color: var(--adopet-text-secondary);
    font-weight: normal;
}

/* Form Actions */
.form-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 20px;
}

.search-button {
    flex: 2;
}

.reset-button {
    flex: 1;
}

/* Search Results */
.search-results {
    margin-top: 30px;
}

.results-count {
    margin-bottom: 20px;
    text-align: center;
}

.results-count p {
    font-size: 1.1rem;
    font-weight: 500;
    color: #333333;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
    display: inline-block;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: var(--adopet-text-secondary);
}

/* Loading Bar */
.loading-bar {
    width: 100%;
    height: 4px;
    background-color: var(--adopet-primary-light);
    border-radius: 2px;
    overflow: hidden;
    margin: 10px 0;
}

.loading-fill {
    height: 100%;
    background-color: var(--adopet-primary);
    transition: width 0.3s ease;
}

/* Show More Button */
.show-more-wrapper {
    text-align: center;
    margin-top: 30px;
}

.show-more-text {
    display: block;
    margin-bottom: 10px;
    color: var(--adopet-text-secondary);
}

/* Global inputs (search form + wizard fields) */
input[type=date],
input[type=email],
input[type=number],
input[type=password],
input[type=search],
input[type=tel],
input[type=text],
input[type=url],
select,
textarea {
    border: 1px solid #666666;
    border-radius: 3px;
    padding: .5rem 1rem;
    transition: all 0.3s;
    width: 20%;
}

/* Location form with icons (search form) */
.LocationForm-with-Icons {
    position: relative;
    width: 100%;
    max-width: 25rem;
    margin: 0.625rem 0;
    background-color: #ffffff;
    transition: background-color 0.3s ease;
}

.LocationForm-with-Icons.populated {
    background-color: #e8f0fd;
}

.LocationForm-textinput {
    width: 100%;
    height: 50px;
    padding: 0 48px 0 48px !important;
    font-size: 16px;
    color: #222222;
    background-color: transparent;
    border: 1px solid #dddddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.LocationForm-with-Icons .LocationForm-iconleft {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    pointer-events: none;
}

.LocationForm-with-Icons .LocationForm-iconright {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
}

.LocationForm-with-Icons .LocationForm-iconbutton {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.LocationForm-with-Icons .LocationForm-textinput {
    padding-left: 46px !important;
    padding-right: 46px !important;
}

.LocationForm-with-Icons .suggestion-box {
    position: absolute;
    width: 100%;
    background: #ffffff;
    border: 1px solid #dddddd;
    max-height: 220px;
    overflow-y: auto;
    z-index: 9999;
    top: calc(100% + 6px);
    left: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    border-radius: 8px;
    display: none;
}

.LocationForm-with-Icons .suggestion-box .suggestion {
    padding: 10px 12px;
    cursor: pointer;
}

.LocationForm-with-Icons .suggestion-box .suggestion:hover {
    background: #f7f7f7;
}

/* Species selection (inline buttons) */
.species-selection {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0;
    padding: 4px;
    border-radius: 6px;
    background-color: var(--primary-bg);
    width: fit-content;
}

.species-selection button {
    padding: 8px 16px;
    margin: 4px;
    border: 2px solid #ab1c2d;
    border-radius: 4px;
    background-color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    font-weight: 500;
}

.species-selection button:hover {
    background-color: #ab1c2d;
    color: #ffffff;
}

.species-selection button.selected {
    background-color: #000000;
    color: #ffffff;
    border-color: #000000;
}

/* Breed selection & dropdowns (search form) */
.breed-selection {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 25px;
    width: 33vw;
    margin: 0;
    box-sizing: border-box;
}

#breedSelect {
    width: 33vw;
    height: 50px;
    padding: 0 16px;
    font-size: 16px;
    line-height: 1.5;
    color: #222222;
    background-color: #ffffff;
    border: 1px solid #dddddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.breed-select-wrapper {
    display: none;
}

.selectdiv {
    position: relative;
    width: 33vw;
    margin: 0;
    box-sizing: border-box;
}

.selectdiv select {
    display: block;
    width: 33vw !important;
    height: 50px;
    padding: 0 70px 0 16px;
    font-size: 16px;
    line-height: 1.5;
    color: #ffffff;
    background-color: #03cbc0;
    border: 1px solid #03cbc0;
    border-radius: 4px;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* Multi-select dropdown */
.dropdown {
    position: relative;
    width: 33vw;
    margin: 10px 0 0 0;
    box-sizing: border-box;
}

.dropdown dd,
.dropdown dt {
    margin: 0;
    padding: 0;
}

.dropdown ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.dropdown dd {
    position: relative;
}

.dropdown dt a {
    background-color: #f5945c;
    display: block;
    padding: 12px 20px;
    min-height: 25px;
    line-height: 24px;
    overflow: hidden;
    border: 0;
    width: 100%;
    border-radius: 4px;
    position: relative;
    color: #ffffff;
}

.dropdown dt a.disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.7;
}

.dropdown dd ul {
    background-color: #f5945c;
    border: 0;
    color: #ffffff;
    display: none;
    left: 0;
    padding: 15px;
    position: absolute;
    top: 100%;
    width: 100%;
    list-style: none;
    max-height: 400px;
    overflow-y: auto;
    border-radius: 4px;
    margin-top: 5px;
    z-index: 999;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dropdown dd ul li {
    padding: 8px 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown dd ul li input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.dropdown dd ul li label {
    cursor: pointer;
    flex: 1;
}

.dropdown button {
    background-color: #f5945c;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 12px 0;
    margin: 10px 0 0 0;
    text-align: center;
    color: #ffffff;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.dropdown button:hover {
    background-color: #f4834d;
}

/* New breed multi-select dropdown (dropdown-new) */
.dropdown-new {
    position: relative;
    width: 25rem;
    margin: 0.625rem 0;
    border: 2px solid #e47d45;
    border-radius: 0.25rem;
    overflow: visible;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: #ffffff;
    border-radius: 4px;
    cursor: pointer;
}

.dropdown-header span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 0.625rem;
    min-width: 0;
}

.chevron {
    transition: transform 0.2s ease;
    fill: currentColor;
}

.chevron.up {
    transform: rotate(180deg);
}

.chevron.disabled {
    fill: #888888;
}

.filter-button {
    display: block;
    width: calc(100% - 2rem);
    padding: 0.75rem 0.625rem;
    margin: 0.5rem 1rem;
    font-size: 1rem;
    cursor: pointer;
    background-color: #fe6f61;
    color: #ffffff;
    border: none;
    border-radius: 0.25rem;
    transition: background-color 0.3s ease;
    text-align: center;
}

.filter-button:hover {
    background-color: #e47d45;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: -2px;
    width: calc(100% + 4px);
    max-height: 300px;
    overflow-y: auto;
    background-color: #ffffff;
    border: 2px solid #e47d45;
    border-top: none;
    border-radius: 0 0 4px 4px;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.category-header,
.dropdown-content .category-header,
#dropdown-content .category-header {
    padding: 10px 15px !important;
    font-weight: 600 !important;
    background-color: #f5945c !important;
    border-bottom: 1px solid #dddddd !important;
    color: #ffffff !important;
    text-transform: uppercase !important;
    font-size: 0.85rem !important;
    letter-spacing: 0.5px !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 1 !important;
}

.dropdown-content div:not(.category-header) {
    padding: 8px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #eeeeee;
}

.dropdown-content div:not(.category-header):hover {
    background-color: #f5f5f5;
}

.dropdown-content input[type="checkbox"] {
    margin-right: 0.625rem;
    cursor: pointer;
}

.dropdown-content label {
    cursor: pointer;
    user-select: none;
    margin-bottom: 0;
}

/* Distance / radius controls */
.distance-controls {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.distance-slider {
    width: 100%;
    max-width: 25rem;
    accent-color: #c93265;
    transition: accent-color 0.3s ease;
}

.distance-slider.unlimited {
    accent-color: #000000;
}

.distance-value {
    display: inline-block;
    margin-left: 0.625rem;
    font-size: 1rem;
    color: #666666;
    min-width: 3rem;
    text-align: left;
}

/* Show Pets button */
.show-pets-btn {
    width: 25vw;
    padding: 0.75rem;
    font-size: 1rem;
    border: none;
    border-radius: 0.25rem;
    background-color: var(--lost-color);
    color: #ffffff;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: block;
    margin: 1rem 0 0.5rem 0;
}

.show-pets-btn:hover {
    background-color: var(--lost-color) !important;
    color: #ffffff !important;
}

/* Dynamic results counter */
.adopet-results-counter {
  display: flex;
  align-items: center;
  margin: .25rem 0 1rem 0;
}

.adopet-results-chip {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: .45rem .9rem;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, #f7f7f9);
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06), inset 0 0 0 2px rgba(201,50,101,0.08);
  color: #222222;
  font-weight: 600;
  font-size: 1rem;
}

.adopet-results-dot {
  width: .6rem;
  height: .6rem;
  border-radius: 50%;
  background: #c93265;
  box-shadow: 0 0 0 4px rgba(201,50,101,0.15);
}

.adopet-results-counter .success .adopet-results-dot {
  background: #1f7a3f;
  box-shadow: 0 0 0 3px rgba(31,122,63,0.15);
}

.adopet-results-text {
  letter-spacing: .2px;
}

/* Loading overlay during async search */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* Clear filters button */
.clear-filters {
    display: block !important;
    width: fit-content;
    background: none;
    color: #c93265;
    border: none;
    text-decoration: underline;
    cursor: pointer;
    margin: 0.5rem 0 0.5rem 0;
    font-family: inherit;
    transition: all 0.2s ease;
}

.clear-filters + .show-pets-btn {
    display: block !important;
}

.clear-filters:hover {
    background-color: #ab1c2d !important;
    color: #ffffff !important;
    text-decoration: none !important;
    border-radius: 6px;
    padding: 4px 8px;
}
