/* ============================================================
   Product Listing Page Styles — MSME Leap
   ============================================================ */
:root {
    --primary-color: #186ad0;
    --primary-dark:  #0f4fa8;
    --secondary-color: #101f46;
    --accent-color: #28a745;
    --bg-light: #f4f6fb;
    --deep-shadow: 0 10px 30px rgba(16, 31, 70, 0.08);
    --radius-card: 16px;
    --radius-input: 8px;
    --font-main: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-light);
    font-family: var(--font-main);
}

/* ── Breadcrumb & Header ────────────────────────────────── */
.plp-header {
    background: #fff;
    padding: 1.5rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 2px 15px rgba(0,0,0,0.04);
}

.breadcrumb {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb-item.active {
    color: #6c757d;
}

.category-title {
    color: var(--secondary-color);
    font-weight: 700;
    margin-bottom: 0;
}

.result-count {
    color: #6c757d;
    font-size: 0.95rem;
}

/* ── Sidebar Filters ────────────────────────────────────── */
.filter-sidebar {
    background: #fff;
    border-radius: var(--radius-card);
    box-shadow: var(--deep-shadow);
    padding: 1.5rem;
    position: sticky;
    top: 90px; /* Assuming fixed navbar */
}

.filter-section {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 1.5rem;
}

.filter-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.filter-title {
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-clear {
    font-size: 0.8rem;
    color: var(--primary-color);
    cursor: pointer;
    text-decoration: none;
    font-weight: normal;
}

.form-check-label {
    font-size: 0.95rem;
    color: #495057;
    cursor: pointer;
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.price-range-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
}

.price-range-inputs input {
    border-radius: var(--radius-input);
    border: 1px solid #ced4da;
    padding: 0.375rem 0.75rem;
    width: 100%;
}

.price-range-btn {
    width: 100%;
    margin-top: 10px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: var(--radius-input);
    padding: 0.5rem;
    transition: background 0.2s;
}

.price-range-btn:hover {
    background: var(--primary-dark);
}

/* ── Main Content Area ──────────────────────────────────── */
.sorting-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-card);
    box-shadow: var(--deep-shadow);
    margin-bottom: 1.5rem;
}

.sort-select {
    border: 1px solid #ced4da;
    border-radius: var(--radius-input);
    padding: 0.4rem 1rem;
    color: #495057;
    outline: none;
}

.sort-select:focus {
    border-color: var(--primary-color);
}

/* ── Product Card ───────────────────────────────────────── */
.product-card {
    background: #fff;
    border-radius: var(--radius-card);
    box-shadow: var(--deep-shadow);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0,0,0,0.04);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(16, 31, 70, 0.12);
}

.product-img-wrapper {
    position: relative;
    padding-top: 75%; /* 4:3 Aspect Ratio */
    background: #f8f9fa;
    overflow: hidden;
}

.product-img-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.quick-view-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 5;
}

.product-card:hover .quick-view-overlay {
    opacity: 1;
}

.btn-quick-view {
    background: #fff;
    color: var(--primary-color);
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    transform: translateY(20px);
    transition: transform 0.3s ease, background 0.3s ease, color 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.product-card:hover .btn-quick-view {
    transform: translateY(0);
}

.btn-quick-view:hover {
    background: var(--primary-color);
    color: #fff;
}

.product-card:hover .product-img-wrapper img {
    transform: scale(1.05);
}

.verified-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255,255,255,0.9);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-color);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 4px;
}

.product-body {
    padding: 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-category {
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--secondary-color);
    margin-bottom: 0.75rem;
}

.product-desc {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.supplier-info {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.premium-strip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(255, 165, 0, 0.3);
}

.supplier-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 0.2rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.supplier-name a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.supplier-name a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.supplier-location {
    font-size: 0.8rem;
    color: #6c757d;
}

.product-rating {
    color: #ffc107;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.product-actions {
    display: flex;
    gap: 10px;
    margin-top: 1.25rem;
}

.btn-view {
    flex: 1;
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: var(--radius-input);
    padding: 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    transition: all 0.2s;
}

.btn-view:hover {
    background: var(--primary-color);
    color: #fff;
}

.btn-contact {
    flex: 1;
    background: var(--primary-color);
    border: 1px solid var(--primary-color);
    color: #fff;
    border-radius: var(--radius-input);
    padding: 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    transition: all 0.2s;
}

.btn-contact:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* ── List View Specific Styles ──────────────────────────── */
#product-grid.list-view .product-col,
#opportunity-grid.list-view .product-col {
    width: 100%;
}

.list-view .product-card {
    flex-direction: row;
    align-items: stretch;
    min-height: 220px; /* Increased to fix hidden button */
}

.list-view .product-img-wrapper {
    width: 220px;
    height: 100%;
    padding-top: 0;
    flex-shrink: 0;
}

.list-view .product-body {
    flex-direction: row;
    flex-wrap: nowrap;
    padding: 1.25rem;
}

.list-view .product-main-info {
    flex: 1;
    padding-right: 1.5rem;
    border-right: 1px solid #e9ecef;
    min-width: 0;
}

.list-view .product-side-info {
    width: 220px;
    padding-left: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.list-view .supplier-info {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.list-view .product-actions {
    flex-direction: column;
}

@media (max-width: 767.98px) {
    .list-view .product-card {
        flex-direction: column;
    }
    .list-view .product-img-wrapper {
        width: 100%;
        padding-top: 75%;
    }
    .list-view .product-body {
        flex-direction: column;
    }
    .list-view .product-main-info {
        padding-right: 0;
        border-right: none;
    }
    .list-view .product-side-info {
        width: 100%;
        padding-left: 0;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid #e9ecef;
    }
    .list-view .product-actions {
        flex-direction: row;
    }
}

/* ── Pagination ─────────────────────────────────────────── */
.pagination-container {
    margin-top: 3rem;
    display: flex;
    justify-content: center;
}

.pagination-container .pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
    gap: 8px;
    margin: 0;
}

.pagination-container .page-item {
    margin: 0;
}

.pagination-container .page-link {
    color: var(--secondary-color, #101f46) !important;
    background-color: #fff !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 8px !important;
    padding: 0.6rem 1.1rem !important;
    font-weight: 600 !important;
    font-size: 0.95rem !important;
    box-shadow: 0 2px 4px rgba(16, 31, 70, 0.03) !important;
    transition: all 0.25s ease-in-out !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
}

.pagination-container .page-link:hover {
    background-color: var(--primary-color, #186ad0) !important;
    border-color: var(--primary-color, #186ad0) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(24, 106, 208, 0.25) !important;
    transform: translateY(-1px);
}

.pagination-container .page-item.active .page-link {
    background-color: var(--primary-color, #186ad0) !important;
    border-color: var(--primary-color, #186ad0) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(24, 106, 208, 0.3) !important;
}

.pagination-container .page-item.disabled .page-link {
    color: #9cb2c9 !important;
    pointer-events: none !important;
    background-color: #f8f9fa !important;
    border-color: #e9ecef !important;
    box-shadow: none !important;
    opacity: 0.7;
}

/* ── Loader & Empty State ───────────────────────────────── */
#loader {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem 0;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: #fff;
    border-radius: var(--radius-card);
    box-shadow: var(--deep-shadow);
}

.empty-state i {
    font-size: 4rem;
    color: #ced4da;
    margin-bottom: 1.5rem;
}

.empty-state h3 {
    color: var(--secondary-color);
    font-weight: 700;
    margin-bottom: 1rem;
}

.empty-state p {
    color: #6c757d;
    margin-bottom: 2rem;
}

/* ── Responsive Mobile Filter Button ────────────────────── */
.mobile-filter-btn {
    display: none;
}

@media (max-width: 991.98px) {
    .filter-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 320px;
        height: 100vh;
        z-index: 1050;
        overflow-y: auto;
        border-radius: 0;
        transition: left 0.3s ease;
        padding-bottom: 80px;
    }

    .filter-sidebar.open {
        left: 0;
    }

    .mobile-filter-btn {
        display: inline-block;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 1040;
    }

    .sidebar-overlay.open {
        display: block;
    }

    .filter-close-btn {
        display: block !important;
    }
}

/* ── Top Search Bar Toggle Animation ───────────────────── */
.top-search-bar {
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease, margin 0.35s ease, padding 0.35s ease, border-color 0.35s ease;
    max-height: 250px; /* High enough to contain the search bar layout */
    opacity: 1;
    overflow: hidden;
}

.top-search-bar.search-hidden {
    max-height: 0 !important;
    opacity: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-top-width: 0 !important;
    border-bottom-width: 0 !important;
    border-left-width: 0 !important;
    border-right-width: 0 !important;
    pointer-events: none;
}

/* ── Quick View Modal Custom Styles ─────────────────────── */
#qv-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
}

#qv-badges .badge {
    white-space: normal !important;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.35;
    text-align: left;
    max-width: 100%;
    display: inline-block;
}

#qv-badges .qv-verified-badge {
    white-space: nowrap !important;
}

#qv-product-title {
    word-break: break-word;
    overflow-wrap: break-word;
}

#qv-product-desc {
    word-break: break-word;
    overflow-wrap: break-word;
}
