/*
 * Market App — Modern Responsive & Mobile View CSS
 * Side Margin Control: --market-side-margin: 1% (Configurable)
 */

:root {
    --market-side-margin: 1%; /* 1% left and right margin */
    --market-primary: #4361ee;
    --market-primary-dark: #3a0ca3;
    --market-accent: #7209b7;
    --market-success: #2ec4b6;
    --market-warning: #ff9f1c;
    --market-danger: #e71d36;
    --market-bg-soft: #f8fafc;
    --market-card-radius: 16px;
}

/* ==================== GLOBAL MARKET CONTAINER (98% Width with 1% Margins) ==================== */
.modern-market-container {
    width: calc(100% - (var(--market-side-margin, 1%) * 2)) !important;
    max-width: 100% !important;
    margin-left: var(--market-side-margin, 1%) !important;
    margin-right: var(--market-side-margin, 1%) !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
}

/* 2-Column Responsive Layout */
.market-2col-row {
    display: flex;
    flex-wrap: wrap;
    margin-left: -10px !important;
    margin-right: -10px !important;
}

.market-sidebar-col {
    flex: 0 0 280px;
    max-width: 280px;
    padding-left: 10px !important;
    padding-right: 10px !important;
}

.market-main-col {
    flex: 1 1 0;
    min-width: 0;
    padding-left: 10px !important;
    padding-right: 10px !important;
}

@media (max-width: 991px) {
    .market-sidebar-col,
    .market-main-col {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

@media (max-width: 768px) {
    :root {
        --market-side-margin: 1%;
    }


    /* ==================== LAYOUT ==================== */

    /* Filter sidebar: full width, collapsible */
    .col-lg-3.mb-4 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Products grid: full width */
    .col-lg-9 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Detail page columns */
    .col-lg-8,
    .col-lg-4 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .container {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* ==================== HERO SECTION ==================== */
    .market-hero {
        height: auto !important;
        aspect-ratio: 1229 / 240 !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin-bottom: 0 !important;
        border-radius: 0 !important;
        min-height: 100px !important;
    }

    .market-hero .container {
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        padding: 12px !important;
    }

    .market-hero h1 {
        font-size: 1.5rem !important;
        margin-bottom: 8px !important;
    }

    .market-hero p {
        font-size: 0.95rem !important;
    }

    .search-bar {
        flex-direction: column !important;
        padding: 12px !important;
        border-radius: 12px !important;
        margin: 16px 12px 0 !important;
        gap: 10px !important;
    }

    .search-bar input {
        font-size: 1rem !important;
        padding: 6px !important;
    }

    .search-bar button {
        width: 100% !important;
        padding: 10px !important;
    }

    /* Category pills: horizontal scroll */
    .category-pills {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        justify-content: flex-start !important;
        padding: 10px 12px !important;
        gap: 8px !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        margin-top: 12px !important;
    }

    .category-pills::-webkit-scrollbar {
        display: none;
    }

    .category-pill {
        flex-shrink: 0 !important;
        font-size: 0.82rem !important;
        padding: 6px 14px !important;
        white-space: nowrap;
    }

    /* ==================== STATS BAR ==================== */
    .stats-bar {
        border-radius: 0 !important;
        padding: 14px 12px !important;
        margin-bottom: 8px !important;
        box-shadow: 0 1px 2px rgba(0,0,0,0.06) !important;
    }

    .stat-item h3 {
        font-size: 1.4rem !important;
        margin-bottom: 2px !important;
    }

    .stat-item p {
        font-size: 0.78rem !important;
    }

    /* ==================== FILTER SECTION ==================== */
    .filter-section {
        border-radius: 0 !important;
        padding: 14px 12px !important;
        margin-bottom: 8px !important;
        box-shadow: 0 1px 2px rgba(0,0,0,0.06) !important;
    }

    .filter-title {
        font-size: 1rem !important;
        margin-bottom: 14px !important;
    }

    .filter-group {
        margin-bottom: 14px !important;
    }

    .filter-group select,
    .filter-group input {
        padding: 8px 10px !important;
        font-size: 0.9rem !important;
    }

    /* Price range: side by side */
    .filter-group .row.g-2 > .col-6 {
        padding: 3px !important;
    }

    /* ==================== PRODUCT CARDS ==================== */

    /* 2 columns on mobile */
    .col-md-6.col-lg-4 {
        width: 50% !important;
        max-width: 50% !important;
        flex: 0 0 50% !important;
        padding: 4px !important;
    }
    
    /* Reduce row gap on mobile */
    .row.g-4 {
        --bs-gutter-x: 0.5rem !important;
        --bs-gutter-y: 0.5rem !important;
    }

    .product-card {
        border-radius: 10px !important;
    }

    .product-image {
        height: 150px !important;
    }

    .product-body {
        padding: 12px !important;
    }

    .product-category {
        font-size: 0.75rem !important;
        padding: 3px 8px !important;
        margin-bottom: 6px !important;
    }

    .store-badge {
        font-size: 0.75rem !important;
        padding: 4px 8px !important;
        margin-bottom: 6px !important;
    }

    .product-title {
        font-size: 0.95rem !important;
        margin-bottom: 6px !important;
    }

    .product-location {
        font-size: 0.8rem !important;
        margin-bottom: 8px !important;
    }

    .product-price {
        font-size: 1.1rem !important;
        margin-bottom: 8px !important;
    }

    .product-price-dual {
        gap: 6px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    .product-meta {
        padding-top: 8px !important;
        font-size: 0.78rem !important;
    }

    .btn-view-product {
        padding: 9px !important;
        font-size: 0.85rem !important;
        border-radius: 8px !important;
        margin-top: 8px !important;
    }

    /* ==================== PRODUCT DETAIL ==================== */
    .product-detail-container {
        border-radius: 0 !important;
        padding: 16px 12px !important;
        margin-top: 0 !important;
        box-shadow: none !important;
    }

    .product-image-main {
        height: 240px !important;
        border-radius: 8px !important;
        margin-bottom: 14px !important;
    }

    .product-title-main {
        font-size: 1.3rem !important;
        margin-bottom: 10px !important;
    }

    .product-price-main {
        font-size: 1.6rem !important;
        margin-bottom: 12px !important;
    }

    .product-price-dual.mb-4 {
        flex-direction: column !important;
        gap: 4px !important;
        margin-bottom: 12px !important;
    }

    /* Store info card: full width below product */
    .store-info-card {
        border-radius: 0 !important;
        padding: 16px 12px !important;
        margin-bottom: 8px !important;
    }

    .btn-contact-seller,
    .btn-show-interest {
        padding: 12px !important;
        font-size: 1rem !important;
        border-radius: 8px !important;
    }

    /* ==================== PAGINATION ==================== */
    .pagination {
        flex-wrap: wrap;
        gap: 4px;
    }

    .page-link {
        padding: 6px 10px !important;
        font-size: 0.85rem !important;
    }

    /* ==================== EMPTY STATE ==================== */
    .empty-state {
        padding: 40px 16px !important;
    }

    .empty-state i {
        font-size: 3.5rem !important;
    }

    .empty-state h3 {
        font-size: 1.1rem !important;
    }

    /* ==================== MOBILE NAV BAR ==================== */
    .market-mobile-nav {
        display: flex !important;
        overflow-x: auto;
        gap: 8px;
        padding: 10px 12px;
        background: #fff;
        border-bottom: 1px solid #e4e6eb;
        margin-bottom: 0;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .market-mobile-nav::-webkit-scrollbar {
        display: none;
    }

    .market-mobile-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 8px 14px;
        border-radius: 20px;
        background: #f0f2f5;
        color: #333;
        text-decoration: none;
        font-size: 11px;
        font-weight: 600;
        white-space: nowrap;
        flex-shrink: 0;
        transition: all 0.2s;
    }

    .market-mobile-nav a i {
        font-size: 16px;
        color: #667eea;
    }

    .market-mobile-nav a.active {
        background: #667eea;
        color: #fff;
    }

    .market-mobile-nav a.active i {
        color: #fff;
    }
}

/* ==================== GLOBAL UTILITIES & JOB CARDS ==================== */
.min-w-0 {
    min-width: 0 !important;
}

.job-card-col {
    min-width: 0 !important;
}

.job-card {
    min-width: 0 !important;
    overflow: hidden !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
}

@media (max-width: 576px) {
    .job-card {
        padding: 16px !important;
        border-radius: 14px !important;
    }
    .hero-title {
        font-size: 1.4rem !important;
    }
}

