/**
 * Estilos del buscador de propiedades
 * 
 * IMPORTANTE: Todos los selectores están específicamente dirigidos a .apis-buscador-form
 * para evitar conflictos con otros elementos de la página y prevenir el bug de hover
 * que afectaba a otros botones.
 */

/* Hacer el buscador sticky cuando sale del viewport */
.apis-buscador-form.is-sticky {
    position: fixed;
    top: var(--sticky-top-offset, 0);
    left: 0;
    right: 0;
    z-index: 998; /* Justo debajo del nav (que típicamente usa 999 o 1000) */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    animation: slideDown 0.3s ease;
    background-color: #FFF!important;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Botón toggle para plegar/desplegar cuando está sticky */
.apis-sticky-toggle {
    display: none;
    padding: 10px 20px;
    cursor: pointer;
    -webkit-backdrop-filter: blur(30px) brightness(124%);
    backdrop-filter: blur(30px) brightness(124%);
    background-color: rgba(255, 255, 255, .95);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.apis-buscador-form.is-sticky .apis-sticky-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.apis-sticky-toggle:hover {
    background-color: rgba(255, 255, 255, 1);
}

.apis-sticky-toggle-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.apis-sticky-toggle-icon {
    font-size: 18px;
    color: #333;
}

.apis-sticky-toggle-text {
    font-weight: 600;
    font-size: 15px;
    color: #333;
}

.apis-sticky-toggle-chevron 
{
    font-size: 18px;
    color: #666;
    transition: transform 0.3s ease;
    transform: rotate(180deg);
}

/* Contenido colapsable del buscador sticky */
.apis-buscador-form.is-sticky .buscador-propiedades-container 
{
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out, opacity 0.3s ease;
    opacity: 1;
}

.apis-buscador-form.is-sticky.collapsed .buscador-propiedades-container 
{
    max-height: 0;
    opacity: 0;
}

.apis-buscador-form.is-sticky.collapsed .tipo-operacion-container 
{
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.apis-buscador-form.is-sticky.collapsed .apis-sticky-toggle-chevron 
{
    transform: rotate(0deg);
}

/* Placeholder para mantener el espacio cuando el form es sticky */
.apis-buscador-placeholder {
    display: none;
}

.apis-buscador-placeholder.active {
    display: block;
}

/* Contenedor principal del buscador */
.apis-buscador-form {
    padding: 0;
    overflow: hidden;
    margin: 0 auto;
}
.buscador-propiedades-container
{
    -webkit-backdrop-filter: blur(30px) brightness(124%);
    backdrop-filter: blur(30px) brightness(124%);
    background-color: rgba(255, 255, 255, .41);
}

.buscador-propiedades {
    background: transparent;
    padding: 25px;
    border: none;
    align-items: center;
}

/* Pestañas de operación (Venta/Alquiler) */


.apis-buscador-form .btn-group {
    margin-bottom: 0;
    background: transparent;
    box-shadow: none;
    width: 100%;
    position: relative;
}

.apis-buscador-form .btn-operaciones {
    border: none;
    padding: 8px 20px;
    cursor: pointer;
    outline: none !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: blur(30px) brightness(124%);
    backdrop-filter: blur(30px) brightness(124%);
    background-color: rgba(255, 255, 255, .41);
    color: rgba(0, 0, 0, 0.8) !important;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.3s ease;
    position: relative;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    border-radius: 5px 5px 0 0;
}

.apis-buscador-form .btn-operaciones:hover {
    background: transparent;
    color: #FFF;
    border-bottom-color: #dee2e6;
}

.apis-buscador-form .btn-check:checked + .btn-operaciones 
{
    -webkit-backdrop-filter: blur(30px) brightness(124%);
    backdrop-filter: blur(30px) brightness(124%);
    background-color: rgba(255, 255, 255, .41);
    color: #000;
    font-weight: 600;
    border-bottom-color: #2fbcd6;
    transform: none;
    box-shadow: none;
}

/* Campos del formulario */
.form-group {
    margin-bottom: 0;
}

.buscador-propiedades .d-flex {
    gap: 12px;
}

.buscador-propiedades .form-group:not(.container-price-range):not(.d-flex):not(.ms-4) {
    flex: 1;
    min-width: 180px;
}

/* Inputs y selects mejorados */
.buscador-propiedades input,
.buscador-propiedades select {
    height: 100%;
    min-height: 50px;
    border: 1px solid #e9ecef;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 400;
    color: #495057;
    background: #fff;
    transition: all 0.3s ease;
    outline: none !important;
}

.buscador-propiedades input:focus,
.buscador-propiedades select:focus {
    border-color: #2fbcd6;
    box-shadow: 0 0 0 2px rgba(255, 204, 0, 0.15) !important;
}

.buscador-propiedades input::placeholder {
    color: #adb5bd;
    font-weight: 400;
}

/* Select2 mejorado */
.select2-container--bootstrap-5 .select2-selection--single {
    height: 42px !important;
    border: 1px solid #e9ecef !important;
    padding: 0 !important;
    background: #fff !important;
    transition: all 0.3s ease !important;
}

.select2-container--bootstrap-5 .select2-selection__rendered {
    line-height: 40px !important;
    padding-left: 12px !important;
    color: #495057 !important;
    font-size: 14px !important;
}

.select2-container--bootstrap-5 .select2-selection__arrow {
    height: 40px !important;
    right: 10px !important;
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection--single,
.select2-container--bootstrap-5.select2-container--open .select2-selection--single {
    border-color: #2fbcd6 !important;
    box-shadow: 0 0 0 2px rgba(255, 204, 0, 0.15) !important;
}

/* Contenedor del botón centrado */
.form-group.d-flex.justify-content-end {
    justify-content: center !important;
}

/* Botón de búsqueda mejorado - Específico para el buscador */
.apis-buscador-form .btn-buscar {
    background: #7e6a5a;
    border: none;
    color: #FFF;
    padding: 12px 30px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none !important;
    letter-spacing: 0.5px;
    min-width: 180px;
    position: relative;
    overflow: hidden;
}

.apis-buscador-form .btn-buscar i {
    margin-right: 6px;
    font-size: 16px;
}

/* Botón avanzado - Específico para el buscador */
.apis-buscador-form .btn-avanzado {
    background: #000;
    border: none;
    color: #fff;
    padding: 12px 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none !important;
    text-transform: none;
    letter-spacing: 0.3px;
    min-width: 140px;
    position: relative;
    z-index: 1;
}

.apis-buscador-form .btn-avanzado:hover {
    background: #7c877f;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.apis-buscador-form .btn-avanzado:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.apis-buscador-form .btn-avanzado i {
    margin-right: 6px;
    font-size: 16px;
}

/* Botón buscar - Específico para el buscador */
.apis-buscador-form .btn-buscar {
    position: relative;
    overflow: hidden;
}

.apis-buscador-form .btn-buscar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
    z-index: -1;
}

.apis-buscador-form .btn-buscar:hover::before {
    left: 100%;
}

.apis-buscador-form .btn-buscar:hover {
    background: linear-gradient(135deg, #000 0%, #333 100%);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.apis-buscador-form .btn-buscar:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}



/* Estilos de error para Select2 */
.select2-container--error .select2-selection {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.15) !important;
    animation: shake 0.5s ease-in-out;
}

/* Eliminar border-radius de todos los form-control y selects */
.form-control,
.widget_categories select,
.widget_archive select,
select {
    border-radius: 0 !important;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Dropdown de Select2 mejorado */
.select2-dropdown {
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-top: none;
    margin-top: -1px;
}

.select2-results__option {
    padding: 12px 16px;
    font-size: 15px;
    transition: all 0.2s ease;
}

.select2-results__option--highlighted {
    background: #000 !important;
    color: #FFF !important;
}
.apis-properties-container{
    margin-top: 2rem;
}

/* ===== MODAL AVANZADO ===== */
.modal-content {
    border: 1px solid #dee2e6;
    overflow: hidden;
}

.modal-header {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 20px 25px;
}

.modal-title {
    color: #495057;
    font-weight: 600;
    font-size: 18px;
    margin: 0;
}

.modal-title i {
    color: #6c757d;
    margin-right: 8px;
}

.modal-body {
    padding: 25px;
}

.modal-body h6 {
    color: #495057;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e9ecef;
}

.modal-body h6 i {
    color: #2fbcd6;
    margin-right: 8px;
}

.modal-body .form-check {
    margin-bottom: 12px;
}

.modal-body .form-check-label {
    color: #495057;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.modal-body .form-check-label:hover {
    color: #2fbcd6;
}

.modal-body .form-check-input:checked {
    background-color: #2fbcd6;
    border-color: #2fbcd6;
}

.modal-body .form-check-input:focus {
    box-shadow: 0 0 0 2px rgba(255, 204, 0, 0.25);
}

.modal-footer {
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 20px 25px;
}

.modal-footer .btn {
    padding: 10px 25px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.modal-footer .btn-primary {
    background: #2fbcd6;
    border: none;
    color: #FFF;
}

.modal-footer .btn-primary:hover {
    background: #000;
    color: #fff;
}

.modal-footer .btn-secondary {
    background: #6c757d;
    border: none;
    color: #fff;
}

.modal-footer .btn-secondary:hover {
    background: #495057;
    color: #fff;
}

/* ===== PREVENCIÓN DE CONFLICTOS DE ESTILOS ===== */
/* Reset específico para botones dentro del buscador */
.apis-buscador-form button {
    position: relative;
    z-index: 1;
}

.apis-buscador-form button:focus {
    outline: 2px solid #2fbcd6;
    outline-offset: 2px;
}

/* Asegurar que los estilos del buscador no afecten otros elementos */
.apis-buscador-form * {
    box-sizing: border-box;
}

/* ===== MEJORAS DE ACCESIBILIDAD PARA MODALES ===== */
.modal {
    /* Asegurar que el modal sea accesible cuando está visible */
    outline: none;
}

.modal:not([aria-hidden="true"]) {
    /* Estilos específicos cuando el modal está visible */
    z-index: 1055;
}

.modal:not([aria-hidden="true"]) .modal-dialog {
    /* Asegurar que el modal sea visible y accesible */
    pointer-events: auto;
}

/* Mejorar el contraste de focus para elementos dentro del modal */
.modal .btn:focus,
.modal .form-control:focus,
.modal .form-check-input:focus {
    outline: 2px solid #2fbcd6;
    outline-offset: 2px;
}

/* Asegurar que los botones del modal sean accesibles */
.modal .btn {
    position: relative;
}

.modal .btn:focus::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid #2fbcd6;
    border-radius: inherit;
    pointer-events: none;
}

/* Mejorar la accesibilidad del botón de cerrar */
.modal .btn-close:focus {
    outline: 2px solid #2fbcd6;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Asegurar que el modal mantenga el foco cuando está abierto */
.modal.show {
    display: block !important;
}

.modal.show .modal-dialog {
    pointer-events: auto;
}

/* Prevenir que el foco escape del modal cuando está abierto */
.modal:not([aria-hidden="true"]) .modal-content {
    outline: none;
}

/* Mejorar la accesibilidad de los inputs del modal */
.modal .form-control:focus {
    border-color: #2fbcd6;
    box-shadow: 0 0 0 0.2rem rgba(255, 204, 0, 0.25);
}

/* Asegurar que los checkboxes sean accesibles */
.modal .form-check-input:focus {
    border-color: #2fbcd6;
    box-shadow: 0 0 0 0.2rem rgba(255, 204, 0, 0.25);
}
.buscador-propiedades span.select2-selection.select2-selection--single
{
   border-radius: 0 !important;
   height: 100% !important;
   min-height: 50px !important;
   display: flex;
   align-items: center;
}
/* Responsive para el modal */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 10px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-body .row {
        flex-direction: column;
    }
    
    .modal-body .col-md-6 {
        margin-bottom: 20px;
    }
    
    .modal-body .price-inputs {
        flex-direction: column;
        gap: 10px;
    }
    
    .modal-body .price-inputs .input-group {
        width: 100%;
    }
}
/* ===== CAMPOS DE PRECIO EN MODAL ===== */
.modal-body .price-inputs {
    display: flex;
    gap: 15px;
    align-items: center;
}

.modal-body .price-inputs .input-group {
    flex: 1;
    min-width: 150px;
}

.modal-body .price-inputs .input-group-text {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-right: none;
    color: #6c757d;
    font-weight: 500;
    font-size: 14px;
    padding: 0 12px;
}

.modal-body .price-inputs .form-control {
    border-left: none;
    height: 42px;
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    background: #fff;
    transition: all 0.3s ease;
}

.modal-body .price-inputs .form-control:focus {
    border-color: #2fbcd6;
    box-shadow: 0 0 0 2px rgba(255, 204, 0, 0.15);
    background: #fff;
}

.modal-body .price-inputs .form-control.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.15);
}

.modal-body .price-inputs .form-control.is-invalid + .input-group-text {
    border-color: #dc3545;
    color: #dc3545;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .buscador-propiedades {
        padding: 20px 25px;
    }
    
    .buscador-propiedades .d-flex {
        flex-direction: column;
        gap: 15px;
    }
    
    .btn-operaciones {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .container-price-range {
        max-width: 100%;
        margin-top: 10px;
    }
    
    .price-inputs {
        flex-direction: column;
        gap: 10px;
    }
    
    .price-inputs .input-group {
        width: 100%;
    }
    
    .btn-buscar {
        width: 100%;
        padding: 15px;
    }
}