/* 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: #1f2937;
    background-color: #f9fafb;
}

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

/* Header Styles */
.header {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    gap: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #059669;
}

.logo-text {
    font-size: 22px;
    font-weight: 700;
    color: #059669;
}

.search-bar {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: 12px 48px 12px 16px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    background: #f9fafb;
}

.search-bar input:focus {
    outline: none;
    border-color: #059669;
    background: white;
}

.search-bar button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: #059669;
    color: white;
    border: none;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.search-bar button:hover {
    background: #047857;
}

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

.cart-icon {
    position: relative;
    color: #6b7280;
    text-decoration: none;
    transition: color 0.3s ease;
}

.cart-icon:hover {
    color: #059669;
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc2626;
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.mobile-menu-toggle span {
    width: 20px;
    height: 2px;
    background: #6b7280;
    margin: 2px 0;
    transition: 0.3s;
}

.main-nav {
    border-top: 1px solid #e5e7eb;
    padding: 0;
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 0;
}

.main-nav li a {
    display: block;
    padding: 16px 24px;
    text-decoration: none;
    color: #6b7280;
    font-weight: 500;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.main-nav li a:hover,
.main-nav li a.active {
    color: #059669;
    border-bottom-color: #059669;
}

/* Breadcrumb */
.breadcrumb {
    background: #f3f4f6;
    padding: 12px 0;
}

.breadcrumb ol {
    display: flex;
    list-style: none;
    gap: 8px;
    font-size: 14px;
}

.breadcrumb li:not(:last-child)::after {
    content: '/';
    margin-left: 8px;
    color: #9ca3af;
}

.breadcrumb a {
    color: #059669;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* Main Content Layout */
.main-content {
    padding: 24px 0;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
}

/* Sidebar Styles */
.sidebar {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 24px;
    height: fit-content;
    position: sticky;
    top: 100px;
    border: 1px solid #e5e7eb;
}

.filter-section {
    margin-bottom: 32px;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #111827;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 8px;
}

.category-list {
    list-style: none;
}

.category-list li {
    margin-bottom: 8px;
}

.category-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    color: #6b7280;
    text-decoration: none;
    transition: color 0.3s ease;
    border-radius: 4px;
}

.category-list a:hover {
    color: #059669;
    background: #f0fdf4;
    padding-left: 8px;
}

.category-list span {
    font-size: 12px;
    color: #9ca3af;
}

.price-filter label,
.brand-filter label,
.package-filter label {
    display: block;
    margin-bottom: 12px;
    cursor: pointer;
    padding: 4px 0;
    transition: color 0.3s ease;
}

.price-filter label:hover,
.brand-filter label:hover,
.package-filter label:hover {
    color: #059669;
}

.price-filter input,
.brand-filter input,
.package-filter input {
    margin-right: 8px;
    accent-color: #059669;
}

.brand-filter .count {
    color: #9ca3af;
    font-size: 12px;
}

/* Product Area */
.product-area {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 24px;
    border: 1px solid #e5e7eb;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
    flex-wrap: wrap;
    gap: 16px;
}

.results-info strong {
    color: #059669;
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-options select {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: white;
}

.view-toggle {
    display: flex;
    gap: 4px;
}

.view-toggle button {
    padding: 8px;
    border: 1px solid #d1d5db;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-toggle button:first-child {
    border-radius: 6px 0 0 6px;
}

.view-toggle button:last-child {
    border-radius: 0 6px 6px 0;
}

.view-toggle button.active {
    background: #059669;
    color: white;
    border-color: #059669;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.product-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    border-color: #059669;
}

.product-image {
    position: relative;
    width: 100%;
    height: 220px;
    background: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

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

.product-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #dc2626;
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.product-badge.new {
    background: #059669;
}

.product-badge.sale {
    background: #f59e0b;
}

.product-badge.organic {
    background: #10b981;
}

.product-info {
    padding: 16px;
}

.product-category {
    color: #6b7280;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.product-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
    line-height: 1.4;
}

.product-specs {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 12px;
    line-height: 1.4;
}

.product-price {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.current-price {
    font-size: 18px;
    font-weight: 700;
    color: #059669;
}

.original-price {
    font-size: 14px;
    color: #9ca3af;
    text-decoration: line-through;
}

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

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.btn-primary {
    background: #059669;
    color: white;
    flex: 1;
}

.btn-primary:hover {
    background: #047857;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover {
    background: #e5e7eb;
    color: #374151;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    background: white;
    color: #6b7280;
    text-decoration: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
}

.pagination-btn:hover:not(:disabled) {
    border-color: #059669;
    color: #059669;
}

.pagination-btn.active {
    background: #059669;
    color: white;
    border-color: #059669;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-numbers {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-dots {
    padding: 8px 4px;
    color: #9ca3af;
}

/* Footer */
.footer {
    background: #111827;
    color: #d1d5db;
    margin-top: 48px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 32px;
    padding: 48px 0 32px;
}

.footer-section h4 {
    color: white;
    margin-bottom: 16px;
    font-size: 18px;
}

.footer-section p {
    line-height: 1.6;
    margin-bottom: 16px;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 8px;
}

.footer-section ul li a {
    color: #9ca3af;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section ul li a:hover {
    color: white;
}

.social-links {
    display: flex;
    gap: 12px;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #374151;
    color: #9ca3af;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background: #059669;
    color: white;
}

.contact-info p {
    margin-bottom: 12px;
    font-size: 14px;
}

.footer-bottom {
    border-top: 1px solid #374151;
    padding: 16px 0;
    text-align: center;
    color: #9ca3af;
}

/* List View */
.product-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.product-grid.list-view .product-card {
    display: flex;
    flex-direction: row;
}

.product-grid.list-view .product-image {
    width: 200px;
    height: 150px;
    flex-shrink: 0;
}

.product-grid.list-view .product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-grid.list-view .product-actions {
    margin-top: auto;
    align-self: flex-start;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .content-wrapper {
        grid-template-columns: 250px 1fr;
        gap: 24px;
    }
    
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 12px;
    }
    
    .header-top {
        flex-wrap: wrap;
        gap: 16px;
    }
    
    .search-bar {
        order: 3;
        flex-basis: 100%;
    }
    
    .main-nav {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .content-wrapper {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .sidebar {
        position: static;
        order: 2;
    }
    
    .product-area {
        order: 1;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .toolbar > div {
        justify-content: center;
    }
    
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 16px;
    }
    
    .product-grid.list-view .product-card {
        flex-direction: column;
    }
    
    .product-grid.list-view .product-image {
        width: 100%;
        height: 200px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 32px 0 24px;
    }
    
    .pagination {
        gap: 4px;
    }
    
    .pagination-btn {
        padding: 6px 8px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: 1fr;
    }
    
    .logo-text {
        font-size: 18px;
    }
    
    .product-card {
        margin: 0 auto;
        max-width: 300px;
    }
}

/* Loading States */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #059669;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus states for keyboard navigation */
button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: 2px solid #059669;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .product-card {
        border-width: 2px;
    }
    
    .btn {
        border-width: 2px;
    }
}