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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Sans Pro', sans-serif;
    background: #eee;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ==================== NAV ==================== */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    background: #fff;
    width: 100%;
    height: 160px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.logo-container, .logo-link {
    width: 160px;
    height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#logo {
    max-width: 100%;
    height: 100%;
    object-fit: contain;
}

.welcome-msg {
    color: #121212;
    font-size: 30px;
}

/* ==================== ITEM GRID ==================== */
.item-content {
    margin-top: 180px;        /* Extra space so fixed nav doesn't overlap */
    padding: 2rem 1rem;
    background: #e0e0e0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
}

.item {
    width: 320px;
    background: #032957;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.item-name {
    background: #eee;
    color: #812e0d;
    font-size: 21px;
    font-weight: 600;
    text-align: center;
    padding: 12px 8px;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-img {
    width: 100%;
    height: 220px;
    overflow: hidden;           /* Prevents image overflow */
    position: relative;
}

.item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;          /* Better scaling */
    transition: transform 0.3s ease;
}

.item:hover .item-img img {
    transform: scale(1.05);
}

.add-to-cart-container {
    background: #eee;
    padding: 12px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.price {
    color: #032957;
    font-size: 18px;
}

.add {
    padding: 8px 16px;
    background: #032957;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
}

.add:hover {
    background: #eee;
    color: #121212;
    border: 1px solid #121212;
}

/* ==================== CART ==================== */
.cart-container {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100%;
    background: white;
    box-shadow: -5px 0 15px rgba(0,0,0,0.3);
    transition: right 0.4s ease;
    overflow-y: auto;
    z-index: 1000;
    padding: 20px;
    color: #333;
}

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

.cart-header h2 {
    text-align: center;
    margin-bottom: 10px;
    color: #333;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
}

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

.cart-item-name {
    flex: 1;
    font-weight: bold;
}

.quantity {
    width: 60px;
    padding: 6px;
    text-align: center;
}

.item-price {
    font-weight: bold;
    color: #d32f2f;
    min-width: 80px;
    text-align: right;
}

.remove-item {
    color: #f44336;
    cursor: pointer;
    font-size: 20px;
}

.total {
    font-size: 1.4em;
    font-weight: bold;
    text-align: right;
    margin: 20px 0;
    color: #333;
}

#orderForm input {
    width: 100%;
    padding: 10px;
    margin: 8px 0;
    box-sizing: border-box;
}

.place-order {
    width: 100%;
    padding: 14px;
    background: #4caf50;
    color: white;
    border: none;
    font-size: 1.1em;
    cursor: pointer;
    margin-top: 10px;
}

/* Already in cart message */
.item-already-in-cart {
    visibility: hidden;
    position: fixed;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 20px 30px;
    border-radius: 10px;
    z-index: 2000;
    width: 90%;
    max-width: 420px;
    text-align: center;
}

/* Close icons */
.close-msg, .close-cart {
    cursor: pointer;
}

/* ==================== RESPONSIVE ==================== */
@media screen and (max-width: 768px) {
    .item-content {
        margin-top: 200px;
        padding: 1rem;
    }
    
    .item {
        width: 100%;
        max-width: 340px;
    }
    
    .main-nav {
        height: auto;
        flex-wrap: wrap;
        padding: 10px;
    }
    
    .welcome-msg {
        display: none;
    }
    
    #mobile-header {
        display: block;
        text-align: center;
        padding: 10px;
        font-size: 1.3em;
    }
    
    .cart-container {
        width: 100%;
        right: -100%;
    }
}