:root {
    --primary-color: #007bff; 
    --secondary-color: #6c757d; 
    --accent-color: #28a745; 
    --light-bg: #f8f9fa; 
    --dark-bg: #343a40; 
    --text-color: #343a40; 
    --light-text-color: #e9ecef;
    --border-color: #dee2e6;
    --font-family-primary: 'Poppins', sans-serif;
    --header-height: 80px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family-primary);
    background-color: var(--light-bg);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    scroll-behavior: smooth;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3 {
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

p {
    font-weight: 300;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: color 0.3s ease;
}

a:hover {
    color: var(--accent-color);
}

.btn-primary, .btn-secondary, .btn-signup, .add-to-cart-btn {
    display: inline-block;
    padding: 0.8rem 1.8rem;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: 2px solid var(--primary-color);
}

.btn-primary:hover {
    background-color: #0056b3; 
    border-color: #0056b3;
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.btn-signup, .add-to-cart-btn {
    background-color: var(--accent-color);
    color: white;
    border: 2px solid var(--accent-color);
}

.btn-signup:hover, .add-to-cart-btn:hover {
    background-color: #218838; 
    border-color: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(40, 167, 69, 0.3); 
}

.navbar {
    background-color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 1000;
    min-height: var(--header-height);
    display: flex;
    align-items: center;
    transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
}

.navbar.scrolled {
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.navbar .logo {
    width: 60px;
    height: auto;
}

.navbar .nav-links {
    display: flex;
    list-style: none;
    gap: 2.5rem;
    margin: 0;
    padding: 0;
}

.navbar .nav-links li a:not(.btn-signup) {
    color: var(--text-color);
    font-weight: 600;
    position: relative;
    padding-bottom: 5px;
    text-decoration: none;
}

.navbar .nav-links li a:not(.btn-signup).active,
.navbar .nav-links li a:not(.btn-signup):hover {
    color: var(--primary-color);
}

.navbar .nav-links li a:not(.btn-signup)::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.navbar .nav-links li a:not(.btn-signup):hover::after,
.navbar .nav-links li a:not(.btn-signup).active::after {
    width: 100%;
}

.navbar .nav-links .btn-signup {
    margin-left: 1rem;
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
    text-decoration: none;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--primary-color);
}

.main-content {
    flex-grow: 1; 
    display: flex;
    flex-direction: column;
    max-width: 1200px; 
    margin: calc(var(--header-height) + 2rem) auto 2rem auto; 
    padding: 0 2rem;
    gap: 2rem; 
}

.products-header {
    display: flex;
    flex-direction: column; 
    align-items: center; 
    justify-content: space-between;
    margin-bottom: 2rem;
    gap: 1rem;
    width: 100%;
}

.section-title {
    font-size: 2.8rem;
    margin-bottom: 0; 
    text-align: center; 
    line-height: 1.2; 
    color: var(--text-color);
}

.search-bar-container {
    position: relative;
    width: 100%; 
    max-width: 350px; 
}

.search-input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.5rem; 
    border: 1px solid var(--border-color);
    border-radius: 50px; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    font-family: var(--font-family-primary);
    font-size: 1rem;
    color: var(--text-color);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    height: 1.25rem;
    width: 1.25rem;
    color: var(--secondary-color);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem; 
}

.product-card {
    background-color: white;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    overflow: hidden; 
    display: flex;
    flex-direction: column; 
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: center;
    padding-bottom: 1.5rem; 
}

.product-card:hover {
    transform: translateY(-8px); 
    box-shadow: 0 12px 25px rgba(0,0,0,0.15);
}

.product-image {
    width: 100%;
    height: 200px; 
    object-fit: cover;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    margin-bottom: 1rem; 
    transition: transform 0.3s ease; 
}

.product-card:hover .product-image {
    transform: scale(1.05); 
}

.product-info {
    padding: 0 1.5rem 1rem 1.5rem; 
    flex-grow: 1; 
    display: flex;
    flex-direction: column;
    justify-content: space-between; 
    align-items: center; 
}

.product-name {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    line-height: 1.2;
}

.product-price {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.product-quantity-control {
    display: flex;
    align-items: center;
    justify-content: center; 
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 1rem;
    color: var(--secondary-color);
}

.quantity-input {
    width: 60px; 
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-align: center;
    font-family: inherit;
    color: var(--text-color);
}

.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.add-to-cart-btn {
    width: calc(100% - 3rem); 
    margin: 0 auto; 
    padding: 0.8rem 1.5rem; 
    font-size: 1.05rem;
}

.empty-sidebar {
    background-color: white;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.05);
    padding: 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border-color); 
    height: fit-content;
    min-height: 300px; 
}

.sidebar-title {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.sidebar-cta {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    width: 100%;
}

.sidebar-cta h3 {
    font-size: 1.2rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.sidebar-cta p {
    font-size: 0.95rem;
    margin-bottom: 0.3rem;
    color: var(--secondary-color);
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}
.cart-item:last-child {
    border-bottom: none;
}
.cart-item-info {
    display: flex;
    flex-direction: column;
    text-align: left;
}
.cart-item-name {
    font-weight: 600;
    color: var(--text-color);
}
.cart-item-price {
    font-size: 0.9rem;
    color: var(--secondary-color);
}
.remove-from-cart-btn {
    background: none;
    border: none;
    color: #ff4d4d;
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.3s ease;
}
.remove-from-cart-btn:hover {
    color: #e60000;
}

.cart-summary {
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.cart-summary p {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

.cart-summary .btn-primary {
    width: 100%;
}

.cart-placeholder {
    padding: 1rem;
    text-align: center;
    color: var(--secondary-color);
    font-style: italic;
}

.transaction-message {
    padding: 2rem;
    background-color: #e9f7ef;
    border: 2px solid var(--accent-color);
    border-radius: 12px;
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

.transaction-message h3 {
    color: var(--accent-color);
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.transaction-message p {
    color: var(--text-color);
    font-size: 1rem;
    margin-bottom: 0;
}

/* --- Animations --- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.reveal-item {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal-item.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Responsive Design --- */
@media (min-width: 1024px) {
    .main-content {
        flex-direction: row; 
        align-items: flex-start;
        padding: 2rem; 
    }

    .products-section {
        flex: 1; 
        order: 1;
        min-width: 0; 
        margin-right: 2rem;
    }

    .empty-sidebar {
        flex-shrink: 0;
        width: 30%;
        order: 2;
        position: sticky; 
        top: calc(var(--header-height) + 2rem); 
        min-width: 280px; 
    }

    .products-header {
        flex-direction: row;
        align-items: center;
        text-align: left;
    }

    .section-title {
        text-align: left; 
        margin-bottom: 0;
    }

    .search-bar-container {
        max-width: 250px;
    }

    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 1023px) { 
    .main-content {
        padding: 1.5rem;
        flex-direction: column; 
    }
    .products-header {
        flex-direction: column; 
        align-items: center;
    }
    .section-title {
        font-size: 2.2rem;
        text-align: center;
        margin-bottom: 1.5rem;
    }
    .product-grid {
        grid-template-columns: repeat(2, 1fr); 
    }
    .empty-sidebar {
        width: 100%;
        order: 2;
        margin-top: 2rem;
        position: static;
        min-height: unset; 
    }
}

@media (max-width: 767px) { 
    .navbar-container {
        padding: 0 1rem;
    }
    .navbar .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: var(--header-height);
        left: 0;
        width: 100%;
        background-color: white;
        box-shadow: 0 5px 10px rgba(0,0,0,0.05);
        padding: 1rem 0;
        z-index: 999;
        align-items: center;
    }
    .navbar .nav-links.active {
        display: flex;
    }
    .navbar .nav-links li {
        margin: 0.5rem 0;
    }
    .navbar .nav-links a {
        padding: 0.5rem 0;
        width: 100%;
        text-align: center;
    }
    .navbar .nav-links .btn-signup {
        margin-left: 0;
        margin-top: 1rem;
        padding: 0.8rem 1.8rem;
    }
    .menu-toggle {
        display: block;
    }

    .main-content {
        padding: 1rem;
        margin-top: var(--header-height);
        flex-direction: column;
    }
    .products-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .section-title {
        font-size: 2.2rem;
        margin-bottom: 1.5rem;
    }
    .search-bar-container {
        width: 100%;
    }
    .product-grid {
        grid-template-columns: 1fr;
    }
    .product-card {
        max-width: 350px; 
        margin-left: auto;
        margin-right: auto;
    }
    .product-image {
        height: 220px;
    }
    .product-name {
        font-size: 1.2rem;
    }
    .product-price {
        font-size: 1.5rem;
    }
    .add-to-cart-btn {
        width: 90%;
    }
    .empty-sidebar {
        width: 100%;
        margin-top: 2rem;
        position: static;
        min-height: unset;
    }
}

@media (max-width: 480px) {
    .navbar .logo {
        width: 50px;
    }
    .section-title {
        font-size: 1.8rem;
    }
    .add-to-cart-btn {
        font-size: 0.95rem;
        padding: 0.7rem 1.2rem;
    }
    .product-price {
        font-size: 1.3rem;
    }
}