/* ========================================
   Product Listing & Pagination Styles
   Modern, Responsive, Dark Mode Support
   ======================================== */

/* ==========================================
   MODERN PRODUCT COUNT BADGE
   ========================================== */

.products-count-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border: 1px solid #d1d5db;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.products-count-badge-live {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: #6ee7b7;
    color: #065f46;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% {
        box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
    }
    50% {
        box-shadow: 0 4px 8px rgba(16, 185, 129, 0.4);
    }
}

/* ==========================================
   MINIMAL PAGINATION STYLES
   ========================================== */

.modern-pagination,
.classic-pagination {
    margin: 2rem 0;
    user-select: none;
}

.minimal-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.pager-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background-color: #ffffff;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.pager-btn:hover {
    background-color: #f3f4f6;
    border-color: #9ca3af;
    color: #374151;
}

.pager-text {
    display: none;
}

.pager-current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.75rem;
    border: 1px solid #374151;
    border-radius: 4px;
    background-color: #374151;
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 500;
}

.pager-dots {
    color: #9ca3af;
    padding: 0 0.25rem;
    user-select: none;
}

.pager-reset {
    margin-top: 1rem;
    text-align: center;
    display: none;
}

.pager-reset-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.875rem;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.pager-reset-link:hover {
    color: #374151;
    background-color: #f3f4f6;
}

/* ==========================================
   PRODUCT GRID TRANSITIONS
   ========================================== */

#productGrid {
    transition: opacity 0.3s ease;
}

#productGrid.loading {
    opacity: 0.6;
    pointer-events: none;
}

#productGrid .product-card .card-img-top img {
    transition: height 0.3s ease, max-height 0.3s ease;
    object-fit: contain;
    width: 100%;
}

/* ==========================================
   DARK MODE SUPPORT
   ========================================== */

/* System Preference Dark Mode */
@media (prefers-color-scheme: dark) {
    /* Product Count Badge - Dark Mode */
    .products-count-badge {
        background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
        border-color: #4b5563;
        color: #e5e7eb;
    }

    .products-count-badge-live {
        background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
        border-color: #10b981;
        color: #86efac;
    }

    /* Pagination - Dark Mode */
    .pager-btn {
        background-color: #1f2937;
        border-color: #4b5563;
        color: #d1d5db;
    }

    .pager-btn:hover {
        background-color: #374151;
        border-color: #6b7280;
        color: #f3f4f6;
    }

    .pager-current {
        background-color: #f3f4f6;
        border-color: #e5e7eb;
        color: #1f2937;
    }

    .pager-dots {
        color: #6b7280;
    }

    .pager-reset-link {
        color: #9ca3af;
    }

    .pager-reset-link:hover {
        color: #d1d5db;
        background-color: #374151;
    }
}

/* Manual Dark Mode Class Support (Bootstrap & Custom) */
[data-bs-theme="dark"] .products-count-badge,
.dark-mode .products-count-badge {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    border-color: #4b5563;
    color: #e5e7eb;
}

[data-bs-theme="dark"] .products-count-badge-live,
.dark-mode .products-count-badge-live {
    background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
    border-color: #10b981;
    color: #86efac;
}

[data-bs-theme="dark"] .pager-btn,
.dark-mode .pager-btn {
    background-color: #1f2937;
    border-color: #4b5563;
    color: #d1d5db;
}

[data-bs-theme="dark"] .pager-btn:hover,
.dark-mode .pager-btn:hover {
    background-color: #374151;
    border-color: #6b7280;
    color: #f3f4f6;
}

[data-bs-theme="dark"] .pager-current,
.dark-mode .pager-current {
    background-color: #f3f4f6;
    border-color: #e5e7eb;
    color: #1f2937;
}

[data-bs-theme="dark"] .pager-dots,
.dark-mode .pager-dots {
    color: #6b7280;
}

[data-bs-theme="dark"] .pager-reset-link,
.dark-mode .pager-reset-link {
    color: #9ca3af;
}

[data-bs-theme="dark"] .pager-reset-link:hover,
.dark-mode .pager-reset-link:hover {
    color: #d1d5db;
    background-color: #374151;
}

/* ==========================================
   RESPONSIVE ADJUSTMENTS
   ========================================== */

/* Desktop Devices (768px+) - Show text labels */
@media (min-width: 768px) {
    .pager-text {
        display: inline;
    }
    
    .pager-reset {
        display: block;
    }
}

/* Mobile Devices (< 576px) */
@media (max-width: 576px) {
    .pager-btn,
    .pager-current {
        min-width: 32px;
        height: 32px;
        font-size: 0.8125rem;
    }

    .products-count-badge {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}

/* Desktop Devices (992px+) */
@media (min-width: 992px) {
    #productGrid .col-lg-3 .product-card .card-img-top img {
        height: 220px !important;
    }

    #productGrid .col-6 .product-card .card-img-top img {
        height: 310px !important;
    }
}

/* Mobile Product Grid Adjustments */
@media (max-width: 991px) {
    #productGrid .col-6 .product-card .card-img-top img {
        height: 130px !important;
    }

    .productDetailRow {
        margin-top: 0px !important;
    }

    #page-products {
        padding-bottom: 0px !important;
    }
}

/* Mobile Single Column View */
@media (max-width: 768px) {
    #productGrid .col-12 .product-card .card-img-top img {
        height: 310px !important;
    }

    .product-card .product-price {
        font-size: 20px !important;
    }
}

/* ==========================================
   ANIMATIONS
   ========================================== */

/* Smooth Loading State */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

#productGrid.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -200%;
    width: 200%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: shimmer 2s infinite;
}

/* ==========================================
   ACCESSIBILITY IMPROVEMENTS
   ========================================== */

/* Focus States */
.pager-btn:focus {
    outline: 2px solid #374151;
    outline-offset: 2px;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .pager-btn,
    .pager-current {
        border-width: 2px;
    }

    .pager-current {
        font-weight: 600;
    }
}
