:root {
    --primary-color: #27ae60;
    --dark-color: #2c3e50;
    --light-bg: #f9f9f9;
    --white: #ffffff;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    color: var(--dark-color);
    background-image: url('./img/background-foto.jpg'); 
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-color: rgba(255, 255, 255, 0.7); 
    background-blend-mode: lighten;
    margin: 0;
    min-height: 100vh;
}

/* HEADER */
.header {
    background: var(--white);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 1rem 5%;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: auto;
}

/* LOGO */
.logo span { color: var(--primary-color); }

/* MENU ICON */
.menu-icon{
    display: none;
    font-size: 26px;
    cursor: pointer;
}

/* LOGIN */
.logout_btn{
    text-decoration: none;
    color: black;
    transition: 0.3s;
}

.logout_btn:hover{
    color: red;
}

/* SEARCH */
.search-box input {
    padding: 10px 20px;
    border-radius: 25px; 
    border: 1px solid #ddd;
    width: 300px;
    outline: none;
}

/* MAIN */
.container {
    display: flex;
    max-width: 1200px;
    margin: 2rem auto;
    gap: 20px;
    padding: 0 20px;
}

/* SIDEBAR */
.sidebar {
    width: 250px;
    background: var(--white);
    padding: 20px;
    border-radius: 10px;
    height: fit-content;
}

.sidebar ul { list-style: none; }

.sidebar ul li {
    padding: 10px;
    cursor: pointer;
    border-radius: 5px;
    transition: var(--transition);
}

.sidebar ul li:hover {
    background-color: #e8f5e9;
    color: var(--primary-color);
}

.sidebar ul li a{
    text-decoration: none;
    color: black;
}

/* PRODUCTS */
.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 300px);
    gap: 20px;
    flex-grow: 1;
    justify-content: center;
}

.product {
    width: 100%;
    background: var(--white);
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

.product:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.product img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    margin-bottom: 15px;
}

/* BUTTONS */
.btn-add {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
}

.btn-view {
    text-decoration: none;
    background: #ecf0f1;
    color: var(--dark-color);
    padding: 8px 15px;
    border-radius: 5px;
    margin-left: 5px;
}

/* PRICES */
.old-price{
    text-decoration: line-through;
    color: #999;
    margin-right: 5px;
}

.new-price {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 18px;
}

.sale-badge{
    padding: 2px 10px;
    width: fit-content;
    background-color: rgba(255, 0, 0, 0.074);
    color: red;
    font-weight: bold;
    border-radius: 10px;
}

/* MODAL */
.modal {
    display: none; 
    position: fixed; 
    z-index: 2000; 
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
}

.modal-content {
    background-color: white;
    position: absolute;
    right: 0; 
    top: 0;
    width: 380px; 
    height: 100%;
    padding: 25px;
    box-shadow: -5px 0 25px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    color: #000; 
}

#cart-items {
    flex-grow: 1;
    overflow-y: auto;
    margin-top: 20px;
}

/* CART ITEMS */
.cart-card {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.cart-card-image img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 10px;
}

.cart-card-details { 
    flex-grow: 1; 
    margin-left: 15px; 
}

.cart-card-details h4 { 
    font-size: 15px; 
}

.cart-card-price { 
    color: var(--primary-color); 
    font-weight: bold; 
}

.remove_btn{
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
}

.dergo_porosin{
    background-color: #27ae60;
    color: white;
    padding: 5px 13px;
    border: none;
    cursor: pointer;
    border-radius: 10px;
}

/* ================= MOBILE ================= */

@media (max-width: 768px){

    .menu-icon{
        display: block;
    }

    .container{
        flex-direction: column;
    }

    .search-box input{
        width: 150px;
    }

    /* SIDEBAR MOBILE */
    .sidebar{
        position: fixed;
        top: 0;
        left: -100%;
        width: 250px;
        height: 100%;
        z-index: 3000;
        transition: 0.3s;
        border-radius: 0;
    }

    .sidebar.active{
        left: 0;
    }

    /* GRID */
    .products-grid{
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* CART FIX */
    .modal-content{
        width: 100%;
    }

    #cart-items{
        max-height: 60vh;
        overflow-y: auto;
    }

    #total{
        position: sticky;
        bottom: 0;
        background: white;
        padding-top: 10px;
    }
}

/* SMALL PHONES */
@media (max-width: 480px){

    .products-grid{
        grid-template-columns: repeat(1, 1fr) !important;
    }

    .search-box{
        display: none;
    }
}