/* ----------------------- Navigation bar --------------------------------- */

body {
    background-color: hsl(0, 0%, 90%);
    margin: 0;
}

#navigation {
    background-color: hsl(0, 0%, 95%);
    margin-bottom: 1px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.nav-elements {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 3rem;
    text-decoration: none;
    list-style: none;
    cursor: pointer;
    padding: 1rem;
    margin-top: 0;
    color: hsl(0, 0%, 15%);
}

.nav-elements a{
    text-decoration: none;
    color: black;
}

.nav-elements a:active{
    
    color: hsl(197, 64%, 40%);
}

.cart-search {
    display: flex;
    gap: 1rem;
}

h1{
    text-align: center;
    margin-top: 3rem;
}

/* --------------------- Message of the day -------------------------------------- */


#messageOfDay {
    text-align: center;
    margin-top: 0;
    padding: 0;
}

#messageOfDay a {
    color: hsl(216, 100%, 36%);
    cursor: pointer;
}

/* --------------------- footer ------------------------------------- */

footer{
    margin-top: 6rem;
    background-color: #222;
    padding: 8px 40px;
    color: white;
    display: flex;
    justify-content: space-between;
    border-top: 1px solid #333
}

/* --------------------- cart badge ------------------------------------- */

.cart-icon-wrapper {
    position: relative;
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -10px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: hsl(197, 64%, 40%);
    color: white;
    font-size: 11px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* --------------------- cart section ------------------------------------- */

#cartSection,
#checkoutSection {
    max-width: 900px;
    margin: 0 auto 3rem;
    padding: 0 1.5rem;
}

#cartItems {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.empty-cart {
    text-align: center;
    color: hsl(0, 0%, 35%);
    font-size: 1.1rem;
}

.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr auto auto auto;
    gap: 1rem;
    align-items: center;
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.cart-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

.cart-item-info p {
    margin: 0.25rem 0 0;
    color: hsl(0, 0%, 35%);
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: hsl(0, 0%, 20%);
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
}

.qty-btn:hover {
    background: hsl(0, 0%, 30%);
}

.cart-item-total {
    font-weight: 700;
    min-width: 70px;
    text-align: right;
}

.remove-btn {
    border: none;
    background: transparent;
    color: hsl(0, 70%, 40%);
    cursor: pointer;
    font-weight: 600;
}

.remove-btn:hover {
    text-decoration: underline;
}

#cartSummary {
    margin-top: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    text-align: right;
}

.cart-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
}

#clearCart,
#checkoutBtn,
#placeOrderBtn {
    border: none;
    border-radius: 30px;
    padding: 0.65rem 1.5rem;
    font-weight: 700;
    cursor: pointer;
}

#clearCart {
    background: hsl(0, 0%, 85%);
    color: hsl(0, 0%, 15%);
}

#checkoutBtn,
#placeOrderBtn {
    background: hsl(197, 64%, 40%);
    color: white;
}

#clearCart:hover {
    background: hsl(0, 0%, 78%);
}

#checkoutBtn:hover,
#placeOrderBtn:hover {
    background: hsl(197, 64%, 32%);
}

/* --------------------- checkout ------------------------------------- */

.checkout-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 1.5rem;
}

.order-summary,
#checkoutForm {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.checkout-item {
    display: grid;
    grid-template-columns: 60px 1fr auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid hsl(0, 0%, 90%);
}

.checkout-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

.totals {
    margin-top: 1rem;
}

.totals p {
    display: flex;
    justify-content: space-between;
    margin: 0.4rem 0;
}

.grand-total {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid hsl(0, 0%, 85%);
    font-size: 1.1rem;
}

#checkoutForm {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

#checkoutForm label {
    font-weight: 600;
    margin-top: 0.5rem;
}

#checkoutForm input {
    padding: 0.65rem 0.75rem;
    border: 1px solid hsl(0, 0%, 80%);
    border-radius: 8px;
    font-size: 1rem;
}

#checkoutForm input:focus {
    outline: 2px solid hsl(197, 64%, 40%);
    border-color: transparent;
}

#placeOrderBtn {
    margin-top: 1.25rem;
    align-self: flex-start;
}

@media (max-width: 700px) {
    .cart-item {
        grid-template-columns: 70px 1fr;
        grid-template-areas:
            "img info"
            "qty total"
            "remove remove";
    }

    .cart-item img { grid-area: img; }
    .cart-item-info { grid-area: info; }
    .cart-item-qty { grid-area: qty; }
    .cart-item-total { grid-area: total; text-align: left; }
    .remove-btn { grid-area: remove; justify-self: start; }

    .checkout-layout {
        grid-template-columns: 1fr;
    }

    .cart-actions {
        flex-direction: column;
    }
}
