/* ==========================================================================
   ECOMERCIO MAIN GRID CONTAINER (Aligned with Bootstrap Navbar Container)
   ========================================================================== */

/* Outer wrapper reset */
.main-content-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Home Grid Container matching standard container width */
.eco-main-container-class {
    display: grid !important;
    grid-template-columns: 260px minmax(0, 1fr) 300px !important;
    grid-template-areas: "left middle right" !important;
    gap: 20px !important;
    width: 100% !important;
    max-width: 1320px !important;
    margin: 0 auto !important;
    padding: 20px 12px !important;
    box-sizing: border-box !important;
    align-items: start !important;
}

/* Fallback override for any parent container wrapping home.php */
div:has(> .eco-main-container-class),
main:has(> .eco-main-container-class) {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Desktop Grid Column Area Mapping */
@media screen and (min-width: 992px) {
    .home-sidebar-left,
    .detail-left-column {
        grid-area: left !important;
        width: 260px !important;
        min-width: 260px !important;
    }

    .home-main-column,
    .detail-middle-column {
        grid-area: middle !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    .home-sidebar-right,
    .detail-right-column {
        grid-area: right !important;
        width: 300px !important;
        min-width: 300px !important;
    }
}

/* Mobile & Tablet Stacking */
@media screen and (max-width: 991px) {
    .eco-main-container-class {
        display: flex !important;
        flex-direction: column !important;
        padding: 10px !important;
    }

    .home-sidebar-left,
    .home-main-column,
    .home-sidebar-right {
        width: 100% !important;
    }

    .home-main-column { order: 1 !important; }
    .home-sidebar-right { order: 2 !important; }
    .home-sidebar-left { order: 3 !important; }
}
/* ==========================================================================
   AD DETAILS MEDIA & COMPONENT STYLES
   ========================================================================== */

/* Widget Panels */
.widget-panel {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.widget-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #1a202c;
    display: block;
    margin-bottom: 12px;
}

/* Filter Forms */
.search-widget-form .filter-group {
    margin-bottom: 12px;
}

.search-widget-form label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 4px;
}

.search-widget-form input,
.search-widget-form select {
    width: 100%;
    padding: 6px 10px;
    font-size: 0.85rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    box-sizing: border-box;
}

.price-inputs {
    display: flex;
    gap: 8px;
}

.filter-btn {
    width: 100%;
    padding: 8px;
    background: #e53e3e;
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
}

.filter-btn.reset {
    background: #edf2f7;
    color: #4a5568;
}

/* Primary Image Container */
.main-image-container {
    width: 100%;
    max-height: 480px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-image-container img {
    max-width: 100% !important;
    max-height: 480px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    cursor: pointer;
}

/* Overlay Navigation Controls */
.main-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: #ffffff;
    border: none;
    padding: 10px 14px;
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    z-index: 5;
}

.prev-btn { left: 10px; }
.next-btn { right: 10px; }

.image-counter-badge {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: 12px;
}

/* Thumbnails Strip */
.gallery-thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scroll-behavior: smooth;
    width: 100%;
    padding: 4px 0;
}

.thumb-item {
    width: 65px;
    height: 65px;
    object-fit: cover;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    flex-shrink: 0;
}

.thumb-item.active {
    border-color: #e53e3e;
}

.thumb-nav-btn {
    background: #edf2f7;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
}

/* Seller Contact Buttons */
.masked-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    background: #f8fafc;
    cursor: pointer;
    text-decoration: none;
}

.masked-icon-box {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 14px;
}

/* Related Ads Bottom Section */
.related-ads-wrapper {
    grid-column: 1 / -1 !important;
    width: 100%;
    margin-top: 30px;
}

.related-ads-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.related-ads-scroll-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.related-ad-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}

.related-ad-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.related-ad-info {
    padding: 10px;
}

.related-ad-info h5 {
    font-size: 0.85rem;
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.related-ad-price {
    font-weight: 700;
    color: #e53e3e;
    font-size: 0.9rem;
}