:root {
    --primary-color: #ff6b6b;
    --secondary-color: #333;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #2d3436;
    --light-text: #636e72;
    --border-radius: 12px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    padding-bottom: 80px; /* Space for floating cart */
}

/* Header */
header {
    background-color: var(--card-bg);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

/* Categories */
.categories-wrapper {
    overflow-x: auto;
    padding: 1rem 2rem;
    background: var(--card-bg);
    margin-bottom: 1rem;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}
.categories-wrapper::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.category-btn {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    margin-right: 0.5rem;
    border: 1px solid #eee;
    border-radius: 20px;
    background: white;
    cursor: pointer;
    font-weight: 500;
    color: var(--light-text);
    transition: all 0.3s ease;
}

.category-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Menu Grid */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    padding: 0 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .menu-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 2rem;
        padding: 0 2rem;
    }
}

@media (max-width: 768px) {
    .modal {
        padding: 0;
        align-items: flex-end; /* Sheet style or full screen */
    }
    
    .modal-content {
        max-width: 100%;
        height: 100%; /* Full screen */
        max-height: 100%;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    
    .detail-image {
        height: 300px;
    }
    
    .detail-info {
        flex: 1;
        overflow-y: auto;
    }

    .close-modal {
        top: 10px;
        right: 10px;
        background: white;
        box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    }
}

.menu-item {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
    cursor: pointer;
}

.menu-item:hover {
    transform: translateY(-5px);
}

.item-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.item-details {
    padding: 1rem;
}

.item-name {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.item-price {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.1rem;
}

/* Floating Cart Button */
.floating-cart {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    cursor: pointer;
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    transition: transform 0.2s;
}

.floating-cart:active {
    transform: scale(0.95);
}

.cart-count {
    background: white;
    color: var(--primary-color);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.1);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

/* Item Detail Modal Specifics */
.detail-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
}

.detail-info {
    padding: 1.5rem;
}

.detail-price {
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: bold;
    margin: 1rem 0;
}

.add-to-cart-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    margin-top: 1rem;
}

/* Cart Modal Specifics */
.cart-header {
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-items {
    padding: 1.5rem;
}

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

.cart-item-info h4 {
    margin-bottom: 0.2rem;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qty-btn {
    background: #eee;
    border: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    cursor: pointer;
}

.cart-footer {
    padding: 1.5rem;
    background: #f9f9f9;
    border-top: 1px solid #eee;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

.clear-cart-btn {
    width: 100%;
    padding: 1rem;
    background: #ff4757;
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
}

.empty-cart-msg {
    text-align: center;
    color: #999;
    padding: 2rem;
}
