/* Global */
* {
    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;
}

/* Header */
header {
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo img {
    height: 40px;
}

.logo h1 {
    font-size: 1.8rem;
    color: #2c3e50;
}

.search-bar {
    flex: 1;
    max-width: 600px;
    margin: 0 2rem;
    display: flex;
}

.search-bar input {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 4px 0 0 4px;
    font-size: 1rem;
}

.search-bar button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 0 1.5rem;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-bar button:hover {
    background-color: #2980b9;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-actions a {
    text-decoration: none;
    color: #555;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.3s;
}

.user-actions a:hover {
    color: #3498db;
}

.cart-icon {
    position: relative;
    cursor: pointer;
    font-size: 1.5rem;
    color: #555;
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Navigation */
.main-nav {
    background-color: #2c3e50;
    padding: 0 5%;
}

.main-nav ul {
    display: flex;
    list-style: none;
    max-width: 1400px;
    margin: 0 auto;
}

.main-nav li {
    position: relative;
}

.main-nav a {
    color: white;
    text-decoration: none;
    padding: 1rem 1.5rem;
    display: block;
    transition: background-color 0.3s;
}

.main-nav a:hover {
    background-color: #3498db;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 200px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    z-index: 100;
}

.dropdown-content a {
    color: #333;
    padding: 0.8rem 1rem;
}

.dropdown-content a:hover {
    background-color: #f8f9fa;
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* Hierarchical navigation */
.breadcrumb {
    background-color: #f8f9fa;
    padding: 1rem 5%;
    font-size: 0.9rem;
    color: #666;
    max-width: 1400px;
    margin: 0 auto;
}

.breadcrumb a {
    color: #3498db;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span:last-child {
    color: #333;
    font-weight: 500;
}

/* Main content */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 5%;
}

/* Banner */
.hero-banner {
    position: relative;
    margin-bottom: 3rem;
    border-radius: 8px;
    overflow: hidden;
}

.hero-banner img {
    width: 100%;
    height: 300px;
    object-fit: cover;
}

.banner-text {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    padding: 2rem;
}

.banner-text h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

/* Grid */
.products-section h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #2c3e50;
}

.products-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
}

.product-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    padding: 1.5rem;
    width: calc(33.333% - 2rem);
    min-width: 280px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.product-link {
    text-decoration: none;
    color: inherit;
}

.product-thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.product-name {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.product-price {
    font-size: 1.3rem;
    font-weight: bold;
    color: #e74c3c;
    margin-bottom: 0.5rem;
}

.product-description {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.add-to-cart {
    width: 100%;
    padding: 0.8rem;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background-color 0.3s;
}

.add-to-cart:hover {
    background-color: #2980b9;
}

/* Shopping cart */
.shopping-cart-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100vh;
    background-color: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    z-index: 2000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.shopping-cart-sidebar.active {
    right: 0;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    background-color: #2c3e50;
    color: white;
}

.close-cart {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.cart-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.cart-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

.cart-item-details {
    flex: 1;
}

.cart-item-details h4 {
    margin-bottom: 0.5rem;
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.qty-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #ddd;
    background-color: white;
    cursor: pointer;
    border-radius: 4px;
}

.qty-input {
    width: 50px;
    text-align: center;
    padding: 0.3rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.remove-item {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
}

.cart-summary {
    padding: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

.total-price {
    color: #e74c3c;
}

.checkout-btn {
    width: 100%;
    padding: 1rem;
    background-color: #27ae60;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    transition: background-color 0.3s;
}

.checkout-btn:hover {
    background-color: #219653;
}

.continue-shopping {
    width: 100%;
    padding: 0.8rem;
    background-color: #f8f9fa;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

/* Categories section styles */
.categories-section {
padding: 20px 0;
background-color: #f8f9fa;
margin-bottom: 30px;
}

.categories-section .container {
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
}

.categories-section h2 {
margin-bottom: 20px;
font-size: 1.5rem;
color: #333;
}

.categories-grid {
display: flex;
flex-wrap: wrap;
gap: 15px;
}

.category-btn {
padding: 10px 25px;
background-color: white;
border: 2px solid #e0e0e0;
border-radius: 30px;
color: #666;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
}

.category-btn:hover {
background-color: #f8b4b4;
border-color: #ff6b6b;
color: #ff6b6b;
}

.category-btn.active {
background-color: #ff6b6b;
border-color: #ff6b6b;
color: white;
}

/* Loading state */
.loading {
text-align: center;
padding: 50px;
color: #666;
font-size: 16px;
}

.loading::after {
content: '...';
animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
0%, 20% { content: '.'; }
40% { content: '..'; }
60%, 100% { content: '...'; }
}

/* Error message */
.error {
text-align: center;
padding: 50px;
color: #dc3545;
font-size: 16px;
}

.error a {
color: #ff6b6b;
text-decoration: none;
}

.error a:hover {
text-decoration: underline;
}

/* No products message */
.no-products {
text-align: center;
padding: 50px;
color: #666;
font-size: 18px;
width: 100%;
}

/* Product card image adaptation */
.product-thumbnail {
width: 100%;
height: 200px;
object-fit: cover;
border-radius: 8px;
}

/* Product detail page image */
.main-image img {
width: 100%;
max-height: 500px;
object-fit: contain;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    z-index: 1500;
    display: none;
}

.overlay.active {
    display: block;
}

/* Product info */
.product-detail-page {
    padding: 2rem 5%;
}

.product-container {
    display: flex;
    gap: 3rem;
    margin-bottom: 3rem;
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.product-images {
    flex: 1;
}

.main-image img {
    width: 100%;
    height: 400px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.image-thumbnails {
    display: flex;
    gap: 1rem;
}

.image-thumbnails img.thumbnail {
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.7;
    border: 2px solid transparent;
}

.image-thumbnails img.thumbnail:hover,
.image-thumbnails img.thumbnail.active {
    opacity: 1;
    border-color: #3498db;
    transform: scale(1.05);
}

.thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
}

.thumbnail.active {
    border-color: #3498db;
}

.product-info {
    flex: 1;
}

.product-info h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #2c3e50;
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stars {
    color: #f39c12;
}

.product-price {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.current-price {
    font-size: 2rem;
    font-weight: bold;
    color: #e74c3c;
}

.original-price {
    font-size: 1.5rem;
    text-decoration: line-through;
    color: #999;
}

.discount {
    background-color: #e74c3c;
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.product-description h3,
.product-specs h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: #2c3e50;
}

.product-description ul {
    list-style-position: inside;
    margin-top: 1rem;
}

.product-specs table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.product-specs tr {
    border-bottom: 1px solid #e0e0e0;
}

.product-specs td {
    padding: 0.8rem 0;
}

.product-specs td:first-child {
    font-weight: bold;
    width: 150px;
}

.add-to-cart-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.action-buttons {
    display: flex;
    gap: 1rem;
}

.add-to-cart-btn,
.buy-now-btn {
    flex: 1;
    padding: 1rem;
    font-size: 1.1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s;
}

.add-to-cart-btn {
    background-color: #3498db;
    color: white;
}

.add-to-cart-btn:hover {
    background-color: #2980b9;
}

.buy-now-btn {
    background-color: #27ae60;
    color: white;
}

.buy-now-btn:hover {
    background-color: #219653;
}

.delivery-info {
    margin-top: 2rem;
    padding: 1rem;
    background-color: #e8f4fc;
    border-radius: 4px;
}

.delivery-info p {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Responsive */
@media (max-width: 1200px) {
    .product-card {
        width: calc(50% - 2rem);
    }
}

@media (max-width: 768px) {
    .header-top {
        flex-direction: column;
        gap: 1rem;
    }
    
    .search-bar {
        width: 100%;
        margin: 0;
    }
    
    .main-nav ul {
        flex-wrap: wrap;
    }
    
    .product-container {
        flex-direction: column;
    }
    
    .product-card {
        width: 100%;
    }
    
    .footer-section {
        min-width: 100%;
    }
    
    .shopping-cart-sidebar {
        width: 100%;
        right: -100%;
    }
}

@media (max-width: 480px) {
    .action-buttons {
        flex-direction: column;
    }
    
    .product-price {
        flex-direction: column;
        align-items: flex-start;
    }
}