/**
 * Estilos Frontend WP Inmovilla
 */

/* ============================================
   GRID DE PROPIEDADES
   ============================================ */

/* Especificidad extra para ganar sobre Elementor */
div.inmovilla-properties-grid,
.elementor-widget-container .inmovilla-properties-grid,
.elementor-element .inmovilla-properties-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 30px !important;
    margin: 30px 0 !important;
    width: 100% !important;
}

/* Si el contenedor es más estrecho, ajustar a 2 columnas */
@media (max-width: 1200px) {
    div.inmovilla-properties-grid,
    .elementor-widget-container .inmovilla-properties-grid,
    .elementor-element .inmovilla-properties-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* En tablets y móviles: 1 columna */
@media (max-width: 768px) {
    div.inmovilla-properties-grid,
    .elementor-widget-container .inmovilla-properties-grid,
    .elementor-element .inmovilla-properties-grid {
        grid-template-columns: 1fr !important;
    }
}

.inmovilla-property-card,
.inmovilla-properties-grid .inmovilla-property-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: auto !important;
    max-width: 100% !important;
}

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

/* Imagen */
.property-image {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
    background: #f5f5f5;
}

.property-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.inmovilla-property-card:hover .property-image img {
    transform: scale(1.1);
}

.property-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    color: #999;
}

.property-no-image .dashicons {
    font-size: 64px;
    width: 64px;
    height: 64px;
}

/* Badges */
.property-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 4px;
    z-index: 2;
}

.property-badge-destacada {
    background: #ff6b35;
    color: #fff;
}

.property-badge-exclusiva {
    background: #2a9d8f;
    color: #fff;
    top: 45px;
}

.property-operation {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    z-index: 2;
}

/* Contenido */
.property-content {
    padding: 20px;
}

.property-price {
    font-size: 24px;
    font-weight: 700;
    color: #2271b1;
    margin-bottom: 10px;
}

.property-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
}

.property-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.property-title a:hover {
    color: #2271b1;
}

.property-location {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
}

.property-location .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

/* Características */
.property-features {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
    padding: 15px 0;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
}

.property-feature {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    color: #666;
}

.property-feature .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
    color: #999;
}

/* Excerpt */
.property-excerpt {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
}

/* Footer */
.property-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.property-ref {
    font-size: 12px;
    color: #999;
    text-transform: uppercase;
    font-weight: 600;
}

.property-link {
    color: #2271b1;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: color 0.3s ease;
}

.property-link:hover {
    color: #135e96;
}

/* ============================================
   BUSCADORES
   ============================================ */

.inmovilla-search-form {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin: 30px 0;
}

/* Buscador simple */
.inmovilla-search-simple .search-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

/* Buscador avanzado */
.inmovilla-search-advanced .search-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.search-field label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.search-field select,
.search-field input[type="number"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.search-field select:focus,
.search-field input[type="number"]:focus {
    outline: none;
    border-color: #2271b1;
}

.search-submit,
.search-submit-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.btn-search {
    background: #2271b1;
    color: #fff;
    border: none;
    padding: 12px 30px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.3s ease;
}

.btn-search:hover {
    background: #135e96;
}

.btn-search .dashicons {
    width: 20px;
    height: 20px;
    font-size: 20px;
}

.btn-reset {
    background: #fff;
    color: #666;
    border: 1px solid #ddd;
    padding: 12px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-reset:hover {
    background: #f5f5f5;
    border-color: #999;
}

/* ============================================
   FICHA INDIVIDUAL
   ============================================ */

.inmovilla-property-single {
    padding: 40px 0;
}

.inmovilla-property-single .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Galería */
.property-gallery {
    margin-bottom: 40px;
}

.gallery-main {
    width: 100%;
    height: 500px;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 15px;
}

.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.gallery-thumbs img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.gallery-thumbs img:hover,
.gallery-thumbs img.active {
    border-color: #2271b1;
}

.property-no-image-large {
    width: 100%;
    height: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 8px;
}

.property-no-image-large .dashicons {
    font-size: 120px;
    width: 120px;
    height: 120px;
    color: #ccc;
}

/* Información principal */
.property-main-info {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.property-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 30px;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 30px;
}

.property-header h1 {
    margin: 0 0 10px 0;
    font-size: 32px;
    color: #333;
}

.property-ref-location {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: #666;
}

.price-main {
    font-size: 36px;
    font-weight: 700;
    color: #2271b1;
    text-align: right;
}

.price-operation {
    font-size: 14px;
    color: #666;
    text-align: right;
}

/* Características clave */
.property-key-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.key-feature {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.key-feature .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    color: #2271b1;
}

.key-feature strong {
    display: block;
    font-size: 24px;
    color: #333;
}

.key-feature span {
    display: block;
    font-size: 13px;
    color: #666;
}

/* Descripción */
.property-description {
    margin-bottom: 40px;
}

.property-description h2 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #333;
}

.description-content {
    font-size: 16px;
    line-height: 1.8;
    color: #666;
}

/* Detalles */
.property-details {
    margin-bottom: 40px;
}

.property-details h2 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #333;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.detail-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
}

.detail-item strong {
    color: #333;
    font-weight: 600;
}

.detail-item span {
    color: #666;
}

/* Contacto */
.property-contact {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 8px;
    margin-top: 40px;
}

.property-contact h2 {
    font-size: 24px;
    margin-bottom: 10px;
    color: #333;
}

/* Formulario de contacto CF7 */
.property-contact-form {
    background: #f8f9fa;
    padding: 40px;
    border-radius: 8px;
    margin-top: 40px;
}

.property-contact-form h2 {
    font-size: 24px;
    margin-bottom: 10px;
    color: #333;
}

.property-contact-form p {
    color: #666;
    margin-bottom: 20px;
}

/* Estilos para CF7 */
.inmovilla-cf7-form .wpcf7-form-control-wrap {
    display: block;
    margin-bottom: 15px;
}

.inmovilla-cf7-form input[type="text"],
.inmovilla-cf7-form input[type="email"],
.inmovilla-cf7-form input[type="tel"],
.inmovilla-cf7-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.inmovilla-cf7-form input:focus,
.inmovilla-cf7-form textarea:focus {
    outline: none;
    border-color: #2271b1;
}

.inmovilla-cf7-form textarea {
    min-height: 120px;
    resize: vertical;
}

.inmovilla-cf7-form input[type="submit"] {
    background: #2271b1;
    color: #fff;
    border: none;
    padding: 12px 30px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.inmovilla-cf7-form input[type="submit"]:hover {
    background: #135e96;
}

.property-contact-notice {
    background: #fff;
    border: 2px dashed #ddd;
}

.property-contact-notice .inmovilla-notice {
    margin: 0;
}

/* ============================================
   AVISOS
   ============================================ */

.inmovilla-notice {
    padding: 15px 20px;
    border-radius: 4px;
    margin: 20px 0;
}

.inmovilla-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.inmovilla-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

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

@media (max-width: 768px) {
    .inmovilla-properties-grid {
        grid-template-columns: 1fr;
    }
    
    .inmovilla-search-simple .search-fields {
        grid-template-columns: 1fr;
    }
    
    .inmovilla-search-advanced .search-row {
        grid-template-columns: 1fr;
    }
    
    .property-header {
        flex-direction: column;
        gap: 20px;
    }
    
    .price-main {
        text-align: left;
    }
    
    .price-operation {
        text-align: left;
    }
    
    .property-key-features {
        grid-template-columns: 1fr;
    }
    
    .details-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   MODAL SIMPLE (IFRAME) - TOTALMENTE PERSONALIZABLE
   ============================================ */

/* Wrapper principal del modal */
.inmovilla-modal-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 999999;
    display: none;
}

.inmovilla-modal-wrapper.active {
    display: block;
}

/* Overlay (fondo oscuro) */
.inmovilla-modal-overlay {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* Container del contenido */
.inmovilla-modal-container {
    position: relative;
    width: 90%;
    max-width: 1200px;
    height: 90vh;
    margin: 5vh auto;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
}

/* Iframe */
.inmovilla-modal-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Botón de cerrar - PERSONALIZABLE */
.inmovilla-modal-close-btn {
    position: absolute;
    top: 10px;
    right: 25px;
    width: 40px;
    height: 60px;
    background: #ffffff!important;
    color: #000000!important;
    border: none;
    border-radius: 50%;
    font-size: 50px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}


/*.inmovilla-modal-close-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: rotate(90deg);
}*/

/* Responsive */
@media (max-width: 768px) {
    .inmovilla-modal-container {
        width: 95%;
        height: 95vh;
        margin: 2.5vh auto;
        border-radius: 8px;
    }
    
    .inmovilla-modal-close-btn {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 25px;
    }
}

/* ============================================
   MODAL DE PROPIEDADES (versión AJAX antigua - ya no se usa)
   ============================================ */

/* Botón de cerrar del modal (versión simple con iframe) */
#inmovilla-simple-modal .modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

#inmovilla-simple-modal .modal-close-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: rotate(90deg);
}

.inmovilla-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}

.inmovilla-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
}

.inmovilla-modal-container {
    position: relative;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    margin: 5vh auto;
    background: #fff;
    border-radius: 12px;
    overflow-y: auto;
    z-index: 2;
}

.inmovilla-modal-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    z-index: 3;
}

.inmovilla-modal-loading span {
    background: rgba(0, 0, 0, 0.8);
    padding: 20px 40px;
    border-radius: 8px;
}

.inmovilla-modal-error {
    padding: 60px 40px;
    text-align: center;
}

.inmovilla-modal-error p {
    font-size: 18px;
    color: #666;
    margin-bottom: 20px;
}

.inmovilla-modal-error button {
    background: #2271b1;
    color: #fff;
    border: none;
    padding: 12px 30px;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
}

.inmovilla-modal-error button:hover {
    background: #135e96;
}

.inmovilla-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    transition: background 0.3s;
}

.inmovilla-modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

.inmovilla-modal-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

/* Galería del modal */
.modal-gallery {
    background: #000;
    position: relative;
}

.modal-gallery-main {
    position: relative;
    width: 100%;
    height: 500px;
    background: #000;
}

.modal-gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.modal-gallery-prev,
.modal-gallery-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    font-size: 30px;
    cursor: pointer;
    z-index: 5;
    transition: background 0.3s;
}

.modal-gallery-prev:hover,
.modal-gallery-next:hover {
    background: #fff;
}

.modal-gallery-prev {
    left: 15px;
}

.modal-gallery-next {
    right: 15px;
}

.modal-gallery-counter {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
}

.modal-gallery-thumbs {
    display: flex;
    gap: 8px;
    padding: 15px;
    overflow-x: auto;
    background: #111;
}

.modal-thumb {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s;
    flex-shrink: 0;
}

.modal-thumb:hover,
.modal-thumb.active {
    border-color: #2271b1;
}

.modal-no-image {
    height: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #666;
}

.modal-no-image .dashicons {
    font-size: 80px;
    width: 80px;
    height: 80px;
}

/* Información del modal */
.modal-info {
    padding: 40px;
    overflow-y: auto;
    max-height: 90vh;
}

.modal-header h2 {
    margin: 0 0 15px 0;
    font-size: 26px;
    color: #333;
}

.modal-price {
    font-size: 32px;
    font-weight: 700;
    color: #2271b1;
    margin-bottom: 8px;
}

.modal-operation {
    display: inline-block;
    background: #f0f0f0;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
}

.modal-ref-location {
    display: flex;
    gap: 15px;
    font-size: 14px;
    color: #666;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 20px;
}

.modal-location {
    display: flex;
    align-items: center;
    gap: 5px;
}

.modal-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.modal-feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.modal-feature .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
    color: #2271b1;
    margin-bottom: 8px;
}

.modal-feature strong {
    font-size: 20px;
    color: #333;
}

.modal-feature span {
    font-size: 12px;
    color: #666;
}

.modal-description {
    margin-bottom: 25px;
}

.modal-description h3 {
    font-size: 18px;
    margin-bottom: 12px;
    color: #333;
}

.modal-description-content {
    font-size: 14px;
    line-height: 1.7;
    color: #666;
    max-height: 200px;
    overflow-y: auto;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.modal-btn {
    flex: 1;
    padding: 14px 20px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
}

.modal-btn-primary {
    background: #2271b1;
    color: #fff;
}

.modal-btn-primary:hover {
    background: #135e96;
}

.modal-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.modal-btn-secondary:hover {
    background: #e0e0e0;
}

.modal-contact-form {
    padding-top: 25px;
    border-top: 1px solid #e0e0e0;
}

.modal-contact-form h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #333;
}

/* Responsive modal */
@media (max-width: 1024px) {
    .inmovilla-modal-inner {
        grid-template-columns: 1fr;
    }
    
    .modal-features {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .inmovilla-modal-container {
        width: 95%;
        max-height: 95vh;
        margin: 2.5vh auto;
    }
    
    .modal-info {
        padding: 25px;
    }
    
    .modal-features {
        grid-template-columns: 1fr;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .modal-gallery-main {
        height: 300px;
    }
}