/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

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

a {
    text-decoration: none;
    color: inherit;
}

/* ============================================
   HEADER SECTION
   ============================================ */

header {
    background-color: #2c3e50;
    color: white;
    padding: 1.2rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: bold;
}

.logo a {
    color: #3498db;
    transition: color 0.3s;
}

.logo a:hover {
    color: #5dade2;
}

/* ============================================
   BREADCRUMB NAVIGATION (3 marks)
   Hierarchical menu: Home > Category > Product
   ============================================ */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    justify-content: center;
    font-size: 0.95rem;
}

.breadcrumb a {
    color: #ecf0f1;
    transition: color 0.3s;
    padding: 0.3rem 0.5rem;
    border-radius: 3px;
}

.breadcrumb a:hover {
    color: #3498db;
    background-color: rgba(255, 255, 255, 0.1);
}

.breadcrumb .separator {
    color: #95a5a6;
    margin: 0 0.2rem;
}

.breadcrumb .current {
    color: #bdc3c7;
    font-weight: 500;
}

/* ============================================
   HOVER SHOPPING CART (3 marks - HIGHEST VALUE!)
   Pure CSS - No JavaScript needed
   - Covers elements behind (z-index + positioning)
   - Has quantity input boxes
   - Has checkout button
   - Appears on both main and product pages
   ============================================ */

.cart-trigger {
    position: relative;
    background-color: #3498db;
    padding: 0.6rem 1.2rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 0.95rem;
}

.cart-trigger:hover {
    background-color: #2980b9;
}

/* The shopping list - hidden by default */
.shopping-list {
    /* Positioning to cover elements behind */
    position: absolute;
    top: 100%;
    right: 0;
    width: 380px;
    max-height: 0;
    overflow: hidden;

    /* Styling */
    background-color: white;
    color: #333;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);

    /* Z-index to cover other elements */
    z-index: 1000;

    /* Smooth transition */
    transition: max-height 0.3s ease, padding 0.3s ease;
}

/* HOVER EFFECT - Show cart when hovering over cart-trigger */
.cart-trigger:hover .shopping-list {
    max-height: 600px;
    padding: 1.5rem;
    margin-top: 0.5rem;
}

.shopping-list h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #ecf0f1;
    font-size: 1.2rem;
}

.cart-items {
    margin-bottom: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

/* Individual cart item styling */
.cart-item {
    display: flex;
    gap: 1rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid #ecf0f1;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.item-details {
    flex: 1;
}

.item-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}

.item-price {
    color: #27ae60;
    font-weight: bold;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

/* QUANTITY INPUT BOXES (Required by assignment) */
.item-details label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #7f8c8d;
}

.item-details input[type="number"] {
    width: 60px;
    padding: 0.4rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    text-align: center;
}

.item-details input[type="number"]:focus {
    outline: none;
    border-color: #3498db;
}

/* Cart total */
.cart-total {
    padding: 1rem 0;
    border-top: 2px solid #ecf0f1;
    text-align: right;
    font-size: 1.1rem;
    color: #2c3e50;
}

/* CHECKOUT BUTTON (Required by assignment) */
.checkout-button {
    width: 100%;
    background-color: #27ae60;
    color: white;
    border: none;
    padding: 0.9rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.checkout-button:hover {
    background-color: #229954;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */

main {
    padding: 2rem 0;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
    border-radius: 10px;
    margin-bottom: 2.5rem;
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.95;
}

/* Categories Section */
.categories {
    margin-bottom: 2.5rem;
}

.categories h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.category-list {
    list-style: none;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.category-list li a {
    display: block;
    background-color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    color: #2c3e50;
    font-weight: 500;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.category-list li a:hover {
    background-color: #3498db;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

/* ============================================
   PRODUCT GRID - CSS TABLELESS LAYOUT (2 marks)
   Uses Flexbox instead of tables
   ============================================ */

.products {
    margin-bottom: 3rem;
}

.products h2,
.related-products h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

/* Flexbox grid - NO TABLES! */
.product-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

/* Each product card (2 marks requirement:
   - thumbnail
   - name  
   - price
   - addToCart button */
.product-card {
    background-color: white;
    border-radius: 10px;
    padding: 1.2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s, box-shadow 0.3s;

    /* Flexbox sizing - responsive grid */
    flex: 1 1 calc(25% - 1.5rem);
    min-width: 240px;
    max-width: 240px;

    /* Flexbox for internal layout */
    display: flex;
    flex-direction: column;
}

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

.product-link {
    display: block;
    margin-bottom: 0.8rem;
}

/* Product thumbnail (required) */
.product-image {
    width: 100%;
    height: 130px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 1rem;
    transition: opacity 0.3s;
}

.product-link:hover .product-image {
    opacity: 0.9;
}

/* Product name (required) */
.product-name {
    font-size: 1.05rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-weight: 600;
    min-height: 2.5rem;
}

/* Product price (required) */
.product-price {
    font-size: 1.3rem;
    color: #27ae60;
    font-weight: bold;
    margin-bottom: 1rem;
}

/* Add to Cart button (required) */
.add-to-cart {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    margin-top: auto;
}

.add-to-cart:hover {
    background-color: #2980b9;
    transform: scale(1.02);
}

/* ============================================
   PRODUCT DETAIL PAGE (2 marks)
   - Full-size image
   - Name, description, price
   - Add to Cart button
   ============================================ */

.product-detail {
    background-color: white;
    padding: 2.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    margin-bottom: 3rem;
    display: flex;
    gap: 3rem;
}

.product-images {
    flex: 1;
}

/* Full-size product image (required) */
.main-product-image {
    width: 100%;
    max-width: 600px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.product-info {
    flex: 1;
}

.product-info h2 {
    font-size: 2.2rem;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.product-price-large {
    font-size: 2.2rem;
    color: #27ae60;
    font-weight: bold;
    margin-bottom: 1.5rem;
}

/* Product description (required) */
.product-description {
    margin-bottom: 2rem;
    color: #555;
    line-height: 1.7;
}

.product-description h3 {
    color: #2c3e50;
    margin-bottom: 0.8rem;
    font-size: 1.3rem;
}

.product-description h4 {
    color: #34495e;
    margin-top: 1.2rem;
    margin-bottom: 0.6rem;
    font-size: 1.1rem;
}

.product-description ul {
    margin-left: 1.8rem;
    margin-bottom: 1rem;
}

.product-description li {
    margin-bottom: 0.5rem;
}

/* Large Add to Cart on product page */
.add-to-cart.large {
    padding: 1.2rem 3rem;
    font-size: 1.1rem;
    width: 100%;
}

/* Related Products */
.related-products {
    margin-top: 3rem;
}

/* ============================================
   FOOTER
   ============================================ */

footer {
    background-color: #2c3e50;
    color: white;
    padding: 2.5rem 0;
    margin-top: 3rem;
}

footer .container {
    text-align: center;
}

footer p {
    margin-bottom: 1rem;
    opacity: 0.9;
}

.footer-links {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: #ecf0f1;
    transition: color 0.3s;
    font-size: 0.95rem;
}

.footer-links a:hover {
    color: #3498db;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 992px) {
    .product-card {
        flex: 1 1 calc(33.333% - 1.5rem);
    }

    .product-detail {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .product-card {
        flex: 1 1 calc(50% - 1.5rem);
    }

    header .container {
        justify-content: center;
    }

    .breadcrumb {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .shopping-list {
        width: 320px;
        right: -20px;
    }

    .hero h2 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .product-card {
        flex: 1 1 100%;
    }

    .shopping-list {
        width: 280px;
    }

    .category-list {
        flex-direction: column;
    }

    .hero h2 {
        font-size: 1.6rem;
    }

    .hero p {
        font-size: 1rem;
    }
}