/**
 * LOCATION FORM COMPONENT STYLES
 * Simple styling for location form - España = selectores, Otros países = texto
 */

/* ===================================
   LOCATION CONTAINER
   =================================== */

.location-selector-container {
    position: relative;
}

/* ===================================
   DISPLAY CONTROL
   =================================== */

/* Hide all by default */
#spain-province-select,
#spain-city-select,
#other-province-input,
#other-city-input {
    display: none;
}

/* Hide original select elements when Choices.js is active */
.location-selector-container select.spain-province-select,
.location-selector-container select.spain-city-select {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    height: 0;
    width: 0;
}

/* Spain mode - show selects */
.location-selector-container.spain-mode #spain-province-select,
.location-selector-container.spain-mode #spain-city-select {
    display: block !important;
}

/* Other mode - show text inputs */
.location-selector-container.other-mode #other-province-input,
.location-selector-container.other-mode #other-city-input {
    display: block !important;
}

/* ===================================
   HELPER TEXT CONTROL
   =================================== */

.location-selector-container .default-text {
    display: inline;
}

.location-selector-container .spain-mode-text {
    display: none;
}

/* Spain mode text visibility */
.location-selector-container.spain-mode .default-text {
    display: none;
}

.location-selector-container.spain-mode .spain-mode-text {
    display: inline;
}

/* ===================================
   FORM STYLING
   =================================== */

.form-control:focus,
.form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-control.is-valid,
.form-select.is-valid {
    border-color: #198754;
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #dc3545;
}

/* ===================================
   GEOCODING STYLES
   =================================== */

#geocode-search-btn {
    transition: all 0.2s ease;
}

#geocode-search-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#geocode-search-btn .spinner-border {
    display: none;
    width: 1rem;
    height: 1rem;
}

#geocode-search-btn.searching .spinner-border {
    display: inline-block;
}

/* ===================================
   COORDINATES MAP
   =================================== */

#coordinates-map-container {
    margin-top: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

#coordinates-map {
    height: 300px;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* ===================================
   CHOICES.JS CUSTOM STYLES
   =================================== */

/* Override Choices.js to match Bootstrap 5 form-select styling */
.location-selector-container .choices {
    margin-bottom: 0;
}

.location-selector-container .choices__inner {
    display: block;
    width: 100%;
    padding: 0.375rem 2.25rem 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    min-height: 38px;
}

.location-selector-container .choices__inner:focus,
.location-selector-container .choices.is-focused .choices__inner {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.location-selector-container .choices__list--dropdown {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    z-index: 2000 !important;
    position: absolute;
}

/* Ensure the choices container has proper z-index when open */
.location-selector-container .choices.is-open {
    z-index: 2000 !important;
}

.location-selector-container .choices__list--dropdown .choices__item--selectable {
    padding: 0.5rem 1rem;
    font-size: 1rem;
    color: #212529;
}

.location-selector-container .choices__list--dropdown .choices__item--selectable.is-highlighted {
    background-color: #e7f1ff;
    color: #212529;
}

/* Hide default Choices.js arrow since we're using Bootstrap's */
.location-selector-container .choices[data-type*="select-one"]::after {
    display: none;
}

.location-selector-container .choices[data-type*="select-one"] .choices__button {
    display: none;
}

.location-selector-container .choices__list--single {
    padding: 0;
}

.location-selector-container .choices__item {
    font-size: 1rem;
}

/* Disabled state */
.location-selector-container .choices.is-disabled .choices__inner {
    background-color: #e9ecef;
    opacity: 1;
    cursor: not-allowed;
}

/* Search input styling */
.location-selector-container .choices__input {
    color: #212529;
    font-size: 1rem;
}

.location-selector-container .choices__input::placeholder {
    color: #6c757d;
    opacity: 0.8;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

@media (max-width: 768px) {
    .location-selector-container .row > .col-md-4,
    .location-selector-container .row > .col-md-8 {
        margin-bottom: 1rem;
    }
}
