@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');

/* --- Base Mobile Styles (Default) --- */
body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    background-color: #FFF8F0; /* Warm off-white */
    color: #4A2E2C; /* Deep brown */
}

header {
    background: linear-gradient(to right, #FF8C00, #D2691E); /* Orange gradient */
    color: white;
    text-align: center;
    padding: 1.5rem 1rem;
    border-bottom: 5px solid #8B4513; /* SaddleBrown */
}

header .logo {
    font-size: 2rem;
    font-weight: 700;
    border: 2px solid white;
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

header h1 {
    font-size: 1.8rem;
    margin: 0.5rem 0 0.2rem 0;
}

main {
    padding: 1rem;
}

#loading {
    text-align: center;
    padding: 3rem 1rem;
    font-size: 1.1em;
}

footer {
    text-align: center;
    padding: 1rem;
    margin-top: 1.5rem;
    background-color: #4A2E2C;
    color: #FFF8F0;
}

/* --- Tablet & Desktop Styles --- */
/* This code only applies if the screen width is 768px or more */
@media (min-width: 768px) {
    main {
        max-width: 1200px;
        margin: 2rem auto; /* Center the main content on larger screens */
    }

    header {
        padding: 2rem 1rem;
    }

    header h1 {
        font-size: 2.5rem;
    }
}

/* --- Menu Display Styles (Append to style.css) --- */

.category-title {
    font-size: 1.6rem;
    color: #8B4513; /* SaddleBrown */
    border-bottom: 3px solid #FF8C00;
    padding-bottom: 0.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.menu-item-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    margin-bottom: 1.2rem;
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    gap: 1rem;
}

.item-details {
    flex-grow: 1;
}

.item-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
    color: #D2691E;
}

.item-name span {
    color: #2E8B57; /* SeaGreen for Veg icon */
    font-size: 0.9rem;
    font-weight: normal;
}

.item-description {
    font-size: 0.9rem;
    color: #666;
    margin: 0 0 0.75rem 0;
}

.item-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.item-action {
    flex-shrink: 0;
    width: 100px;
    text-align: center;
}

.item-action img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.add-to-order-btn {
    width: 100%;
    background-color: #4caf50; /* Green */
    color: white;
    border: none;
    border-radius: 5px;
    padding: 0.6rem 0;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
}

.quantity-selector-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
}

.quantity-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: white;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
}

.add-to-order-btn.with-quantity {
    border-radius: 4px;
}

/* --- Tablet & Desktop Styles --- */
@media (min-width: 768px) {
    .menu-item-card {
        padding: 1.5rem;
    }
}

/* --- Shopping Cart Styles (Append to style.css) --- */

.hidden {
    display: none !important;
}

/* Floating Cart Bar */
#cart-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #D2691E; /* A strong brand color */
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    padding-bottom: calc(0.8rem + env(safe-area-inset-bottom)); /* Add safe area padding */
    box-sizing: border-box; /* Include padding in width calculation */
    box-shadow: 0 -4px 10px rgba(0,0,0,0.15);
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
}

#cart-bar.visible {
    transform: translateY(0);
}

.cart-info {
    font-weight: 600;
}

#cart-total-price {
    margin-left: 1rem;
    font-size: 1.1rem;
}

#view-cart-btn {
    background-color: #4caf50; /* Green */
    color: white;
    border: none;
    padding: 0.7rem 1.2rem;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
}


/* Cart Modal */
#cart-modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: flex-end; /* Align modal to bottom */
}

#cart-modal.hidden {
    display: none;
}

.modal-content {
    background-color: #fefefe;
    width: 100%;
    max-width: 500px;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 -5px 15px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    max-height: 85vh; /* Limit height */
    animation: slide-up 0.4s ease-out;
}

@keyframes slide-up {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

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

.modal-header h2 {
    margin: 0;
    color: #4A2E2C;
}

.close-btn {
    font-size: 2rem;
    color: #aaa;
    cursor: pointer;
    font-weight: bold;
}

#cart-items-container {
    padding: 0.5rem 1.5rem;
    overflow-y: auto; /* Make cart items scrollable */
    flex-grow: 1;
}

.cart-item {
    display: flex;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.cart-item-details {
    flex-grow: 1;
}

.cart-item-name {
    font-weight: 600;
    margin: 0 0 0.25rem 0;
}

.cart-item-price {
    color: #666;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.quantity-btn {
    background-color: #eee;
    border: none;
    font-weight: bold;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 1.2rem;
}

.cart-item-quantity {
    font-weight: 600;
    font-size: 1.1rem;
}

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

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

#proceed-to-order-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: bold;
    background-color: #d32f2f;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

/* --- Checkout & Success Modal Styles (Append to style.css) --- */

#checkout-form {
    padding: 0.5rem 1.5rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-label {
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: #4A2E2C;
}

.order-type-group {
    display: flex;
    gap: 2rem;
}

#checkout-form input[type="text"],
#checkout-form input[type="number"],
#checkout-form input[type="email"],
#checkout-form input[type="tel"],
#checkout-form textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box; /* Important for padding */
    margin-bottom: 0.5rem;
    font-family: 'Poppins', sans-serif;
    transition: border-color 0.2s;
}

#checkout-form input.error,
#checkout-form textarea.error {
    border-color: #d32f2f;
    border-width: 2px;
}

#checkout-form input[type="color"] {
    width: 100%;
    height: 40px;
    padding: 0.2rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.proceed-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: bold;
    background-color: #d32f2f;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.proceed-btn:hover {
    background-color: #b71c1c;
}

.proceed-btn:active {
    transform: scale(0.98);
}

.proceed-btn:disabled {
    background-color: #9e9e9e;
    cursor: not-allowed;
}

#checkout-modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

#checkout-modal .modal-content {
    background-color: #fefefe;
    width: 90%;
    max-width: 500px;
    border-radius: 16px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    max-height: 90vh;
    overflow-y: auto;
}

#success-modal .modal-content {
    text-align: center;
    padding: 2rem 1.5rem;
}

#success-modal h2 {
    color: #4caf50;
    margin-top: 0;
}

/* Kitchen Closed Modal */
#kitchen-closed-modal {
    position: fixed;
    z-index: 2000; /* Higher than other modals */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
}

#kitchen-closed-modal .modal-content {
    text-align: center;
    padding: 2rem 1.5rem; /* Adjusted padding */
    background-color: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    max-width: 400px;
    width: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.kitchen-status-icon {
    font-size: 3.5rem;
    line-height: 1;
    margin-bottom: 1rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

.kitchen-status-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 0.75rem 0;
}

.kitchen-status-content p {
    font-size: 1rem;
    line-height: 1.5;
    color: #666;
    margin: 0.25rem 0;
}

.error-message {
    color: #d32f2f;
    font-size: 0.9rem;
    margin-top: 1rem;
    text-align: center;
    display: none;
}

/* --- Checkout & Success Modal Styles (Append to style.css) --- */

#checkout-form {
    padding: 0.5rem 1.5rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-label {
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: #4A2E2C;
}

.order-type-group {
    display: flex;
    gap: 2rem;
}

#checkout-form input[type="text"],
#checkout-form input[type="number"] {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box; /* Important for padding */
    margin-bottom: 0.5rem;
}

.proceed-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: bold;
    background-color: #d32f2f;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

#success-modal .modal-content {
    text-align: center;
    padding: 2rem 1.5rem;
}

#success-modal h2 {
    color: #4caf50;
    margin-top: 0;
}
