/* 
   MAXXI MARKET - Global Styles 
   Colors: Red (#d32f2f) & Green (#2e7d32)
*/

:root {
    --primary-red: #d32f2f;
    --primary-green: #2e7d32;
    --accent-gold: #f9a825;
    --text-dark: #1a1a1a;
    --text-gray: #666;
    --bg-light: #f4f7f6;
    --white: #ffffff;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
}

/* Header & Nav */
header {
    background-color: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.top-bar {
    background-color: var(--primary-green);
    color: var(--white);
    padding: 8px 0;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
}

.main-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 5%;
    max-width: 1400px;
    margin: 0 auto;
}

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

.logo-img {
    height: 55px;
    width: auto;
}

.brand-name {
    font-size: 1.6rem;
    font-weight: 700;
}

.brand-maxxi {
    color: var(--primary-red);
}

.brand-market {
    color: var(--primary-green);
}

.search-container {
    flex: 1;
    margin: 0 40px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid #eee;
    border-radius: 30px;
    outline: none;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--primary-green);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 25px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.nav-item i {
    font-size: 1.4rem;
    margin-bottom: 4px;
    color: var(--primary-green);
}

.nav-item:hover {
    color: var(--primary-red);
}

.cart-btn {
    position: relative;
    background: none;
    border: none;
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -10px;
    background-color: var(--primary-red);
    color: var(--white);
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 50%;
}

/* Layout */
.main-container {
    display: flex;
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 5%;
    gap: 30px;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--white);
    border-radius: 15px;
    padding: 20px;
    box-shadow: var(--shadow);
    height: fit-content;
}

.sidebar h3 {
    margin-bottom: 20px;
    color: var(--primary-green);
    border-bottom: 2px solid var(--primary-green);
    padding-bottom: 10px;
}

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

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

.category-list a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: var(--text-dark);
    border-radius: 8px;
    transition: var(--transition);
}

.category-list a:hover,
.category-list a.active {
    background-color: var(--primary-green);
    color: var(--white);
}

/* Product Grid */
.content-area {
    flex: 1;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
}

.product-card {
    background-color: var(--white);
    border-radius: 15px;
    padding: 15px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
}

.product-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-green);
}

.badge-discount {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: var(--primary-red);
    color: var(--white);
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: 700;
    z-index: 1;
}

.fav-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #ccc;
    cursor: pointer;
    z-index: 1;
}

.fav-btn.active {
    color: var(--primary-red);
}

.product-img-wrapper {
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.product-img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.product-brand {
    font-size: 0.8rem;
    color: var(--text-gray);
    margin-bottom: 5px;
}

.product-title {
    font-weight: 500;
    font-size: 1rem;
    height: 3rem;
    overflow: hidden;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-price-container {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 15px;
}

.new-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-green);
}

.old-price {
    font-size: 0.9rem;
    color: var(--text-gray);
    text-decoration: line-through;
}

.btn-add-cart {
    width: 100%;
    padding: 10px;
    background-color: var(--primary-green);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-add-cart:hover {
    background-color: var(--primary-red);
}

/* New Quantity Controls on Cards */
.qty-control-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--primary-red);
    border-radius: 8px;
    padding: 5px;
    height: 44px;
}

.qty-btn-main {
    width: 34px;
    height: 34px;
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border: none;
    border-radius: 6px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.qty-btn-main:hover {
    background-color: var(--white);
    color: var(--primary-green);
}

.qty-val-main {
    color: var(--white);
    font-weight: 700;
    font-size: 1.1rem;
}

/* Cart Sidebar */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
}

.cart-overlay.active {
    display: block;
}

.cart-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100%;
    background-color: var(--white);
    z-index: 2001;
    transition: 0.4s ease;
    padding: 30px;
    display: flex;
    flex-direction: column;
}

.cart-sidebar.active {
    right: 0;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.cart-header h2 {
    color: var(--primary-green);
}

.cart-items {
    flex: 1;
    overflow-y: auto;
}

.cart-item {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f9f9f9;
}

.cart-item-img {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.cart-footer {
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.total-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.btn-checkout {
    width: 100%;
    padding: 15px;
    background-color: var(--primary-red);
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background-color: var(--white);
    padding: 40px;
    border-radius: 20px;
    width: 500px;
    max-width: 90%;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--primary-green);
    color: var(--white);
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    transform: translateY(150%);
    transition: transform 0.3s ease;
    z-index: 4000;
}

.toast.show {
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .main-nav {
        flex-wrap: wrap;
    }

    .search-container {
        order: 3;
        margin: 15px 0 0 0;
        width: 100%;
    }
}