/* Best Sellers Specific Styles */
/* Using CSS variables from style.css for consistency */

/* Adjust for fixed header */
body {
    padding-top: 120px;
}

/* Page Header Enhancements */
.page-header {
    background: linear-gradient(135deg, rgba(45, 80, 22, 0.9), rgba(74, 124, 89, 0.8)), 
                url('../../images/products-header-bg.jpg') center/cover;
    padding: 80px 0 60px;
    color: var(--white);
    text-align: center;
    position: relative;
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(45, 80, 22, 0.8), rgba(74, 124, 89, 0.6));
    z-index: 1;
}

.page-header-content {
    position: relative;
    z-index: 2;
    color: var(--white);
    opacity: 0;
    animation: fadeInUp 1s ease-out 0.3s forwards;
}

.page-header h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--white);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    opacity: 0;
    animation: fadeInUp 1s ease-out 0.5s forwards;
}

.page-header h1 i {
    color: #90c695;
    opacity: 0;
    animation: fadeInScale 1s ease-out 0.7s forwards;
}

.page-header p {
    opacity: 0;
    animation: fadeInUp 1s ease-out 0.9s forwards;
    color: var(--white);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    font-size: 1.1rem;
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Scale animation for icon */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Filters Section */
.filters-section {
    background-color: var(--light-gray);
    padding: 2rem 0;
    border-bottom: 1px solid #eee;
}

.filters-container {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 2rem;
    align-items: center;
    margin-bottom: 1rem;
}

.search-filter {
    display: flex;
    gap: 0.5rem;
    max-width: 400px;
    width: 100%;
}

.search-filter input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--light-green);
    border-radius: var(--radius-md);
    font-size: 1rem;
    outline: none;
    transition: var(--transition-fast);
    font-family: inherit;
}

.search-filter input:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(45, 80, 22, 0.1);
}

.search-btn {
    background-color: var(--primary-green);
    color: var(--white);
    border: none;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
}

.search-btn:hover {
    background-color: var(--secondary-green);
    transform: translateY(-1px);
}

.category-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-btn {
    background-color: var(--white);
    border: 2px solid var(--light-green);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--dark-gray);
}

.filter-btn:hover,
.filter-btn.active {
    background-color: var(--primary-green);
    color: var(--white);
    border-color: var(--primary-green);
    transform: translateY(-1px);
}

.sort-filter select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--light-green);
    border-radius: var(--radius-md);
    font-size: 1rem;
    outline: none;
    background-color: var(--white);
    cursor: pointer;
    font-family: inherit;
    color: var(--dark-gray);
}

.sort-filter select:focus {
    border-color: var(--primary-green);
}

/* Results Info */
.results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #ddd;
}

.results-count {
    color: var(--gray);
    font-size: 0.9rem;
}

.view-toggle {
    display: flex;
    gap: 0.5rem;
}

.view-btn {
    background-color: var(--white);
    border: 2px solid var(--light-green);
    padding: 0.5rem;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    color: var(--gray);
}

.view-btn.active {
    background-color: var(--primary-green);
    color: var(--white);
    border-color: var(--primary-green);
}

.view-btn:hover {
    border-color: var(--primary-green);
}

/* Products Section */
.products-section {
    padding: 3rem 0;
    background-color: var(--white);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, max-content));
    gap: var(--spacing-xl);
    margin-bottom: 3rem;
    align-items: start;
    justify-content: start;
}

/* Maintain consistent card width to prevent spreading */
.products-grid .product-card {
    width: 280px;
    max-width: 280px;
}

.product-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition-fast);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.product-image {
    position: relative;
    height: 250px;
    overflow: hidden;
    flex-shrink: 0;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-slow);
}

.product-card:hover .product-image img {
    transform: scale(1.1);
}

.product-badges {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 10;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--white);
}

.badge.fresh { background-color: #28a745; }
.badge.organic { background-color: #007bff; }
.badge.premium { background-color: #6f42c1; }
.badge.export { background-color: #fd7e14; }
.badge.available { background-color: #20c997; }
.badge.best { background-color: #ff6b35; }

.product-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    opacity: 0;
    transition: var(--transition-fast);
    z-index: 10;
}

.product-card:hover .product-actions {
    opacity: 1;
}

.action-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    color: var(--primary-green);
}

.action-btn:hover {
    background: var(--primary-green);
    color: var(--white);
    transform: scale(1.1);
}

.action-btn.active {
    background: var(--primary-green);
    color: var(--white);
}

.product-info {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 0.875rem;
    color: var(--gray);
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.farmer-name {
    font-weight: 600;
    color: var(--primary-green);
}

.location {
    font-size: 0.75rem;
    opacity: 0.8;
}

.product-title {
    margin-bottom: 0.75rem;
}

.product-title a {
    color: var(--dark-gray);
    text-decoration: none;
    font-size: 1.125rem;
    font-weight: 600;
    display: block;
    transition: var(--transition-fast);
    line-height: 1.3;
}

.product-title a:hover {
    color: var(--primary-green);
}

.product-description {
    font-size: 0.875rem;
    color: var(--gray);
    margin-bottom: 1rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.product-pricing {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.current-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-green);
}

.original-price {
    font-size: 1rem;
    color: var(--gray);
    text-decoration: line-through;
}

.discount {
    background-color: var(--golden-yellow);
    color: var(--white);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.stars {
    color: var(--golden-yellow);
    display: flex;
    gap: 0.125rem;
}

.rating-text {
    font-size: 0.875rem;
    color: var(--gray);
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--light-green);
    background: var(--white);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    transition: var(--transition-fast);
    color: var(--dark-gray);
}

.qty-btn:hover {
    background-color: var(--primary-green);
    color: var(--white);
    border-color: var(--primary-green);
}

.qty-input {
    width: 60px;
    text-align: center;
    border: 1px solid var(--light-green);
    padding: 0.5rem 0.25rem;
    border-radius: var(--radius-sm);
    outline: none;
    font-size: 0.9rem;
    font-family: inherit;
}

.qty-input:focus {
    border-color: var(--primary-green);
}

.unit {
    font-size: 0.875rem;
    color: var(--gray);
    font-weight: 500;
}

.product-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: auto;
}

.product-buttons .btn {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    cursor: pointer;
    border: 2px solid transparent;
}

.product-buttons .btn-primary {
    background-color: var(--primary-green);
    color: var(--white);
    border-color: var(--primary-green);
}

.product-buttons .btn-primary:hover {
    background-color: var(--secondary-green);
    border-color: var(--secondary-green);
    transform: translateY(-1px);
}

.product-buttons .btn-outline {
    background-color: transparent;
    color: var(--primary-green);
    border-color: var(--primary-green);
}

.product-buttons .btn-outline:hover {
    background-color: var(--primary-green);
    color: var(--white);
    transform: translateY(-1px);
}

/* General Section Header Styling */
.section-header {
    text-align: center;
    margin-bottom: 2.5rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
}

.section-header h2 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    color: var(--primary-green);
    animation: fadeInUp 0.8s ease-out 0.2s forwards;
    opacity: 0;
}

.section-header p {
    font-size: 1rem;
    opacity: 0;
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.5;
    color: var(--gray);
    animation: fadeInUp 0.8s ease-out 0.4s forwards;
}

/* Fade-in animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Best Sellers Impact Stats Section */
.impact-stats {
    background: linear-gradient(135deg, #2c5530 0%, #4a7c59 100%);
    color: white;
    padding: 3rem 0;
    margin: 3rem 0;
}

.impact-stats .section-header {
    text-align: center;
    margin-bottom: 2.5rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    opacity: 0;
    animation: fadeInUp 1s ease-out forwards;
}

.impact-stats .section-header h2 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    color: white !important;
    opacity: 0;
    animation: fadeInUp 1s ease-out 0.3s forwards;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.impact-stats .section-header p {
    font-size: 1rem;
    opacity: 0;
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9) !important;
    animation: fadeInUp 1s ease-out 0.6s forwards;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.stat-item {
    text-align: center;
    padding: 1.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
}

.stat-item:nth-child(1) { animation-delay: 0.8s; }
.stat-item:nth-child(2) { animation-delay: 1.0s; }
.stat-item:nth-child(3) { animation-delay: 1.2s; }
.stat-item:nth-child(4) { animation-delay: 1.4s; }

.stat-item:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.stat-number {
    font-size: 3rem;
    font-weight: 700;
    color: #90c695;
    display: block;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.stat-label {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: white;
}

.stat-description {
    font-size: 0.9rem;
    opacity: 0.8;
    color: white;
    line-height: 1.4;
}

/* Pagination Styles */
.pagination-section {
    margin-top: 3rem;
    padding: 2rem 0;
    border-top: 1px solid #eee;
}

.pagination-info {
    text-align: center;
    margin-bottom: 1.5rem;
}

.pagination-info span {
    color: var(--text-color);
    font-size: 0.95rem;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.pagination-btn {
    background-color: var(--white);
    border: 2px solid var(--light-green);
    color: var(--primary-green);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-btn:hover:not(:disabled) {
    background-color: var(--primary-green);
    color: var(--white);
    transform: translateY(-1px);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-numbers {
    display: flex;
    gap: 0.25rem;
}

.page-number {
    background-color: var(--white);
    border: 2px solid var(--light-green);
    color: var(--primary-green);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    font-weight: 500;
    min-width: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-number:hover {
    background-color: var(--primary-green);
    color: var(--white);
    transform: translateY(-1px);
}

.page-number.active {
    background-color: var(--primary-green);
    color: var(--white);
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 140px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    color: var(--white);
    font-weight: 500;
    opacity: 0;
    transform: translateX(400px);
    transition: var(--transition-fast);
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification.success {
    background-color: #28a745;
}

.notification.info {
    background-color: #17a2b8;
}

.notification.warning {
    background-color: #ffc107;
    color: var(--dark-gray);
}

.notification.error {
    background-color: #dc3545;
}

/* Products Page Responsive Design */
@media (max-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    body {
        padding-top: 100px;
    }
    
    .page-header {
        padding: 60px 0 40px;
    }
    
    .page-header h1 {
        font-size: 2.2rem;
    }
    
    .page-header-content {
        animation: fadeInUp 0.8s ease-out 0.2s forwards;
    }
    
    .page-header h1 {
        animation: fadeInUp 0.8s ease-out 0.4s forwards;
    }
    
    .page-header p {
        animation: fadeInUp 0.8s ease-out 0.6s forwards;
        font-size: 1rem;
    }
    
    .filters-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .search-filter {
        max-width: 100%;
    }
    
    .category-filters {
        justify-content: center;
        gap: 0.75rem;
    }
    
    .results-info {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.5rem;
    }
    
    .product-buttons {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
        max-width: 600px;
    }
    
    .impact-stats {
        padding: 2.5rem 0;
        margin: 2.5rem 0;
    }
    
    .impact-stats .section-header h2 {
        font-size: 1.8rem;
    }
    
    .impact-stats .section-header {
        margin-bottom: 2rem;
    }
    
    .section-header h2 {
        font-size: 1.8rem;
    }
    
    .section-header p {
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .page-header h1 {
        font-size: 1.8rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .page-header-content {
        animation: fadeInUp 0.6s ease-out 0.1s forwards;
    }
    
    .page-header h1 {
        animation: fadeInUp 0.6s ease-out 0.3s forwards;
    }
    
    .page-header p {
        animation: fadeInUp 0.6s ease-out 0.5s forwards;
        font-size: 0.9rem;
        max-width: 90%;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .product-info {
        padding: 1rem;
    }
    
    .filter-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .category-filters {
        gap: 0.5rem;
    }
    
    .product-meta {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        max-width: 350px;
    }
    
    .stat-item {
        padding: 1.2rem 0.8rem;
    }
    
    .stat-number {
        font-size: 2.2rem;
    }
    
    .impact-stats {
        padding: 2rem 0;
        margin: 2rem 0;
    }
    
    .impact-stats .section-header h2 {
        font-size: 1.6rem;
    }
    
    .impact-stats .section-header p {
        font-size: 0.9rem;
    }
    
    .section-header h2 {
        font-size: 1.6rem;
    }
    
    .section-header p {
        font-size: 0.85rem;
    }
    
    /* Reduce animation intensity on mobile */
    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .product-pricing {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }
}
