:root {
    --primary-color: #28a745; /* A vibrant green for main actions and branding */
    --secondary-color: #ffc107; /* A warm yellow for highlights and alerts */
    --text-dark: #212529; /* Dark text for readability */
    --text-medium: #495057; /* Medium text for descriptions */
    --text-light: #6c757d; /* Lighter text for secondary info */
    --bg-light: #f8f9fa; /* Very light background */
    --bg-white: #ffffff; /* Pure white for cards */
    --border-color: #dee2e6; /* Light grey for borders */
    --shadow-light: rgba(0, 0, 0, 0.08);
    --shadow-medium: rgba(0, 0, 0, 0.15);
    --border-radius-sm: 5px;
    --border-radius-md: 10px;
    --font-poppins: 'Poppins', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-poppins);
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: color 0.3s ease;
}

a:hover {
    color: var(--secondary-color);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 25px;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--bg-white);
}

.btn-primary:hover {
    background-color: #218838; /* Darker green */
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--text-dark);
}

.btn-secondary:hover {
    background-color: #e0a800; /* Darker yellow */
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.btn i {
    margin-left: 8px;
    font-size: 0.9em;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-dark);
    text-align: center;
    margin-bottom: 40px;
    padding-top: 20px;
}

/* Header */
.main-header {
    background-color: var(--bg-white);
    box-shadow: 0 2px 10px var(--shadow-light);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    font-size: 2.2rem;
    color: var(--secondary-color);
}

.main-nav ul {
    list-style: none;
    display: flex;
    gap: 30px;
}

.main-nav a {
    color: var(--text-dark);
    font-weight: 500;
    position: relative;
    padding-bottom: 5px;
    transition: color 0.3s ease;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--primary-color);
}

.main-nav a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.main-nav a:hover::after,
.main-nav a.active::after {
    width: 100%;
}

#cart-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
}

#cart-toggle i {
    font-size: 1.2rem;
}

#cart-count {
    background-color: var(--primary-color);
    color: var(--bg-white);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 50%;
    margin-left: 5px;
    transition: background-color 0.3s ease;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none; /* Hidden by default, shown on mobile */
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-dark);
    order: 2; /* Position after logo */
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.9) 0%, rgba(255, 193, 7, 0.7) 100%), url('https://source.unsplash.com/random/1600x600/?store,shopping') no-repeat center center/cover;
    color: var(--bg-white);
    text-align: center;
    padding: 100px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px; /* Minimum height for hero */
}

.hero-content {
    max-width: 800px;
}

.hero-content h1 {
    font-size: clamp(2.5rem, 6vw, 4rem);
    margin-bottom: 20px;
    font-weight: 700;
    line-height: 1.2;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
}

.hero-content p {
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    margin-bottom: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Product Section */
.products-section {
    padding: 60px 0;
}

.filters {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.filters input, .filters select {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    color: var(--text-medium);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    flex-grow: 1; /* Allow inputs to grow */
    max-width: 300px; /* Limit max width */
}

.filters input:focus, .filters select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.product-card {
    background-color: var(--bg-white);
    border-radius: var(--border-radius-md);
    box-shadow: 0 5px 15px var(--shadow-light);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px var(--shadow-medium);
}

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.product-card:hover img {
    transform: scale(1.03);
}

.product-info {
    padding: 20px;
    flex-grow: 1; /* Allow info section to take available space */
    display: flex;
    flex-direction: column;
}

.product-info h3 {
    font-size: 1.4rem;
    margin-bottom: 10px;
    color: var(--text-dark);
    line-height: 1.3;
}

.product-info .category {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 10px;
}

.product-info .price {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-top: auto; /* Push price to bottom */
    margin-bottom: 15px;
}

.product-info .btn {
    width: 100%;
    margin-top: 10px;
}

/* Cart Sidebar */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -380px; /* Hidden by default */
    width: 380px;
    height: 100%;
    background-color: var(--bg-white);
    box-shadow: -5px 0 15px var(--shadow-medium);
    transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 200;
    display: flex;
    flex-direction: column;
}

.cart-sidebar.open {
    right: 0;
}

.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 150;
    display: none; /* Hidden by default */
}

.cart-sidebar.open + .cart-overlay {
    display: block;
}

.cart-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-header h3 {
    font-size: 1.5rem;
    color: var(--text-dark);
}

.close-cart-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    transition: color 0.3s ease;
}

.close-cart-btn:hover {
    color: var(--text-dark);
}

.cart-items {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
}

.empty-cart-message {
    text-align: center;
    color: var(--text-light);
    font-style: italic;
    margin-top: 50px;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background-color: var(--bg-light);
}

.cart-item img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: var(--border-radius-sm);
}

.cart-item-info {
    flex-grow: 1;
}

.cart-item-info h4 {
    font-size: 1rem;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.cart-item-info p {
    font-size: 0.9rem;
    color: var(--text-medium);
}

.cart-item-price {
    font-weight: 600;
    color: var(--primary-color);
    flex-shrink: 0; /* Prevent price from shrinking */
}

.remove-item-btn {
    background: none;
    border: none;
    color: #dc3545; /* Red for remove */
    cursor: pointer;
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

.remove-item-btn:hover {
    color: #c82333;
}

.cart-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-dark);
}

.checkout-btn {
    width: 100%;
}

.checkout-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Footer */
.main-footer {
    background-color: var(--text-dark);
    color: var(--bg-light);
    padding: 50px 0 20px;
    margin-top: auto; /* Pushes footer to the bottom */
}

.main-footer .container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-col h4 {
    font-size: 1.3rem;
    color: var(--bg-white);
    margin-bottom: 25px;
    position: relative;
}

.footer-col h4::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: -10px;
    background-color: var(--primary-color);
    height: 2px;
    width: 50px;
}

.footer-col p, .footer-col ul li {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 10px;
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li a {
    color: var(--text-light);
    display: block;
    transition: color 0.3s ease, padding-left 0.3s ease;
}

.footer-col ul li a:hover {
    color: var(--primary-color);
    padding-left: 8px;
}

.social-links {
    margin-top: 20px;
    display: flex;
    gap: 15px;
}

.social-links a {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--bg-white);
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background-color: var(--primary-color);
    color: var(--bg-white);
    transform: translateY(-3px);
}

.footer-bottom {
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
    margin-top: 20px;
}

/* Responsive Design */
@media (max-width: 992px) {
    .main-nav ul {
        gap: 20px;
    }

    .hero-content h1 {
        font-size: 3rem;
    }
    .hero-content p {
        font-size: 1.1rem;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 25px;
    }

    .cart-sidebar {
        width: 350px;
    }
}

@media (max-width: 768px) {
    .main-header .container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .main-nav {
        display: none; /* Hide main nav by default on mobile */
        width: 100%;
        order: 3; /* Place below logo/toggle */
        margin-top: 20px;
    }

    .main-nav.open {
        display: block; /* Show when open */
    }

    .main-nav ul {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    .main-nav a {
        padding: 10px 0;
        width: 100%;
        text-align: center;
        border-bottom: 1px solid var(--border-color);
    }
    .main-nav a::after {
        display: none; /* Remove underline effect for mobile */
    }
    .main-nav a:hover, .main-nav a.active {
        color: var(--primary-color);
        background-color: var(--bg-light);
    }


    .mobile-menu-toggle {
        display: block; /* Show hamburger icon */
    }

    .hero-section {
        padding: 80px 0;
        min-height: 350px;
    }
    .hero-content h1 {
        font-size: 2.5rem;
    }
    .hero-content p {
        font-size: 1rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    .filters input, .filters select {
        max-width: none;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 20px;
    }

    .product-card img {
        height: 180px;
    }

    .cart-sidebar {
        width: 100%; /* Full width on smaller screens */
        right: -100%;
    }
    .cart-sidebar.open {
        right: 0;
    }

    .footer-col h4 {
        text-align: center;
    }
    .footer-col h4::before {
        left: 50%;
        transform: translateX(-50%);
    }
    .footer-col ul, .footer-col p {
        text-align: center;
    }
    .social-links {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.5rem;
        gap: 5px;
    }
    .logo i {
        font-size: 1.8rem;
    }

    .hero-section {
        padding: 60px 0;
        min-height: 300px;
    }
    .hero-content h1 {
        font-size: 2rem;
    }
    .hero-content p {
        font-size: 0.9rem;
    }

    .section-title {
        font-size: 1.8rem;
        margin-bottom: 30px;
    }

    .product-grid {
        grid-template-columns: 1fr; /* Single column layout for very small screens */
    }

    .cart-item {
        flex-wrap: wrap;
        text-align: center;
        justify-content: center;
    }
    .cart-item img {
        margin-bottom: 10px;
    }
    .cart-item-info, .cart-item-price, .remove-item-btn {
        width: 100%;
    }
    .cart-item-price {
        order: -1; /* Move price above info on small screens */
        margin-bottom: 5px;
    }
    .remove-item-btn {
        margin-top: 10px;
    }
}
/* Sell Section Styles */
.sell-section {
    padding: 60px 0;
    background-color: var(--bg-white);
    box-shadow: 0 2px 10px var(--shadow-light);
    border-radius: var(--border-radius-md);
    margin: 40px auto;
}

.sell-form {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sell-form .form-group {
    display: flex;
    flex-direction: column;
}

.sell-form label {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.sell-form input,
.sell-form select,
.sell-form textarea {
    padding: 12px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    font-size: 1rem;
    color: var(--text-medium);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.sell-form input:focus,
.sell-form select:focus,
.sell-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2);
}

/* Responsive for Sell Form */
@media (max-width: 768px) {
    .sell-form {
        padding: 0 15px;
    }
}
