/* CSS Variables for consistent theming */
:root {
    --primary: #1a73e8;
    --secondary: #5f6368;
    --success: #34a853;
    --light: #f8f9fa;
    --dark: #202124;
    --gray: #dadce0;
    --danger: #ea4335;
    --warning: #fbbc05;
}

/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Roboto', Arial, sans-serif;
}

body {
    background-color: #f8f9fa;
    color: #202124;
}

/* ---------- Header & Navigation ---------- */
header {
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--dark);
    text-decoration: none;
}

.logo span {
    color: var(--primary);
}

nav ul {
    display: flex;
    list-style: none;
}

nav ul li {
    margin-left: 20px;
}

.nav-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--secondary);
    font-size: 14px;
    transition: color 0.3s;
}

.nav-icon i {
    font-size: 20px;
    margin-bottom: 5px;
}

.nav-icon:hover {
    color: var(--primary);
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--danger);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* ---------- Search Bar ---------- */
.search-container {
    background-color: white;
    padding: 20px;
    border-bottom: 1px solid var(--gray);
}

.search-bar {
    max-width: 700px;
    margin: 0 auto;
    display: flex;
    box-shadow: 0 1px 6px rgba(32,33,36,0.28);
    border-radius: 24px;
    overflow: hidden;
}

.search-bar input {
    flex: 1;
    padding: 12px 20px;
    border: none;
    outline: none;
    font-size: 16px;
}

.search-bar button {
    background-color: white;
    border: none;
    padding: 0 16px;
    cursor: pointer;
    color: var(--primary);
}

/* ---------- Categories ---------- */
.categories {
    display: flex;
    justify-content: center;
    padding: 15px;
    gap: 10px;
    flex-wrap: wrap;
    background-color: white;
    border-bottom: 1px solid var(--gray);
}

.category {
    padding: 8px 16px;
    border-radius: 20px;
    background-color: var(--light);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.category:hover {
    background-color: #e8f0fe;
}

.category.active {
    background-color: var(--primary);
    color: white;
}

/* ---------- Main Content ---------- */
main {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

.section-title {
    font-size: 24px;
    font-weight: 500;
    margin-bottom: 20px;
    color: var(--dark);
}

/* ---------- Products Grid ---------- */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.product-card {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

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

.product-image {
    height: 200px;
    position: relative;
    overflow: hidden;
}

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

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

.product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: var(--danger);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.product-info {
    padding: 15px;
}

.product-category {
    color: var(--secondary);
    font-size: 12px;
    margin-bottom: 5px;
}

.product-title {
    font-size: 16px;
    margin-bottom: 10px;
    color: var(--dark);
}

.product-description {
    font-size: 14px;
    color: var(--secondary);
    margin-bottom: 15px;
    height: 60px;
    overflow: hidden;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-price {
    font-size: 18px;
    font-weight: bold;
    color: var(--dark);
}

.product-actions {
    display: flex;
    gap: 5px;
}

.product-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    background-color: var(--light);
    color: var(--secondary);
}

.product-btn:hover {
    background-color: var(--secondary);
    color: white;
}

.add-to-cart {
    background-color: var(--secondary);
    color: white;
}

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

/* ---------- Loading Spinner ---------- */
.loading-spinner {
    display: none;
    width: 40px;
    height: 40px;
    margin: 30px auto;
    border: 4px solid var(--gray);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ---------- Newsletter ---------- */
.newsletter {
    background-color: #e8f0fe;
    padding: 40px 20px;
    margin-top: 40px;
}

.newsletter-container {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.newsletter-container h2 {
    font-size: 24px;
    margin-bottom: 10px;
    color: var(--dark);
}

.newsletter-container p {
    font-size: 16px;
    color: var(--secondary);
    margin-bottom: 20px;
}

.newsletter-form {
    display: flex;
    gap: 10px;
}

.newsletter-form input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--gray);
    border-radius: 4px;
    outline: none;
}

.newsletter-form button {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s;
}

.newsletter-form button:hover {
    background-color: #0b5cbe;
}

/* ---------- Footer ---------- */
footer {
    background-color: var(--dark);
    color: white;
    padding: 40px 20px 20px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
}

.footer-column h3 {
    font-size: 18px;
    margin-bottom: 15px;
    font-weight: 500;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: #dadce0;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: white;
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    border-top: 1px solid #5f6368;
    padding-top: 20px;
    margin-top: 30px;
    text-align: center;
    font-size: 14px;
    color: #dadce0;
}

/* ---------- No Results Message ---------- */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: var(--secondary);
}

/* ---------- Responsive Design ---------- */
@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .newsletter-form {
        flex-direction: column;
    }
    
    .nav-container {
        flex-direction: column;
        gap: 15px;
    }
    
    nav ul {
        width: 100%;
        justify-content: space-around;
    }
    
    nav ul li {
        margin: 0;
    }
    
    .footer-container {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .product-description {
        height: auto;
    }
    
    .footer-container {
        grid-template-columns: 1fr;
    }
    
    .section-title {
        font-size: 20px;
    }
}