/**
 * Product Listing Styles
 *
 * Modern, responsive styling for product listing page
 * Supports RTL layout
 * Compatible with Bootstrap 4.6
 */

/* ====================
   Product Filters Sidebar
   ==================== */
.product-filters-sidebar {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.product-filters-sidebar .filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.product-filters-sidebar .filter-section {
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

.product-filters-sidebar .filter-label {
    font-size: 14px;
    color: #333;
}

.product-filters-sidebar .filter-select,
.product-filters-sidebar input[type="text"] {
    border-radius: 8px;
    border: 1px solid #ddd;
    transition: all 0.3s ease;
}

.product-filters-sidebar .filter-select:focus,
.product-filters-sidebar input[type="text"]:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.product-filters-sidebar .active-filters .badge {
    font-size: 13px;
    font-weight: normal;
    display: inline-flex;
    align-items: center;
}

.product-filters-sidebar .active-filters .badge a {
    text-decoration: none;
    margin-right: 4px;
}

.product-filters-sidebar .active-filters .badge a:hover {
    opacity: 0.8;
}

/* ====================
   Product Card
   ==================== */
.product-card {
    transition: transform 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
}

.product-card-inner {
    transition: box-shadow 0.3s ease;
    border-radius: 12px;
    overflow: hidden;
}

.product-card-inner:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12) !important;
}

.product-image-wrapper {
    height: 220px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.product-card:hover .product-image {
    transform: scale(1.08);
}

.product-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    z-index: 1;
}

.badge-discount {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.badge-special {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    color: #333;
}

.product-title {
    font-size: 12px;
    line-height: 1.6;
    min-height: 44px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-title-link {
    text-decoration: none;
    transition: color 0.3s ease;
}

.product-title-link:hover {
    color: #007bff !important;
}

.product-shop-name {
    font-size: 13px;
}

.shop-name-text {
    display: inline-block;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-price {
    margin-top: 10px;
}

.old-price {
    font-size: 13px;
}

.current-price {
    font-size: 18px;
}

.card-footer {
    padding: 10px 15px;
}

.product-location {
    font-size: 12px;
}

.product-actions .btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.product-actions .btn:hover {
    transform: scale(1.1);
}

/* ====================
   Product Grid
   ==================== */
.products-grid-container {
    position: relative;
}

.products-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.products-loading-overlay.d-none {
    display: none !important;
}

.products-empty-state {
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.empty-state-icon {
    opacity: 0.3;
}

/* ====================
   Banner Slot
   ==================== */
.banner-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.banner-wrapper img {
    transition: transform 0.4s ease;
}

.banner-wrapper:hover img {
    transform: scale(1.05);
}

.banner-link {
    display: block;
}

/* ====================
   Pagination
   ==================== */
.products-pagination .pagination {
    flex-wrap: wrap;
}

.products-pagination .page-link {
    border-radius: 8px;
    margin: 0 3px;
    color: #1f7373;
    transition: all 0.3s ease;
}

.products-pagination .page-link:hover {
    background: #1f7373;
    color: white;
}

.products-pagination .page-item.active .page-link {
    background: #1f7373;
    border-color: #1f7373;
}

/* ====================
   Breadcrumb
   ==================== */
.breadcrumb {
    /*background: transparent;*/
    /*background: linear-gradient(135deg, #26a69a 0%, #1f7373 100%);*/
    background-color: rgba(31, 115, 115, 0.06) !important;
    border-radius: .5rem !important;
    padding: 10px 0;
    margin-bottom: 20px;
    font-size: 14px;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "|";
    padding: 8px 8px;
    /*color: #6c757d;*/
    color: #1f7373;
}

.breadcrumb-link {
    /*color: #007bff;*/
    color: #1f7373;
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb-link:hover {
    /*color: #0056b3;*/
    color: #1f7373;
    text-decoration: underline;
}

/* ====================
   Page Title
   ==================== */
.page-title {
    color: #333;
    margin-bottom: 10px;
}

/* ====================
   Responsive Design
   ==================== */
@media (max-width: 991px) {
    .product-filters-sidebar {
        position: static;
        max-height: none;
    }

    #filtersSidebar {
        margin-bottom: 20px;
    }
}

@media (max-width: 767px) {
    .product-image-wrapper {
        height: 180px;
    }

    .product-title {
        font-size: 14px;
        min-height: 38px;
    }

    .current-price {
        font-size: 16px;
    }

    .page-title {
        font-size: 1.25rem;
    }
}

@media (max-width: 575px) {
    .product-image-wrapper {
        height: 200px;
    }
}

/* ====================
   RTL Support
   ==================== */
[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before {
    content: "/";
}

[dir="rtl"] .product-badge {
    right: auto;
    left: 10px;
}

[dir="rtl"] .ml-1 {
    margin-right: 0.25rem !important;
    margin-left: 0 !important;
}

[dir="rtl"] .mr-1 {
    margin-left: 0.25rem !important;
    margin-right: 0 !important;
}

/* ====================
   Accessibility
   ==================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus visible for keyboard navigation */
.product-title-link:focus,
.filter-select:focus,
input[type="text"]:focus,
.btn:focus {
    outline: 2px solid #1f7373;
    outline-offset: 2px;
}

/* ====================
   Print Styles
   ==================== */
@media print {
    .product-filters-sidebar,
    .product-actions,
    .pagination,
    .banner-slot-container {
        display: none !important;
    }

    .product-card {
        break-inside: avoid;
    }
}

/* ========================================
   Filter Sidebar
   ======================================== */

.filter-sidebar {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 20px;
    /* WHY sticky: keeps filters visible while scrolling through shops list */
}

.filter-header {
    background: linear-gradient(135deg, #1f7373 0%, #26a69a 100%);
    color: #ffffff;
    padding: 1.25rem 1.5rem;
    border-radius: 8px 8px 0 0;
}

.filter-header h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.filter-form {
    padding: 1.5rem;
}

.filter-section {
    margin-bottom: 1.5rem;
}

.filter-section:last-of-type {
    margin-bottom: 0;
}

.filter-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333333;
    margin-bottom: 0.5rem;
}

.filter-label i {
    color: #1f7373;
    font-size: 0.85rem;
}

/* Custom Select Styling */
.custom-select {
    border-color: #d0d0d0;
    transition: border-color 0.2s ease;
}

.custom-select:focus {
    border-color: #1f7373;
    box-shadow: 0 0 0 0.2rem rgba(31, 115, 115, 0.15);
}

/* Input Styling */
.filter-section input.form-control {
    border-color: #d0d0d0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-section input.form-control:focus {
    border-color: #1f7373;
    box-shadow: 0 0 0 0.2rem rgba(31, 115, 115, 0.15);
}

/* Filter Actions */
.filter-actions {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

.filter-actions .btn {
    font-weight: 500;
}

.filter-actions .btn+.btn {
    margin-top: 0.75rem;
}

/* Active Filters Display */
.active-filters {
    margin-top: 1.5rem;
    padding: 1rem 1.5rem;
    background-color: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 8px 8px;
}

.active-filters-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #666666;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.active-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background-color: #1f7373;
    color: #ffffff;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.filter-badge-remove {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    /* WHY: allows users to quickly remove individual filters */
}

.filter-badge-remove:hover {
    opacity: 1;
}

/* ========================================
   Results Header
   ======================================== */

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e0e0e0;
}

.results-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f7373;
    margin: 0;
}

.results-count {
    font-size: 1rem;
    font-weight: 400;
    color: #666666;
}

.results-info {
    font-size: 0.9rem;
    color: #666666;
}
