: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;
    --star-color: #ffc107;
    --font-family-primary: 'Poppins', sans-serif;
    --header-height: 80px;
}

/* --- Base Reset & Typography --- */
* {
    box-sizing: border-box;
}
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;
    margin: 0;
    padding: 0;
}
h1, 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);
}

/* --- Buttons --- */
.btn-primary, .btn-signup, .add-to-cart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.8rem;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
    border: none;
}
.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-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);
}

/* --- Navigation --- */
.navbar {
    background-color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: fixed;
    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-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;
    align-items: center;
}
.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 Layout & Header --- */
.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 --- */
.search-bar-container {
    position: relative;
    width: 100%;
    max-width: 350px;
    display: flex;
    align-items: center;
}
.search-input {
    flex: 1;
    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 & Cards --- */
.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: flex-start;
    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);
}

/* --- Rating Stars --- */
.star-rating-container {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    gap: 0.1rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}
.star {
    color: var(--border-color);
    transition: color 0.2s ease, transform 0.2s ease;
}
.star:hover {
    color: var(--star-color);
    transform: scale(1.1);
}
.star.selected {
    color: var(--star-color)
}

/* --- Quantity Control --- */
.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;
}

/* --- Sidebar/Cart --- */
.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 & Scroll Reveal --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.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);
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 1.5rem 1rem;
    background-color: var(--dark-bg);
    color: var(--light-text-color);
    font-size: 0.9rem;
    margin-top: auto;
}

/* Desktop & Large Tablet Layout (>= 1024px) */
@media (min-width: 1024px) {
    .main-content {
        flex-direction: row;
        align-items: flex-start;
        padding: 2rem;
    }
    .products-section {
        flex: 1;
        min-width: 0;
        margin-right: 2rem;
    }
    .empty-sidebar {
        flex-shrink: 0;
        width: 30%;
        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);
    }
}

/* Medium Tablet Layout (768px to 1023px) */
@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%;
        margin-top: 2rem;
        position: static;
        min-height: unset;
    }
}

/* Mobile Layout (< 768px) */
@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: 0 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;
    }
}