/*
Theme Name: Grocery Light
Theme URI: https://example.com/grocery-light
Author: Your Name
Author URI: https://example.com
Description: A lightweight grocery theme with infinite scroll and WooCommerce support
Version: 1.0.0
License: GPL v2 or later
Text Domain: grocery-light
*/

/* Theme Info
--------------------------------------------- */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #27ae60;
    --accent-color: #e67e22;
    --text-color: #333;
    --light-gray: #f5f5f5;
    --border-color: #ddd;
    --white: #ffffff;
    --shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Basic Reset
--------------------------------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Header Styles
--------------------------------------------- */
.site-header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
    flex-wrap: wrap;
    gap: 15px;
}

/* Logo */
.logo {
    max-width: 150px;
}

.logo img {
    max-width: 100%;
    height: auto;
}

/* Search Box */
.header-search {
    flex: 1;
    max-width: 400px;
}

.header-search form {
    display: flex;
    position: relative;
}

.header-search input[type="search"] {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.header-search input[type="search"]:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.header-search button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.3s;
}

.header-search button:hover {
    background: var(--primary-color);
}

/* Categories Menu */
.categories-menu {
    position: relative;
}

.categories-toggle {
    background: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}

.categories-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--white);
    min-width: 200px;
    box-shadow: var(--shadow);
    border-radius: 5px;
    display: none;
    z-index: 100;
}

.categories-menu:hover .categories-dropdown {
    display: block;
}

.categories-dropdown ul {
    list-style: none;
}

.categories-dropdown li {
    border-bottom: 1px solid var(--border-color);
}

.categories-dropdown a {
    display: block;
    padding: 10px 15px;
    color: var(--text-color);
    text-decoration: none;
    transition: background 0.3s;
}

.categories-dropdown a:hover {
    background: var(--light-gray);
    color: var(--secondary-color);
}

/* Cart Button */
.cart-button {
    position: relative;
}

.cart-button a {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--secondary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    transition: background 0.3s;
}

.cart-button a:hover {
    background: var(--primary-color);
}

.cart-count {
    background: var(--accent-color);
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 12px;
    margin-left: 5px;
}

/* Sign Up Button */
.signup-button a {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    transition: background 0.3s;
}

.signup-button a:hover {
    background: var(--secondary-color);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Product Grid
--------------------------------------------- */
.products-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin: 30px 0;
}

/* Grid View (Default) */
.products-container.grid-view {
    grid-template-columns: repeat(4, 1fr);
}

/* List View */
.products-container.list-view {
    grid-template-columns: 1fr;
}

.products-container.list-view .product-card {
    display: flex;
    gap: 20px;
    align-items: center;
}

.products-container.list-view .product-image {
    flex: 0 0 200px;
}

.products-container.list-view .product-details {
    flex: 1;
}

/* Product Card Design */
.product-card {
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.product-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

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

/* Discount Badge */
.discount-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--accent-color);
    color: white;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
    z-index: 1;
}

/* Rating */
.rating {
    padding: 10px 10px 5px;
    color: #ffc107;
}

.rating i {
    margin-right: 2px;
}

.rating .rating-count {
    color: #666;
    font-size: 12px;
    margin-left: 5px;
}

/* Price */
.price {
    padding: 0 10px 10px;
    font-weight: bold;
}

.regular-price {
    color: #999;
    text-decoration: line-through;
    font-size: 14px;
    margin-right: 5px;
}

.sale-price {
    color: var(--secondary-color);
    font-size: 18px;
}

/* Add Button */
.add-to-cart {
    width: 100%;
    padding: 12px;
    background: var(--secondary-color);
    color: white;
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
    text-transform: uppercase;
    font-size: 14px;
}

.add-to-cart:hover {
    background: var(--primary-color);
}

/* Loading Control */
.loading-spinner {
    text-align: center;
    padding: 20px;
    display: none;
}

.loading-spinner.active {
    display: block;
}

.spinner {
    border: 3px solid var(--light-gray);
    border-top: 3px solid var(--secondary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* View Toggle Buttons */
.view-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.view-toggle button {
    padding: 8px 15px;
    background: var(--light-gray);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.view-toggle button.active {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

/* Offer Banner */
.offer-banner {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    color: white;
    text-align: center;
    padding: 40px 20px;
    margin: 30px 0;
    border-radius: 10px;
}

.offer-banner h2 {
    font-size: 32px;
    margin-bottom: 10px;
}

.offer-banner p {
    font-size: 18px;
    opacity: 0.9;
}

/* Categories Section */
.categories-section {
    padding: 40px 0;
    background: var(--light-gray);
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.category-item {
    background: var(--white);
    padding: 20px;
    text-align: center;
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: transform 0.3s;
}

.category-item:hover {
    transform: translateY(-5px);
}

.category-item img {
    width: 60px;
    height: 60px;
    margin-bottom: 10px;
}

.category-item h3 {
    font-size: 16px;
    color: var(--text-color);
}

/* Footer
--------------------------------------------- */
.site-footer {
    background: var(--primary-color);
    color: white;
    padding: 40px 0 20px;
    margin-top: 50px;
}

.footer-menu {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.footer-menu a {
    color: white;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-menu a:hover {
    color: var(--secondary-color);
}

.copyright {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 14px;
    opacity: 0.8;
}

/* Responsive Mobile Grid
--------------------------------------------- */
@media (max-width: 1024px) {
    .products-container.grid-view {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .header-main {
        flex-direction: column;
    }
    
    .header-search {
        max-width: 100%;
    }
    
    .products-container.grid-view {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .products-container.list-view .product-card {
        flex-direction: column;
    }
    
    .products-container.list-view .product-image {
        flex: 0 0 auto;
        width: 100%;
    }
    
    .footer-menu {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .products-container.grid-view {
        grid-template-columns: 1fr;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .cart-button a,
    .signup-button a {
        padding: 8px 15px;
        font-size: 14px;
    }
    
    .offer-banner h2 {
        font-size: 24px;
    }
    
    .categories-grid {
        grid-template-columns: 1fr;
    }
}