:root {
    --primary-color: #4CAF50;
    --primary-dark: #45a049;
    --primary-light: #81c784;
    --secondary-color: #FF9800;
    --secondary-dark: #f57c00;
    --danger-color: #f44336;
    --text-color: #333;
    --text-light: #666;
    --text-lighter: #999;
    --light-gray: #f8f9fa;
    --border-color: #e0e0e0;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
    --shadow-hover: 0 12px 28px rgba(0,0,0,0.15);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    /*box-sizing: border-box;*/
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    background: #fff;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.header {
    background: white;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.header-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
    gap: 20px;
}

.logo a {
    text-decoration: none;
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    /*-webkit-text-fill-color: transparent;*/
    background-clip: text;
}

.search-bar {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.search-bar form {
    display: flex;
}

.search-bar input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px 0 0 12px;
    font-size: 15px;
    transition: var(--transition);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-bar button {
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0 12px 12px 0;
    cursor: pointer;
    transition: var(--transition);
}

.search-bar button:hover {
    background: var(--primary-dark);
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-top: 5px;
    display: none;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 25px;
}

.cart-icon {
    position: relative;
    color: var(--text-color);
    font-size: 1.5rem;
    text-decoration: none;
    transition: var(--transition);
}

.cart-icon:hover {
    color: var(--primary-color);
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -12px;
    background: var(--secondary-color);
    color: white;
    border-radius: 50%;
    padding: 2px 7px;
    font-size: 12px;
    font-weight: 600;
}

.login-btn {
    padding: 8px 20px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: var(--transition);
}

.login-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.user-menu {
    position: relative;
    cursor: pointer;
}

.user-menu i {
    font-size: 1.5rem;
    color: var(--text-color);
}

.dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    min-width: 180px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    display: none;
    z-index: 1000;
    margin-top: 10px;
}

.user-menu:hover .dropdown {
    display: block;
}

.dropdown a {
    display: block;
    padding: 12px 20px;
    color: var(--text-color);
    text-decoration: none;
    transition: var(--transition);
}

.dropdown a:hover {
    background: var(--light-gray);
    color: var(--primary-color);
}

/* Category Navigation */
/*.category-nav {*/
/*    background: var(--light-gray);*/
/*    border-bottom: 1px solid var(--border-color);*/
/*    overflow-x: auto;*/
/*    scrollbar-width: thin;*/
/*}*/

/*.category-list {*/
/*    display: flex;*/
/*    list-style: none;*/
/*    gap: 30px;*/
/*    padding: 12px 0;*/
/*    margin: 0;*/
/*}*/

/*.category-list a {*/
/*    text-decoration: none;*/
/*    color: var(--text-color);*/
/*    display: flex;*/
/*    align-items: center;*/
/*    gap: 8px;*/
/*    font-weight: 500;*/
/*    padding: 5px 0;*/
/*    transition: var(--transition);*/
/*}*/

/*.category-list a:hover {*/
/*    color: var(--primary-color);*/
/*    transform: translateY(-2px);*/
/*}*/

/* Hero Slider */
.hero-slider {
    position: relative;
    height: 500px;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.slider-container {
    position: relative;
    height: 100%;
    overflow: hidden;
}

.slider-wrapper {
    display: flex;
    height: 100%;
    transition: transform 0.5s ease;
}

.slide {
    min-width: 100%;
    position: relative;
    height: 100%;
}

.slide-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    filter: brightness(0.7);
}

.slide-content {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
    z-index: 2;
}

.slide-text {
    color: white;
    max-width: 600px;
}

.slide-text h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    animation: fadeInUp 0.8s ease;
}

.slide-text p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    animation: fadeInUp 0.8s ease 0.2s both;
}

.slide-btn {
    display: inline-block;
    padding: 14px 32px;
    background: var(--secondary-color);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: var(--transition);
    animation: fadeInUp 0.8s ease 0.4s both;
}

.slide-btn:hover {
    background: var(--secondary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.3);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    z-index: 10;
}

.slider-btn:hover {
    background: rgba(255,255,255,0.5);
    transform: translateY(-50%) scale(1.1);
}

.prev-btn {
    left: 20px;
}

.next-btn {
    right: 20px;
}

.slider-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: var(--transition);
}

.dot.active {
    width: 30px;
    border-radius: 5px;
    background: white;
}

/* Categories Bar */
.categories-bar {
    background: white;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.categories-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    overflow-x: auto;
    padding: 5px 0;
}

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-color);
    transition: var(--transition);
    min-width: 70px;
}

.category-item:hover {
    transform: translateY(-5px);
    color: var(--primary-color);
}

.category-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.category-item span {
    font-size: 0.85rem;
    font-weight: 500;
}

/* Product Sections */
.product-section {
    margin: 50px 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-title i {
    font-size: 1.8rem;
    color: var(--primary-color);
}

.section-title h2 {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-color);
}

.view-all {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.view-all:hover {
    color: var(--primary-dark);
    transform: translateX(5px);
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 25px;
}

.product-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
}

.product-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    display: flex;
    gap: 8px;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

.discount-badge {
    background: var(--danger-color);
}

.organic-badge {
    background: #4CAF50;
}

.popular-badge {
    background: var(--secondary-color);
}

.offer-badge {
    background: #9c27b0;
}

.product-image {
    position: relative;
    padding-top: 100%;
    background: var(--light-gray);
    overflow: hidden;
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.quick-add-btn {
    position: absolute;
    bottom: -40px;
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    color: var(--primary-color);
    font-size: 1.2rem;
}

.product-card:hover .quick-add-btn {
    bottom: 12px;
}

.quick-add-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

.offer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,152,0,0.9), rgba(255,87,34,0.9));
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.product-card:hover .offer-overlay {
    opacity: 1;
}

.offer-text {
    color: white;
    font-weight: 600;
    transform: rotate(-15deg);
    font-size: 1.2rem;
}

.product-info {
    padding: 16px;
}

.product-info h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.product-info h3 a {
    color: var(--text-color);
    text-decoration: none;
    transition: var(--transition);
}

.product-info h3 a:hover {
    color: var(--primary-color);
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.product-rating .fas.fa-star,
.product-rating .fas.fa-star-half-alt {
    color: #ffc107;
}

.product-rating .far.fa-star {
    color: #ddd;
}

.product-rating span {
    color: var(--text-lighter);
    font-size: 0.8rem;
}

.price {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
}

.current-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
}

.mrp {
    text-decoration: line-through;
    color: var(--text-lighter);
    font-size: 0.9rem;
}

.unit-info {
    color: var(--text-lighter);
    font-size: 0.8rem;
    margin-bottom: 12px;
}

.stock-info {
    margin-bottom: 12px;
}

.in-stock {
    color: var(--primary-color);
    font-size: 0.8rem;
    font-weight: 500;
}

.low-stock {
    color: var(--secondary-color);
    font-size: 0.8rem;
    font-weight: 500;
}

.out-of-stock {
    color: var(--danger-color);
    font-size: 0.8rem;
    font-weight: 500;
}

.savings {
    color: var(--danger-color);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 12px;
}

.add-to-cart-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
}

.add-to-cart-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* Features Section */
.features-section {
    margin: 60px 0;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.feature-card {
    text-align: center;
    padding: 30px;
    background: var(--light-gray);
    border-radius: 16px;
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.feature-card i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.feature-card h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.feature-card p {
    color: var(--text-light);
}

/* Newsletter Section */
.newsletter-section {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    padding: 60px 0;
    margin: 40px 0 0;
    border-radius: 0;
}

.newsletter-content {
    text-align: center;
    color: white;
}

.newsletter-content i {
    font-size: 3rem;
    margin-bottom: 20px;
}

.newsletter-content h2 {
    font-size: 2rem;
    margin-bottom: 15px;
}

.newsletter-content p {
    margin-bottom: 25px;
    opacity: 0.9;
}

.newsletter-form {
    display: flex;
    max-width: 500px;
    margin: 0 auto;
    gap: 15px;
}

.newsletter-form input {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
}

.newsletter-form button {
    padding: 14px 32px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.newsletter-form button:hover {
    background: var(--secondary-dark);
    transform: translateY(-2px);
}

/* Footer */
.footer {
    background: #1a1a1a;
    color: #999;
    padding: 60px 0 20px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h3 {
    color: white;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section ul li a {
    color: #999;
    text-decoration: none;
    transition: var(--transition);
}

.footer-section ul li a:hover {
    color: var(--primary-color);
    padding-left: 5px;
}

.footer-section p {
    margin-bottom: 10px;
}

.footer-section i {
    margin-right: 10px;
    color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #333;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .hero-slider {
        height: 400px;
    }
    
    .slide-text h1 {
        font-size: 2.5rem;
    }
}

@media (max-width: 768px) {
    .header-main {
        flex-direction: column;
        padding: 12px 0;
    }
    
    .search-bar {
        width: 100%;
        max-width: none;
    }
    
    .hero-slider {
        height: 300px;
    }
    
    .slide-text h1 {
        font-size: 1.8rem;
    }
    
    .slide-text p {
        font-size: 1rem;
    }
    
    .slide-btn {
        padding: 10px 24px;
        font-size: 0.9rem;
    }
    
    .slider-btn {
        width: 36px;
        height: 36px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .section-title h2 {
        font-size: 1.4rem;
    }
    
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .newsletter-form {
        flex-direction: column;
        padding: 0 20px;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
    
    .product-info h3 {
        font-size: 0.9rem;
    }
    
    .current-price {
        font-size: 1.1rem;
    }
    
    .add-to-cart-btn {
        padding: 8px;
        font-size: 0.8rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
}

/* Add these helper functions to includes/functions.php */
<?php
// Add these functions to your existing functions.php file

function getProductRating($product_id) {
    $database = new Database();
    $db = $database->getConnection();
    $stmt = $db->prepare("SELECT AVG(rating) as avg_rating FROM reviews WHERE product_id = ?");
    $stmt->execute([$product_id]);
    $result = $stmt->fetch(PDO::FETCH_ASSOC);
    return round($result['avg_rating'] ?? 0, 1);
}

function getReviewCount($product_id) {
    $database = new Database();
    $db = $database->getConnection();
    $stmt = $db->prepare("SELECT COUNT(*) as count FROM reviews WHERE product_id = ?");
    $stmt->execute([$product_id]);
    $result = $stmt->fetch(PDO::FETCH_ASSOC);
    return $result['count'] ?? 0;
}
?>