/* ==========================================================================
   HOJA DE ESTILOS PRINCIPAL: INICIO MERCARANCHO (HOME)
   Descripción: Estilos globales y responsivos para la página principal.
========================================================================== */

/* ==========================================================================
   1. HERO CAROUSEL (ESCRITORIO)
   ==========================================================================
   Controla el banner principal deslizante en la parte superior de la página.
   Configura el contenedor principal, las diapositivas con efecto snap magnético
   y los indicadores visuales (puntos de navegación).
========================================================================== */
.mr-hero-carousel { 
    width: 100%; 
    margin-bottom: 30px; 
    position: relative; 
    height: 380px; 
    overflow: hidden; 
}

.carousel-track { 
    display: flex; 
    overflow-x: auto; 
    scroll-snap-type: x mandatory; 
    scroll-behavior: smooth; 
    height: 100%; 
    scrollbar-width: none; 
}

.carousel-track::-webkit-scrollbar { 
    display: none; 
}

.carousel-slide { 
    flex: 0 0 100%; 
    height: 100%; 
    position: relative; 
    scroll-snap-align: start; 
    background-color: #ffffff; 
}

.carousel-slide picture,
.carousel-slide img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover; 
    object-position: center;
}

.carousel-dots { 
    position: absolute; 
    bottom: 20px; 
    left: 50%; 
    transform: translateX(-50%); 
    display: flex; 
    gap: 12px; 
    z-index: 10; 
    background: rgba(0,0,0,0.2); 
    padding: 8px 15px; 
    border-radius: 20px; 
}

.dot { 
    width: 12px; 
    height: 12px; 
    border-radius: 50%; 
    background: rgba(255,255,255,0.6); 
    cursor: pointer; 
    transition: all 0.3s ease; 
}

.dot.active { 
    background: var(--mr-red) !important; 
    transform: scale(1.3); 
}

.mr-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.7);
    color: var(--mr-green);
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.mr-arrow:hover {
    background: var(--mr-green);
    color: #fff; }

.mr-arrow.prev {
    left: 20px;
}

.mr-arrow.next {
    right: 20px;
}

/* ==========================================================================
   2. NAVEGACIÓN DE CATEGORÍAS
   ==========================================================================
   Define el menú visual interactivo de íconos circulares para el acceso 
   rápido a las distintas clasificaciones y catálogos de anuncios.
========================================================================== */
.mr-categories-circles-item { 
    display: flex; 
    justify-content: center; 
    gap: 35px; 
    margin: 40px 0; 
    flex-wrap: wrap; 
}

.cat-circle-item { 
    text-decoration: none; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 12px; 
    color: var(--mr-text-dark); 
    font-size: 14px;
    font-weight: 500;
}

.cat-icon { 
    width: 110px; 
    height: 110px; 
    border-radius: 50%; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.08); 
    transition: all 0.3s ease; 
    border: 2px solid transparent; 
    overflow: hidden;
}

.cat-icon img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
}

.cat-circle-item:hover .cat-icon { 
    transform: translateY(-5px); 
    border-color: var(--mr-green); 
}

.cat-circle-item:hover span { 
    color: var(--mr-green); 
}

/* ==========================================================================
   3. BANNERS DE INFORMACIÓN (ESTRATEGIA DE CONVERSIÓN)
   ==========================================================================
   Estiliza las tarjetas promocionales que invitan a los usuarios a interactuar 
   y publicar anuncios. Maneja la tipografía interna y los efectos hover de los enlaces.
========================================================================== */
.mr-info-banners-section { margin: 50px 0; }

.mr-info-banners-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); 
    gap: 20px;
}

.info-banner-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 170px;
    border-radius: 12px;
    text-decoration: none;
    overflow: hidden;
    background-color: #000; 
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.info-banner-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.15);
}

.banner-bg-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.banner-content { 
    position: relative; 
    z-index: 2; 
    padding: 25px; 
    color: #fff; 
    max-width: 92%; 
}

.banner-badge { 
    display: inline-block; 
    font-size: 10px; 
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    margin-bottom: 8px; 
    color: #e0e0e0; 
}

.banner-content h3 { 
    font-size: 20px; 
    font-weight: 700; 
    margin: 0 0 6px 0; 
    color: #fff !important; 
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5); 
}

.banner-content p { 
    font-size: 13px; 
    margin: 0 0 10px 0; 
    color: #f5f5f5 !important; 
    line-height: 1.3; 
}

/* REEMPLAZAR ESTAS DOS REGLAS EN front-page.css */

.banner-cta { 
    display: inline-block; 
    font-size: 14px; 
    font-weight: 700; 
    color: #ffffff !important; 
    text-decoration: none; 
    background: linear-gradient(to bottom, #2b8c48, var(--mr-green)); 
    padding: 8px 20px; /* Controla el tamaño interno del botón */
    border-radius: 8px; 
    box-shadow: 0 4px 10px rgba(18, 91, 41, 0.4);
    transition: all 0.3s ease; 
    margin-top: 5px; /* Separación extra del texto de arriba */
}

.info-banner-card:hover .banner-cta { 
    color: #ffffff; 
    transform: scale(1.05); 
    box-shadow: 0 6px 14px rgba(18, 91, 41, 0.6); /* Sombra más intensa al pasar el mouse */
}

/* ==========================================================================
   4. GRID DE PRODUCTOS (PLUGIN CLASSIFIED LISTING)
   ==========================================================================
   Sobreescribe los estilos nativos del plugin para forzar una cuadrícula 
   exacta de 5 columnas. Define el aspecto de la tarjeta individual, recortes 
   de imagen, y la inyección visual de precios predeterminados y metadatos.
========================================================================== */
.mr-products-section { margin-bottom: 50px; }

.mr-grid .rtcl-grid-view {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important; 
    gap: 15px !important;
    align-items: stretch !important; 
}

.mr-grid .rtcl-grid-view::before,
.mr-grid .rtcl-grid-view::after {
    display: none !important;
}

.mr-grid .rtcl-listing-item {
    width: 100% !important; 
    max-width: 100% !important;
    margin: 0 !important;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%; 
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mr-grid .rtcl-listing-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.12);
}

.mr-grid .listing-thumb {
    width: 100%;
    aspect-ratio: 1 / 1; 
    overflow: hidden;
    position: relative;
    background: var(--mr-gray-bg); 
    border-bottom: 1px solid #f0f0f0; 
}

.mr-grid .listing-thumb img {
    width: 100% !important; 
    height: 100% !important;
    object-fit: cover; 
    transition: transform 0.3s ease;
}

.mr-grid .rtcl-listing-item:hover .listing-thumb img { transform: scale(1.05); }

.mr-grid .item-content {
    padding: 16px; 
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.mr-grid .rtcl-meta-buttons,
.mr-grid .rtcl-listing-badge-wrap,
.mr-grid .listing-meta .location,
.mr-grid .listing-meta .category { display: none !important; }

.mr-grid .listing-price {
    order: 1; 
    margin-bottom: 8px;
    min-height: 28px; 
    display: flex;
    align-items: center;
}

.mr-grid .rtcl-price { font-size: 20px; font-weight: 600; color: var(--mr-green); }

.mr-grid .listing-price:empty::after,
.mr-grid .rtcl-price:empty::after {
    content: "Precio a consultar";
    font-size: 15px;
    color: var(--mr-green); 
    font-weight: 700;
}

.mr-grid .listing-title {
    order: 2; 
    margin: 0 0 12px 0; 
    min-height: 40px; 
}

.mr-grid .listing-title a {
    font-size: 14px; 
    color: var(--mr-text-dark); 
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2; line-clamp: 2;        
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.mr-grid .listing-title a:hover { color: var(--mr-green); }

.mr-grid .listing-meta {
    order: 3; 
    list-style: none;
    padding: 10px 0 0 0;
    margin: auto 0 0 0; 
    display: flex;
    justify-content: space-between; 
    border-top: 1px dashed #eaeaea; 
}

.mr-grid .listing-meta li {
    font-size: 11px;
    color: #999;
    display: flex;
    gap: 4px; 
}

.mr-grid .listing-meta li i {
    color: #bbb !important;
    font-size: 12px;
}

.mr-mobile-only-banner {
    display: none;
}

.mr-desktop-only {
    display: grid;
}

/* ==========================================================================
   5. OPTIMIZACIÓN RESPONSIVA (MÓVIL - MÁX 768PX)
   ==========================================================================
   Adapta todos los componentes para pantallas pequeñas:
   - Hero: Cambia a un aspect-ratio de 16:9 estricto.
   - Categorías: Habilita el scroll horizontal táctil con diseño de píldora.
   - Banners: Oculta las tarjetas de escritorio y despliega un banner condensado 
     exclusivo para móviles con diseño integrado y un único llamado a la acción.
   - Grid: Fuerza una visualización exacta de 2 columnas y 2 filas (4 elementos).
========================================================================== */
@media (max-width: 768px) {
    .mr-hero-carousel {
        height: auto !important;
        max-height: none !important;
        min-height: auto !important;
        aspect-ratio: 16 / 9; 
        margin-bottom: 20px;
    }

    .carousel-slide {
        height: 100%; 
    }

    .carousel-slide picture,
    .carousel-slide img {
        object-fit: contain !important; 
        background-color: #ffffff;
    }

    .carousel-dots { 
        bottom: 5px; 
        padding: 4px 10px; 
        z-index: 10 !important; 
    }

    .mr-categories-circles {
        padding: 0;
    }

    .mr-categories-circles-item { 
        display: flex;
        flex-wrap: nowrap !important; 
        justify-content: flex-start; 
        overflow-x: auto; 
        scroll-snap-type: x mandatory; 
        padding: 5px 0px 0px 0px; 
        gap: 12px; 
        position: relative;
        -webkit-overflow-scrolling: touch;
    }

    .mr-categories-circles-item::-webkit-scrollbar { 
        display: none; 
    }
    
    .mr-categories-circles-item { 
        -ms-overflow-style: none; 
        scrollbar-width: none; 
    }

    .mr-categories-circles-item::before,
    .mr-categories-circles-item::after { 
        content: ''; 
        position: sticky; 
        min-width: 70px; 
        height: 130px; 
        margin-top: -10px; 
        pointer-events: none; 
        z-index: 5;
    }

    .mr-categories-circles-item::before { 
        left: -2px; 
        background: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23125b29' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 18l-6-6 6-6'/%3E%3C/svg%3E") left 12px center / 24px no-repeat, 
                    linear-gradient(to left, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 60%);
        margin-right: -40px;
    }

    .mr-categories-circles-item::after { 
        right: -2px; 
        background: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23125b29' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18l6-6-6-6'/%3E%3C/svg%3E") right 12px center / 24px no-repeat, 
                    linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 60%);
        margin-left: -25px;
    }

    .cat-circle-item { 
        scroll-snap-align: center;
        flex: 0 0 auto; 
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        z-index: 1;
    }

    .cat-icon { 
        width: 80px;
        height: 80px; 
        border-radius: 50%;
        object-fit: cover;
        margin-bottom: 8px;
        background: #f9f9f9; 
    }

    .mr-desktop-only { 
        display: none !important; 
    }

    .mr-mobile-only-banner {
        display: flex;
        flex-direction: column;
        position: relative;
        background-color: rgba(0, 0, 0, 0.9); 
        border-radius: 12px;
        overflow: hidden;
        padding: 25px 15px;
        text-align: center;
        color: #ffffff;
        box-shadow: 0 8px 16px rgba(0,0,0,0.15);
    }

    .mobile-banner-bg {
        position: absolute;
        top: 0; 
        left: 0; 
        width: 100%; 
        height: 100%;
        z-index: 0; 
        opacity: 0.15; 
    }

    .mobile-banner-bg img { 
        width: 100%; 
        height: 100%; 
        object-fit: cover; 
    }

    .mobile-banner-content { 
        position: relative; 
        z-index: 1; 
    }

    .mobile-features {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 25px;
    }

    .mobile-feature-icon {
        width: 75px; 
        height: 75px;
        margin-bottom: 5px;
        object-fit: contain; 
    }

    .feature-item { 
        flex: 1; 
        display: flex; 
        flex-direction: column; 
        align-items: center; 
    }

    .feature-item svg { 
        width: 32px; 
        height: 32px; 
        margin-bottom: 10px; 
        stroke: #e2c07d; 
    }

    .feature-title { 
        font-size: 13px; 
        font-weight: 800; 
        margin-bottom: 4px; 
        line-height: 1.2; 
        letter-spacing: 0.5px;
    }

    .feature-desc { 
        font-size: 11px; 
        font-weight: 400; 
        line-height: 1.3; 
        opacity: 0.85; 
    }

    .mobile-banner-btn {
        display: inline-flex;
        justify-content: center;
        align-items: center;
        background: linear-gradient(to bottom, #2b8c48, var(--mr-green)); 
        color: #ffffff !important;
        font-size: 16px;
        font-weight: 700;
        padding: 10px;
        border-radius: 8px;
        text-decoration: none;
        width: 100%;
        box-shadow: 0 4px 10px rgba(18, 91, 41, 0.4);
        transition: transform 0.2s ease;
    }

    .mobile-banner-btn:active {
        transform: scale(0.98);
    }

    .section-title h2 { 
        font-size: 18px; 
    }

    .btn-ver-todo { 
        font-size: 13px; 
    }

    .mr-grid .rtcl-grid-view {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        padding: 0 5px;
    }

    .mr-grid .item-content { 
        padding: 10px !important; 
    }

    .mr-grid .rtcl-price { 
        font-size: 16px !important; 
    }

    .mr-grid .rtcl-listing-item:nth-child(5) {
        display: none !important;
    }
    
    .mr-arrow {
        display: none;
    }
}