/* ─── Inmovilla Properties Plugin Styles ────────────────────────────────── */

.inmovilla-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #374151;
    line-height: 1.5;
}

/* ── Filter Bar ──────────────────────────────────────────────────────────── */
.inmovilla-filters {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.inmovilla-filter-main,
.inmovilla-filter-advanced {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    align-items: center !important;
}

/* Reset theme overrides on all direct children of filter rows */
.inmovilla-filter-main > *,
.inmovilla-filter-advanced > * {
    flex-shrink: 0;
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center;
}
.inmovilla-filter-main .inmovilla-select,
.inmovilla-filter-advanced .inmovilla-select {
    display: inline-block !important;
    width: auto !important;
    min-width: 130px;
}
.inmovilla-filter-main .inmovilla-input,
.inmovilla-filter-advanced .inmovilla-input {
    display: inline-block !important;
    width: 110px !important;
}

.inmovilla-filter-advanced {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f3f4f6;
}

.inmovilla-select,
.inmovilla-input,
.inmovilla-textarea {
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    padding: 7px 10px !important;
    font-size: 14px !important;
    color: #374151 !important;
    background: #fff !important;
    background-color: #fff !important;
    outline: none !important;
    box-sizing: border-box !important;
    transition: border-color .15s;
    line-height: 1.4 !important;
    height: auto !important;
    max-width: 100%;
}
.inmovilla-select:focus,
.inmovilla-input:focus,
.inmovilla-textarea:focus {
    border-color: #6b7280 !important;
    box-shadow: 0 0 0 2px rgba(107,114,128,.15) !important;
}
/* Force option text to be visible regardless of theme */
.inmovilla-select option,
.inmovilla-wrap select option {
    color: #374151 !important;
    background: #fff !important;
    background-color: #fff !important;
}
.inmovilla-input {
    width: 110px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.inmovilla-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.inmovilla-btn-primary {
    background: #16a34a;
    color: #fff;
    border-color: #16a34a;
}
.inmovilla-btn-primary:hover { background: #15803d; color: #fff; }
.inmovilla-btn-secondary {
    background: #fff;
    color: #374151;
    border-color: #d1d5db;
}
.inmovilla-btn-secondary:hover { background: #f9fafb; }
.inmovilla-btn-danger {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
}
.inmovilla-btn-danger:hover { background: #b91c1c; color: #fff; }

/* ── Results bar ─────────────────────────────────────────────────────────── */
.inmovilla-results-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    font-size: 14px;
    color: #6b7280;
}

/* ── Property Grid ───────────────────────────────────────────────────────── */
.inmovilla-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

/* ── Property Card ───────────────────────────────────────────────────────── */
.inmovilla-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    transition: box-shadow .2s, transform .2s;
}
.inmovilla-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
    transform: translateY(-2px);
}

.inmovilla-card-photo {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: #f3f4f6;
}
.inmovilla-card-photo .inmovilla-photo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s;
}
.inmovilla-card:hover .inmovilla-photo-img {
    transform: scale(1.03);
}

.inmovilla-photo-prev,
.inmovilla-photo-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,.45);
    color: #fff;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    opacity: 0;
    transition: opacity .2s;
}
.inmovilla-card-photo:hover .inmovilla-photo-prev,
.inmovilla-card-photo:hover .inmovilla-photo-next {
    opacity: 1;
}
.inmovilla-photo-prev { left: 6px; }
.inmovilla-photo-next { right: 6px; }

.inmovilla-photo-counter {
    position: absolute;
    bottom: 6px;
    right: 8px;
    background: rgba(0,0,0,.5);
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
}

.inmovilla-no-photo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #9ca3af;
}
.inmovilla-no-photo svg { width: 60px; height: 60px; }
.inmovilla-no-photo-large { height: 300px; }

.inmovilla-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.inmovilla-badge-sale     { background: #16a34a; }
.inmovilla-badge-rent     { background: #2563eb; }
.inmovilla-badge-featured { background: #d97706; }

.inmovilla-card-body {
    padding: 14px;
}

.inmovilla-card-price {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 6px;
}
.inmovilla-per-month {
    font-size: 13px;
    font-weight: 400;
    color: #6b7280;
}

.inmovilla-card-title {
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 6px;
    line-height: 1.4;
}
.inmovilla-card-title a {
    color: #111827;
    text-decoration: none;
}
.inmovilla-card-title a:hover { color: #16a34a; }

.inmovilla-card-location {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 8px;
}

.inmovilla-card-features {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 13px;
    color: #4b5563;
}
.inmovilla-card-features span {
    display: flex;
    align-items: center;
    gap: 3px;
}
.inmovilla-ref {
    color: #9ca3af;
    font-size: 12px;
}

.inmovilla-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* ── Pagination ──────────────────────────────────────────────────────────── */
.inmovilla-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    justify-content: center;
    margin: 24px 0;
}
.inmovilla-page-btn {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    color: #374151;
    background: #fff;
    text-decoration: none;
    transition: background .15s;
}
.inmovilla-page-btn:hover { background: #f9fafb; }
.inmovilla-page-active {
    background: #111827;
    color: #fff;
    border-color: #111827;
}
.inmovilla-page-ellipsis { color: #6b7280; padding: 0 4px; }
.inmovilla-page-info { font-size: 13px; color: #6b7280; margin-left: 8px; }

/* ── No results ──────────────────────────────────────────────────────────── */
.inmovilla-no-results {
    text-align: center;
    padding: 48px 24px;
    color: #6b7280;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* ── Detail Page ─────────────────────────────────────────────────────────── */

.inmovilla-detail {
    max-width: 900px;
    margin: 0 auto;
    padding: 16px 0;
}

.inmovilla-detail-back { margin-bottom: 16px; }
.inmovilla-back-link {
    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
}
.inmovilla-back-link:hover { color: #111827; }

.inmovilla-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}
.inmovilla-detail-title {
    font-size: 22px;
    font-weight: 500;
    color: #111827;
    margin: 0 0 6px;
}
.inmovilla-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 14px;
    color: #6b7280;
}
.inmovilla-detail-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}
.inmovilla-detail-price-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.inmovilla-detail-price {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    border: 1px solid #e5e7eb;
    padding: 8px 16px;
    border-radius: 6px;
}
.inmovilla-detail-price span { font-size: 14px; font-weight: 400; color: #6b7280; }

/* ── Gallery ─────────────────────────────────────────────────────────────── */
.inmovilla-gallery { margin-bottom: 24px; }
.inmovilla-gallery-main {
    position: relative;
    background: #f3f4f6;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 16/9;
}
.inmovilla-gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.inmovilla-gallery-prev,
.inmovilla-gallery-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,.5);
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: background .15s;
}
.inmovilla-gallery-prev:hover,
.inmovilla-gallery-next:hover { background: rgba(0,0,0,.75); }
.inmovilla-gallery-prev { left: 10px; }
.inmovilla-gallery-next { right: 10px; }

.inmovilla-gallery-fullscreen {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,.5);
    color: #fff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.inmovilla-gallery-fullscreen svg { width: 18px; height: 18px; }
.inmovilla-gallery-counter {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,.5);
    color: #fff;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 12px;
}

.inmovilla-gallery-thumbs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 8px 0 2px;
    scrollbar-width: thin;
}
.inmovilla-thumb {
    flex-shrink: 0;
    width: 72px;
    height: 54px;
    border-radius: 4px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    background: none;
    transition: border-color .15s;
}
.inmovilla-thumb.active { border-color: #111827; }
.inmovilla-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Detail sections ─────────────────────────────────────────────────────── */
.inmovilla-detail-desc {
    font-size: 14px;
    color: #4b5563;
    line-height: 1.7;
    margin-bottom: 24px;
}

.inmovilla-detail-section {
    margin-bottom: 32px;
}
.inmovilla-detail-section h2 {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.inmovilla-features-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}

.inmovilla-features-table {
    flex: 1;
    min-width: 260px;
    border-collapse: collapse;
    font-size: 14px;
}
.inmovilla-features-table tr.even { background: #f9fafb; }
.inmovilla-features-table tr.odd  { background: #fff; }
.inmovilla-feature-label {
    padding: 7px 12px;
    font-weight: 500;
    color: #374151;
    width: 50%;
}
.inmovilla-feature-value {
    padding: 7px 12px;
    color: #4b5563;
}

.inmovilla-amenities {
    flex: 1;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.inmovilla-amenity {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #374151;
}
.inmovilla-check-icon {
    width: 18px;
    height: 18px;
    color: #16a34a;
    flex-shrink: 0;
}

/* ── Energy table ────────────────────────────────────────────────────────── */
.inmovilla-energy-table {
    font-size: 13px;
    border-collapse: collapse;
    border: 1px solid #e5e7eb;
    overflow-x: auto;
    display: block;
    max-width: 100%;
}
.inmovilla-energy-table th {
    padding: 8px 14px;
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    white-space: nowrap;
}
.inmovilla-energy-table td {
    padding: 5px 14px;
    border-top: 1px solid #f3f4f6;
    color: #4b5563;
}
.inmovilla-energy-label {
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 3px;
    min-width: 90px;
    display: inline-block;
}

/* ── Map ─────────────────────────────────────────────────────────────────── */
.inmovilla-map {
    height: 280px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}
.inmovilla-map iframe { display: block; }

/* ── Contact form ────────────────────────────────────────────────────────── */
.inmovilla-contact-form { }
.inmovilla-contact-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}
.inmovilla-contact-left,
.inmovilla-contact-right {
    flex: 1;
    min-width: 240px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.inmovilla-contact-left .inmovilla-input,
.inmovilla-contact-right .inmovilla-textarea {
    width: 100%;
    box-sizing: border-box;
}
.inmovilla-textarea { resize: vertical; min-height: 120px; }
.inmovilla-contact-submit { width: 100%; justify-content: center; padding: 10px; }
.inmovilla-privacy {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: #6b7280;
    margin-top: 8px;
    cursor: pointer;
}
.inmovilla-contact-result {
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
}
.inmovilla-contact-result.success { background: #d1fae5; color: #065f46; }
.inmovilla-contact-result.error   { background: #fee2e2; color: #991b1b; }

/* ── Mortgage Simulator ──────────────────────────────────────────────────── */
.inmovilla-mortgage {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 32px;
    background: linear-gradient(135deg, #e8e8e8 0%, #f5f5f5 100%);
}
.inmovilla-mortgage-overlay {
    position: absolute;
    inset: 0;
    background: url('https://images.unsplash.com/photo-1554224155-6726b3ff858f?w=1200') center/cover;
    opacity: .12;
    pointer-events: none;
}
.inmovilla-mortgage-inner {
    position: relative;
    z-index: 1;
    padding: 24px;
}
.inmovilla-mortgage-inner h2 {
    font-size: 22px;
    font-weight: 300;
    color: #374151;
    margin: 0 0 20px;
}
.inmovilla-mortgage-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,.1);
    padding: 20px;
    max-width: 520px;
    margin: 0 auto;
}
.inmovilla-mortgage-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-top: 1px solid #f3f4f6;
    font-size: 14px;
    color: #374151;
}
.inmovilla-mortgage-row:first-child { border-top: none; }
.inmovilla-mortgage-options { flex-wrap: wrap; }
.inmovilla-mortgage-options label { font-size: 11px; font-weight: 600; text-transform: uppercase; color: #6b7280; display: block; margin-bottom: 4px; }

.inmovilla-mortgage-total { font-weight: 600; }
.inmovilla-mortgage-result {
    border-top: 2px solid #e5e7eb !important;
    font-weight: 700;
    font-size: 15px;
    margin-top: 4px;
    padding-top: 12px;
}
.im-monthly-value { font-size: 20px; font-weight: 700; color: #111827; }
.im-computed { font-weight: 600; }

.inmovilla-mortgage-input-group {
    display: flex;
    align-items: center;
    gap: 4px;
}
.inmovilla-mortgage-input-group .inmovilla-input {
    width: 90px;
    text-align: right;
}
.im-step-btn {
    width: 26px;
    height: 26px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    color: #374151;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}
.im-step-btn:hover { background: #f9fafb; }

.inmovilla-radio-group {
    display: flex;
    gap: 12px;
    font-size: 13px;
}
.inmovilla-radio-group label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 400 !important;
    text-transform: none !important;
    cursor: pointer;
}

.inmovilla-range {
    width: 100%;
    margin: 4px 0 8px;
    accent-color: #2563eb;
}

/* ── Lightbox ────────────────────────────────────────────────────────────── */
.inmovilla-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.9);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.inmovilla-lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    line-height: 1;
    opacity: .8;
}
.inmovilla-lightbox-close:hover { opacity: 1; }
.inmovilla-lightbox-prev,
.inmovilla-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #fff;
    font-size: 56px;
    cursor: pointer;
    opacity: .8;
    padding: 0 16px;
    line-height: 1;
}
.inmovilla-lightbox-prev:hover,
.inmovilla-lightbox-next:hover { opacity: 1; }
.inmovilla-lightbox-prev { left: 0; }
.inmovilla-lightbox-next { right: 0; }
.inmovilla-lightbox-img-wrap {
    max-width: calc(100vw - 120px);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.inmovilla-lightbox-img-wrap img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    display: block;
}
.inmovilla-lightbox-counter {
    color: #fff;
    font-size: 13px;
    margin-top: 10px;
    opacity: .7;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .inmovilla-grid {
        grid-template-columns: 1fr;
    }
    .inmovilla-filter-main,
    .inmovilla-filter-advanced {
        flex-direction: column;
        align-items: stretch;
    }
    .inmovilla-input { width: 100%; }
    .inmovilla-detail-header {
        flex-direction: column;
    }
    .inmovilla-features-wrap { flex-direction: column; }
    .inmovilla-gallery-main { aspect-ratio: 4/3; }
    .inmovilla-mortgage-card { padding: 14px; }
    .inmovilla-lightbox-img-wrap { max-width: calc(100vw - 80px); }
}
