/* Variables temáticas - se pueden sobrescribir */
:root {
    --propiedades360-primary: var(--wp--preset--color--primary, #2271b1);
    --propiedades360-secondary: var(--wp--preset--color--secondary, #135e96);
    --propiedades360-background: var(--wp--preset--color--background, white);
    --propiedades360-text: var(--wp--preset--color--text, #2c3338);
    --propiedades360-border: var(--wp--preset--color--border, #dcdcde);
    --propiedades360-radius: var(--wp--custom--border-radius, 4px);
    --propiedades360-spacing: var(--wp--custom--spacing, 1rem);

    /* Nuevas variables para personalización */
    --prop-search-bg: transparent;
    --prop-search-font-family: inherit;
    --prop-search-font-color: inherit;
    --prop-search-input-bg: inherit;
    --prop-search-btn-bg: var(--accent-color, #3498db);
    --prop-search-btn-color: var(--button-text-color, #fff);
    --prop-search-btn-bg-hover: #2980b9;
}

/* Contenedor principal */
.propiedades360-search {
    --local-primary: var(--propiedades360-primary);
    --local-secondary: var(--propiedades360-secondary);
    --local-background: var(--propiedades360-background);
    --local-text: var(--propiedades360-text);
    --local-border: var(--propiedades360-border);
    --local-radius: var(--propiedades360-radius);
    --local-spacing: var(--propiedades360-spacing);
    max-width: 100%;
    margin: 0 auto;
    padding: var(--local-spacing);
    box-sizing: border-box;
}

/* Tema personalizado - override de variables locales */
.propiedades360-search.theme-custom {
    --local-primary: var(--custom-primary, var(--propiedades360-primary));
    --local-secondary: var(--custom-secondary, var(--propiedades360-secondary));
}

/* Formulario de búsqueda */
.search-form {
    background: var(--local-background);
    padding: calc(var(--local-spacing) * 1.5);
    border-radius: var(--local-radius);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: calc(var(--local-spacing) * 2);
    box-sizing: border-box;
}

/* Layout Horizontal */
.propiedades360-search.horizontal .search-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--local-spacing);
    align-items: end;
}

/* Layout Vertical */
.propiedades360-search.vertical .field-group {
    margin-bottom: var(--local-spacing);
}

.propiedades360-search.vertical .search-actions {
    justify-content: flex-start;
}

/* Campos de formulario */
.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-sizing: border-box;
}

.search-input,
.search-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--local-border);
    border-radius: var(--local-radius);
    font-size: 14px;
    box-sizing: border-box;
}

.price-range {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

/* Botón de búsqueda */
.search-actions {
    margin-top: var(--local-spacing);
    display: flex;
    justify-content: flex-end;
}

.search-submit {
    background: var(--local-primary);
    color: var(--local-background);
    border: none;
    padding: 10px 24px;
    border-radius: var(--local-radius);
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s ease;
}

.search-submit:hover {
    background: var(--local-secondary);
}

/* Resultados de búsqueda */
.search-results {
    position: relative;
    min-height: 50px;
    transition: opacity 0.3s ease;
}

.search-results.loading {
    opacity: 0.7;
}

/* Loading state */
.search-loading {
    position: relative;
    text-align: center;
    padding: calc(var(--local-spacing) * 2);
}

.search-loading::after {
    content: "";
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid var(--local-border);
    border-radius: 50%;
    border-top-color: var(--local-primary);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Paginación */
.search-pagination {
    margin-top: var(--local-spacing);
    display: flex;
    justify-content: center;
}

.pagination-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-number {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    background-color: #f5f5f5;
    border-radius: var(--local-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.page-number.active {
    background-color: var(--local-primary);
    color: white;
}

.page-number:hover:not(.active) {
    background-color: #e5e5e5;
}

.page-dots {
    margin: 0 0.2rem;
}

/* Estado sin resultados */
.no-results {
    text-align: center;
    padding: calc(var(--local-spacing) * 2);
    background-color: #f9f9f9;
    border-radius: var(--local-radius);
}

/* Error */
.search-error {
    color: #d32f2f;
    text-align: center;
    padding: var(--local-spacing);
    background-color: #fdecea;
    border-radius: var(--local-radius);
}

/* Responsive */
@media (max-width: 768px) {
    .propiedades360-search.horizontal .search-fields {
        grid-template-columns: 1fr;
    }
    
    .price-range {
        grid-template-columns: 1fr;
    }
    
    .search-actions {
        justify-content: center;
    }
}

/* Estilos básicos para el buscador */
.propiedades360-search-container {
    background: var(--prop-search-bg, transparent);
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    box-shadow: none; /* Se elimina la sombra para un fondo transparente */
}

.search-title {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.5em;
    color: var(--prop-search-font-color, inherit);
    font-family: var(--prop-search-font-family, inherit);
}

.property-search-form .search-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.property-search-form .search-field {
    flex: 1;
    min-width: 200px;
}

.property-search-form input[type="text"],
.property-search-form select {
    background: var(--prop-search-input-bg, inherit);
    border: 1px solid #ddd;
    font-family: var(--prop-search-font-family, inherit);
    color: var(--prop-search-font-color, inherit);
    width: 100%;
    padding: 10px;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
}

.property-search-form .search-button {
    flex: 0 0 auto;
}

.property-search-form button {
    background: var(--prop-search-btn-bg, var(--accent-color, #3498db));
    color: var(--prop-search-btn-color, #fff);
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--prop-search-font-family, inherit);
    font-size: 16px;
    transition: background 0.3s;
}

.property-search-form button:hover {
    background: var(--prop-search-btn-bg-hover, #2980b9);
}

/* Resultados AJAX */
.search-results-container {
    margin-top: 20px;
    position: relative;
}

.search-results-container.loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 1;
}

.search-results-container .loading {
    text-align: center;
    padding: 20px;
}

.search-results-container .error,
.search-results-container .no-results {
    padding: 20px;
    background: #fff1f0;
    border: 1px solid #ffccc7;
    border-radius: 4px;
    color: #a8071a;
    margin: 10px 0;
}

/* Grilla de resultados */
.properties-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* Tarjeta de propiedad en resultados */
.property-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
}

.property-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.property-image {
    width: 100%;
    padding-top: 66.67%; /* Proporción 3:2 */
    position: relative;
    overflow: hidden;
}

.property-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.property-content {
    padding: 15px;
}

.property-content h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 18px;
}

.property-content h3 a {
    color: #333;
    text-decoration: none;
}

.property-meta {
    margin-bottom: 10px;
}

.property-price {
    font-weight: bold;
    color: #2980b9;
    font-size: 18px;
}

.property-location {
    color: #777;
    font-size: 14px;
    margin-top: 5px;
}

.property-taxonomies {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.property-modalidad,
.property-tipo {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.property-modalidad {
    background: #C2140E;
    color: #ffffff;
}

.property-tipo {
    background: #D9D5D4;
    color: #000;
}

/* Mejoras en las características adicionales */
.property-custom-container {
    margin-top: 1rem;
    padding: 0.5rem 0;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.property-additional-features ul {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.property-additional-features li {
    font-size: 0.8rem;
    color: #666;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0;
}

.property-additional-features li::before {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.6;
}

/* Iconos específicos para diferentes características */
.property-additional-features li:has(:contains("Habitaciones"))::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23666666'%3E%3Cpath d='M20 9.557V3h-2v2H6V3H4v6.557C2.81 10.25 2 11.525 2 13v4a1 1 0 0 0 1 1h1v4h2v-4h12v4h2v-4h1a1 1 0 0 0 1-1v-4c0-1.475-.811-2.75-2-3.443zM18 7v2H6V7h12zM6 13a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm12 0a1 1 0 1 1 0-2 1 1 0 0 1 0 2z'/%3E%3C/svg%3E");
}

.property-additional-features li:has(:contains("Pileta"))::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23666666'%3E%3Cpath d='M22 21c-1.11 0-1.73-.37-2.18-.64-.37-.22-.6-.36-1.15-.36-.56 0-.78.13-1.15.36-.46.27-1.07.64-2.18.64s-1.73-.37-2.18-.64c-.37-.22-.6-.36-1.15-.36-.56 0-.78.13-1.15.36-.46.27-1.08.64-2.19.64-1.11 0-1.73-.37-2.18-.64-.37-.23-.6-.36-1.15-.36s-.78.13-1.15.36c-.46.27-1.08.64-2.19.64v-2c.56 0 .78-.13 1.15-.36.46-.27 1.08-.64 2.19-.64s1.73.37 2.18.64c.37.23.59.36 1.15.36.56 0 .78-.13 1.15-.36.46-.27 1.08-.64 2.19-.64 1.11 0 1.73.37 2.18.64.37.22.6.36 1.15.36s.78-.13 1.15-.36c.45-.27 1.07-.64 2.18-.64s1.73.37 2.18.64c.37.23.59.36 1.15.36v2zm0-4.5c-1.11 0-1.73-.37-2.18-.64-.37-.22-.6-.36-1.15-.36-.56 0-.78.13-1.15.36-.45.27-1.07.64-2.18.64s-1.73-.37-2.18-.64c-.37-.22-.6-.36-1.15-.36-.56 0-.78.13-1.15.36-.45.27-1.07.64-2.18.64s-1.73-.37-2.18-.64c-.37-.22-.6-.36-1.15-.36s-.78.13-1.15.36c-.47.27-1.09.64-2.2.64v-2c.56 0 .78-.13 1.15-.36.45-.27 1.07-.64 2.18-.64s1.73.37 2.18.64c.37.22.6.36 1.15.36.56 0 .78-.13 1.15-.36.45-.27 1.07-.64 2.18-.64s1.73.37 2.18.64c.37.22.6.36 1.15.36s.78-.13 1.15-.36c.45-.27 1.07-.64 2.18-.64s1.73.37 2.18.64c.37.22.6.36 1.15.36v2z'/%3E%3C/svg%3E");
}

.property-additional-features li:has(:contains("Patio"))::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23666666'%3E%3Cpath d='M12 22a9 9 0 0 1-9-9 9 9 0 0 1 9-9 9 9 0 0 1 9 9 9 9 0 0 1-9 9m0-20a11 11 0 0 0-11 11 11 11 0 0 0 11 11 11 11 0 0 0 11-11A11 11 0 0 0 12 2m-.5 5v5.25l4.5 2.67-.75 1.23L10 13V7h1.5z'/%3E%3C/svg%3E");
}

/* Estado activo/hover */
.property-additional-features li:hover {
    color: var(--propiedades360-primary, #2271b1);
}

.property-additional-features li:hover::before {
    opacity: 1;
}

/* Responsive */
@media (max-width: 480px) {
    .property-additional-features ul {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .property-additional-features li {
        padding: 0.3rem 0;
    }
}

/* Paginación */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    gap: 5px;
}

.page-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.page-number:hover {
    background: #e6f7ff;
    border-color: #C2140E;
}

.page-number.active {
    background: #C2140E;
    border-color: #C2140E;
    color: white;
}

/* Contador de resultados */
.results-count {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

/* Responsive */
@media (max-width: 768px) {
    .property-search-form .search-fields {
        flex-direction: column;
    }
    
    .property-search-form .search-field {
        width: 100%;
    }
    
    .properties-grid {
        grid-template-columns: 1fr;
    }
}
