:root {
    --azul: #00205B;
    --magenta: #C2185B;
    --blanco: #ffffff;
}

* {
    box-sizing: border-box;
    scroll-margin-top: 180px; /* Offset for fixed header + action bar */
}

body {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    background: #f4f6f9;
}

/* ================= SEARCH SECTION ================= */

.search-section {
    padding: 20px 15px;
    background: #e2e8f0;
    text-align: center;
}

body.search-mode .search-section {
    margin-top: 220px;
}

@media (max-width: 768px) {
    /* Mantenemos margen uniforme o vacio */
}

@media (max-width: 480px) {
    /* Mantenemos margen uniforme o vacio */
}

.search-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    max-width: 1200px;
    margin: 0 auto;
}

.search-container select,
.search-container input[type="text"] {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    font-size: 14px;
    font-family: inherit;
    color: #334155;
    background: white;
    min-width: 0;
}

.search-container select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23c2185b%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpolyline%20points%3D%226%209%2012%2015%2018%209%22%3E%3C%2Fpolyline%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 36px;
}

.search-container select:focus,
.search-container input[type="text"]:focus {
    outline: none;
    border-color: var(--magenta);
    box-shadow: 0 0 0 3px rgba(194, 24, 91, 0.1);
}

.search-container select:hover,
.search-container input[type="text"]:hover {
    border-color: #94a3b8;
}

.search-container input[type="text"]#codigo {
    width: 100px;
}

.search-container input[type="text"]#direccion {
    flex: 1;
    min-width: 150px;
}

.search-container button {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-family: inherit;
    background: var(--magenta);
    color: white;
    font-weight: 600;
    cursor: pointer;
}

.search-container button:hover {
    background: #E91E63;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(194, 24, 91, 0.3);
}

/* ================= CONTENIDO ================= */

.container {
    padding: 60px 40px;
    max-width: 1400px;
    margin: 0 auto;
    min-height: auto;
}

.section-title {
    font-family: 'ITC Avant Garde Gothic', 'Avant Garde', 'Questrial', sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--azul);
    margin-bottom: 40px;
    position: relative;
    padding-bottom: 15px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--magenta);
    border-radius: 2px;
}

/* ================= COMPANY SECTION ================= */

.company-section {
    background: white;
    margin-top: 40px;
    margin-bottom: 40px;
    border-radius: 20px;
    box-shadow: var(--sombra-suave);
    border: 1px solid var(--borde);
}

.company-content {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.company-text p {
    font-size: 17px;
    line-height: 1.8;
    color: var(--texto);
    margin-bottom: 25px;
}

.cta-box {
    background: var(--fondo);
    padding: 30px;
    border-radius: 15px;
    border-left: 5px solid var(--magenta);
    margin-top: 40px;
}

.cta-text {
    font-weight: 600;
    color: var(--azul) !important;
    margin-bottom: 15px !important;
}

.brand-contact {
    font-family: 'ITC Avant Garde Gothic', 'Avant Garde', 'Questrial', sans-serif;
    font-size: 24px !important;
    font-weight: 700;
    color: var(--azul) !important;
    margin: 0 !important;
}

.brand-contact span {
    color: var(--magenta);
    font-size: 28px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    animation: fadeIn 0.4s ease-out;
}

.btn-compartir-resultados {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--magenta);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.btn-compartir-resultados:hover {
    background: var(--magenta-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(194, 24, 91, 0.3);
}

/* ================= CARD ================= */

.card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: 2px solid transparent;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

.slider {
    position: relative;
    height: 240px;
    width: 100%;
    overflow: hidden;
    background: #e2e8f0;
}

.slider img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ===== BADGES ===== */

.badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    color: white;
    padding: 6px 12px;
    font-size: 12px;
    letter-spacing: 0.5px;
    border-radius: 50px;
    font-weight: 600;
    z-index: 5;
    transition: transform 0.3s ease, background 0.3s ease;
}

.badge:hover {
    transform: scale(1.05);
}

.badge-estado {
    position: absolute;
    top: 15px;
    left: 45px;
    /* Offset for the checkbox */
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 50px;
    color: white;
    font-weight: 700;
    letter-spacing: 0.5px;
    z-index: 5;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* When there's no checkbox (reserved/sold/rented), badge goes to left:15px */
.badge-estado.badge-no-check {
    left: 15px;
}

.estado-reservado {
    background: var(--magenta);
}

.estado-vendido {
    background: #475569;
}

.estado-alquilado {
    background: #9c27b0;
}

.estado-apto-credito {
    background: #059669;
}

/* ===== PRECIO ===== */

.precio {
    font-size: 22px;
    font-weight: 800;
    color: var(--azul);
    letter-spacing: -0.5px;
    margin-bottom: 15px;
}

/* ===== SLIDER BUTTONS ===== */

.slider button {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    width: 30px !important;
    height: 180px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.25s ease !important;
    z-index: 5 !important;
    opacity: 0.85 !important;
    padding: 0 !important;
}

.slider button svg {
    width: 36px !important;
    height: 36px !important;
    stroke-width: 8 !important;
    stroke: #ffffff !important;
    filter: drop-shadow(0px 2px 4px rgba(0, 0, 0, 0.8)) !important;
    pointer-events: none !important;
}

.slider .prev {
    left: 0 !important;
}

.slider .next {
    right: 0 !important;
}

.slider button:hover {
    background: transparent !important;
    opacity: 1 !important;
    transform: translateY(-50%) scale(1.2) !important;
    box-shadow: none !important;
}

/* ===== CARD BODY ===== */

.card-body {
    padding: 24px;
}

.card h3 {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card p {
    margin: 8px 0;
    font-size: 15px;
    color: #334155;
    line-height: 1.4;
}

.card p strong {
    color: var(--azul);
}

/* ===== WHATSAPP ===== */

.btn-whatsapp, .btn-facebook, .btn-whatsapp-share {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px;
    text-align: center;
    background: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 15px;
    transition: all 0.2s;
    border: 2px solid transparent;
    width: 270px; /* Ancho fijo para que todos sean iguales */
    white-space: nowrap; /* Evita que el texto se rompa en dos líneas */
    box-sizing: border-box;
    flex-shrink: 0;
}

.btn-whatsapp {
    margin-top: 20px;
    color: var(--azul);
    border-color: var(--azul);
}

.btn-facebook {
    margin-top: 10px;
    color: #1877F2;
    border-color: #1877F2;
}

.btn-whatsapp-share {
    margin-top: 10px;
    color: #25D366;
    border-color: #25D366;
}

.btn-whatsapp:hover {
    background: #f1f5f9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 32, 91, 0.15);
}

.btn-facebook:hover {
    background: #f0f7ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(24, 119, 242, 0.15);
}

.btn-whatsapp-share:hover {
    background: #f0fff4;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.15);
}

.btn-whatsapp.disabled {
    background: #cbd5e1;
    color: #64748b;
    pointer-events: none;
}

/* ===== MAIN CTA ===== */
.btn-whatsapp.main-cta {
    display: inline-flex;
    width: auto;
    padding: 14px 28px;
    font-size: 16px;
    min-width: 250px;
}

.tasaciones-cta p {
    margin-bottom: 25px;
    font-size: 17px;
    line-height: 1.6;
    color: var(--texto);
}

/* ===== CONTACT SECTION ===== */
.contact-methods {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 30px;
}

.contact-method-link {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    color: var(--texto);
    font-size: 18px;
    font-weight: 600;
    transition: all 0.2s;
    width: fit-content;
    padding: 10px 15px;
    border-radius: 10px;
    background: white;
    border: 1px solid var(--borde);
    box-shadow: var(--sombra-suave);
}

.contact-method-link:hover {
    transform: translateX(10px);
    border-color: var(--magenta);
    color: var(--azul);
}

.contact-method-link svg {
    flex-shrink: 0;
}

/* Hide action bar in detail page */
body.detail-view #action-bar {
    display: none !important;
}

@media(max-width:1150px) {
    .search-container {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .search-container select,
    .search-container input[type="text"],
    .search-container button {
        flex: 1 1 calc(50% - 10px);
        min-width: calc(50% - 10px);
    }

    .search-container input[type="text"]#codigo {
        flex: 0 0 100px;
    }

    .search-container input[type="text"]#direccion {
        flex: 1 1 100%;
    }

    .search-container button {
        flex: 1 1 100%;
    }

    .container {
        padding: 20px;
    }
}

@media(max-width:600px) {
    .search-container {
        flex-direction: column;
        padding: 12px;
        gap: 12px;
    }

    .search-container select,
    .search-container input[type="text"],
    .search-container button {
        flex: 1 1 100%;
        width: 100%;
        padding: 12px;
        font-size: 16px; /* evita zoom automático en iOS */
    }

    .search-container input[type="text"]#codigo {
        flex: 1 1 100%;
    }
    
    .container {
        padding: 20px 15px;
    }
    
    .section-title {
        font-size: 24px;
        margin-bottom: 25px;
    }
}

@media(max-width:480px) {
    .search-section {
        padding: 15px 10px;
    }
    .grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}
