@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&family=Playfair+Display:wght@700&display=swap');

:root {
    --primary: #054a29;
    --primary-light: #0d653b;
    --accent: #d4af37;
    --background: #f8f9fa;
    --surface: #ffffff;
    --text-main: #1a1a1a;
    --text-muted: #666666;
    --text-light: #999999;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.08);
    --shadow-lg: 0 16px 40px rgba(0,0,0,0.12);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

body {
    font-family: 'DM Sans', sans-serif;
    background-color: var(--background);
    margin: 0;
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    padding-bottom: 90px;
}

h1, h2, h3, h4 {
    font-family: 'Playfair Display', serif;
    color: var(--text-main);
    margin: 0;
}

button {
    font-family: 'DM Sans', sans-serif;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

/* Loader */
.loader-bar {
    position: fixed; top: 0; left: 0; width: 0; height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    z-index: 10000; transition: width 0.3s ease;
}

/* Header */
.glass-header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: sticky; top: 0; z-index: 1000;
    box-shadow: 0 1px 0 rgba(0,0,0,0.05);
    padding: 0.8rem 1.2rem;
}

.header-content {
    display: flex; justify-content: space-between; align-items: center;
}

.logo-area { text-align: center; }
.logo {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
}
.tagline {
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-top: -2px;
}

/* Header Icons */
.header-icons {
    display: flex;
    align-items: center;
    gap: 4px; /* Space between Download and Cart icons */
}

.icon-btn {
    background: none; border: none; font-size: 1.4rem;
    color: var(--text-main); position: relative; cursor: pointer;
    transition: color 0.2s ease;
    padding: 5px;
}

.icon-btn:hover {
    color: var(--primary);
}

#cart-count {
    position: absolute; top: -5px; right: -8px;
    background: var(--primary); color: white;
    font-size: 0.7rem; font-weight: 700;
    padding: 2px 6px; border-radius: 10px;
    border: 2px solid white;
}

/* Location Sub-Bar */
.location-sub-bar {
    background: var(--primary);
    color: white;
    padding: 10px 16px;
    display: none;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    box-shadow: var(--shadow-sm);
    animation: slideDown 0.3s ease-out;
}
@keyframes slideDown { from { transform: translateY(-10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.location-sub-bar.active { display: flex; }

.location-text-wrapper {
    display: flex; align-items: center; gap: 8px;
    flex: 1;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-right: 10px;
}
.location-text-wrapper i { color: var(--accent); font-size: 1rem; }
.location-text-wrapper span {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: block; width: 100%;
}

.change-icon-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0;
    transition: 0.2s;
}
.change-icon-btn:hover { background: rgba(255,255,255,0.3); }
.change-icon-btn i { font-size: 0.9rem; }

/* Drawers */
.drawer-overlay, .cart-drawer-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.3);
    backdrop-filter: blur(4px); z-index: 1999;
    opacity: 0; pointer-events: none; transition: var(--transition);
}
.drawer-overlay.open, .cart-drawer-overlay.open { opacity: 1; pointer-events: auto; }

.drawer {
    position: fixed; top: 0; left: 0; width: 280px; height: 100%;
    background: var(--surface); z-index: 2000;
    transform: translateX(-100%); transition: var(--transition);
    box-shadow: var(--shadow-lg); padding-top: 2rem;
}
.drawer.open { transform: translateX(0); }

.drawer-header { padding: 0 2rem 2rem; }
.drawer ul { list-style: none; padding: 0; }
.drawer li {
    padding: 1rem 2rem; font-size: 1.1rem; color: var(--text-main);
    cursor: pointer; display: flex; align-items: center; gap: 1rem;
    border-left: 4px solid transparent; transition: 0.2s;
}
.drawer li i { width: 24px; text-align: center; color: var(--text-light); }
.drawer li.active { background: #f0f7f4; border-color: var(--primary); font-weight: 500; }
.drawer li.active i { color: var(--primary); }

/* Specific style for offers icon in drawer */
.drawer li[data-view="offers"] i { color: #ff6b6b; }

.cart-drawer {
    position: fixed; top: 0; right: 0; width: 90%; max-width: 400px;
    height: 100%; background: var(--surface); z-index: 2000;
    transform: translateX(100%); transition: var(--transition);
    display: flex; flex-direction: column;
}
.cart-drawer.open { transform: translateX(0); }

.cart-header {
    padding: 1.5rem; display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #eee;
}
.cart-items { flex: 1; overflow-y: auto; padding: 1.5rem; }

.cart-item {
    display: flex; gap: 1rem; margin-bottom: 1.5rem;
    background: #fff; padding: 0.5rem;
}
.cart-item img {
    width: 70px; height: 70px; border-radius: var(--radius-sm);
    object-fit: cover; background: #f4f4f4;
}
.cart-item-info { flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.cart-item-info h4 { font-size: 0.95rem; font-weight: 600; font-family: 'DM Sans', sans-serif; }
.cart-item-controls { display: flex; align-items: center; justify-content: space-between; margin-top: 0.5rem; }
.qty-badge {
    background: #f0f0f0; padding: 4px 12px; border-radius: 20px;
    font-size: 0.85rem; font-weight: 600; display: flex; align-items: center; gap: 10px;
}
.qty-btn-mini { border: none; background: none; color: var(--text-main); font-weight: bold; cursor: pointer; }
.remove-icon { color: #ff6b6b; cursor: pointer; font-size: 0.9rem; }

.cart-summary { padding: 2rem; background: white; border-top: 1px solid #eee; }
.subtotal { display: flex; justify-content: space-between; font-size: 1.2rem; font-weight: 700; margin-bottom: 1rem; }
.checkout-btn {
    width: 100%; padding: 1rem; background: var(--primary); color: white;
    border: none; border-radius: var(--radius-lg); font-size: 1rem; font-weight: 500;
    display: flex; justify-content: space-between; align-items: center; cursor: pointer;
    box-shadow: 0 4px 12px rgba(5, 74, 41, 0.3);
}

/* Layout */
main { padding: 1rem; max-width: 1000px; margin: 0 auto; }
.view-section { display: none; animation: fadeIn 0.4s ease-out; }
.view-section.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.section-header {
    display: flex; justify-content: space-between; align-items: flex-end;
    margin: 2rem 0 1rem; padding: 0 0.5rem;
}
.section-header h2 { font-size: 1.5rem; }
.see-all { font-size: 0.85rem; color: var(--primary); font-weight: 600; cursor: pointer; }

/* Hero */
.hero-banner {
    height: 220px; border-radius: var(--radius-md); overflow: hidden;
    position: relative; box-shadow: var(--shadow-md); margin-bottom: 1rem;
}
.banner-slider { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; height: 100%; scrollbar-width: none; }
.banner-slider::-webkit-scrollbar { display: none; }
.banner-slide {
    flex: 0 0 100%; scroll-snap-align: start;
    background-size: cover; background-position: center;
}
.hero-overlay {
    position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.4), transparent); pointer-events: none;
}
.banner-dots {
    position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 6px; z-index: 2;
}
.banner-dot {
    width: 6px; height: 6px; background: rgba(255,255,255,0.5); border-radius: 50%; transition: 0.3s;
}
.banner-dot.active { width: 20px; background: white; border-radius: 10px; }

/* Categories */
.category-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 1rem; justify-items: center;
}
.category-card {
    display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer;
}
.cat-icon-box {
    width: 60px; height: 60px; background: white; border-radius: 20px;
    display: flex; justify-content: center; align-items: center;
    box-shadow: var(--shadow-sm); font-size: 1.5rem; color: var(--primary);
    transition: var(--transition);
}
.category-card:hover .cat-icon-box { transform: translateY(-5px); background: var(--primary); color: white; }
.category-card h4 { font-size: 0.75rem; font-family: 'DM Sans', sans-serif; color: var(--text-main); }

/* Products */
.products-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem;
}
@media(min-width: 600px) { .products-grid { grid-template-columns: repeat(3, 1fr); } }

.product-card {
    background: var(--surface); border-radius: var(--radius-md);
    overflow: hidden; box-shadow: var(--shadow-sm); transition: var(--transition);
    position: relative; display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

.product-img-wrap {
    position: relative; padding-top: 100%;
    background: #f4f4f4;
}
.product-card-image {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover;
}

.product-info { padding: 1rem; flex: 1; display: flex; flex-direction: column; }
.product-info h4 {
    font-size: 0.95rem; font-weight: 500; font-family: 'DM Sans', sans-serif;
    margin-bottom: 4px; line-height: 1.3;
}
.product-info p { font-size: 0.8rem; color: var(--text-muted); margin: 0 0 8px; }

.price-row {
    margin-top: auto; display: flex; justify-content: space-between; align-items: center;
}
.price { font-weight: 700; color: var(--text-main); font-size: 1.1rem; }

.add-btn-fab {
    width: 32px; height: 32px; border-radius: 50%; background: var(--surface);
    border: 1px solid #eee; display: flex; align-items: center; justify-content: center;
    color: var(--primary); cursor: pointer; transition: 0.2s; box-shadow: var(--shadow-sm);
}
.add-btn-fab:active { transform: scale(0.9); background: var(--primary); color: white; }

.qty-control-sm {
    display: flex; align-items: center; background: var(--primary);
    border-radius: 20px; padding: 2px; color: white;
}
.qty-control-sm button {
    width: 28px; height: 28px; background: none; border: none; color: white;
    font-size: 0.8rem; cursor: pointer;
}
.qty-control-sm span { font-size: 0.9rem; padding: 0 6px; font-weight: 600; }

/* Search */
.search-container-sticky {
    position: sticky; top: 70px; z-index: 900; background: var(--background);
    padding: 10px 0; margin: 0 -1rem; padding-left: 1rem; padding-right: 1rem;
}
.search-input-group {
    background: white; border-radius: var(--radius-lg);
    padding: 0.8rem 1.2rem; display: flex; align-items: center; gap: 10px;
    box-shadow: var(--shadow-sm);
}
.search-input-group input { border: none; outline: none; flex: 1; font-size: 1rem; }
.search-input-group i { color: var(--text-light); }
.empty-state { grid-column: 1/-1; text-align: center; color: var(--text-light); padding: 3rem; }

/* Checkout */
.cart-view-container { max-width: 600px; margin: 0 auto; }
.cart-view-item {
    display: flex; gap: 1rem; background: white; padding: 1rem;
    border-radius: var(--radius-md); margin-bottom: 1rem; box-shadow: var(--shadow-sm);
}
.cart-summary-details { background: white; padding: 1.5rem; border-radius: var(--radius-md); margin-bottom: 2rem; }
.summary-row { display: flex; justify-content: space-between; margin-bottom: 0.8rem; color: var(--text-muted); }
.summary-row.total { color: var(--text-main); font-weight: 700; font-size: 1.2rem; }
.summary-divider { height: 1px; background: #eee; margin: 1rem 0; }

.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--text-muted); }
.form-group input, .form-group textarea {
    width: 100%; padding: 0.9rem; border: 1px solid #e0e0e0;
    border-radius: var(--radius-sm); font-size: 1rem; box-sizing: border-box;
    transition: 0.3s; font-family: 'DM Sans', sans-serif;
}
.form-group input:focus { border-color: var(--primary); background: white; }

.input-with-btn { display: flex; gap: 10px; }
.detect-btn {
    background: #eee; border: none; padding: 0 1.2rem; border-radius: var(--radius-sm);
    color: var(--text-main); cursor: pointer;
}

.primary-btn-block, .checkout-btn.block {
    width: 100%; padding: 1rem; background: var(--primary); color: white;
    border: none; border-radius: var(--radius-sm); font-weight: 600; font-size: 1rem;
    cursor: pointer; box-shadow: 0 4px 10px rgba(5,74,41,0.25);
}

/* Orders */
.orders-list { display: flex; flex-direction: column; gap: 1.2rem; }
.order-card {
    background: white; padding: 1.5rem; border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm); border: 1px solid #f0f0f0;
}
.order-header { display: flex; justify-content: space-between; margin-bottom: 1rem; }
.order-status {
    padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.5px;
}
.status-pending { background: #fff3e0; color: #f57c00; }
.status-shipping { background: #e8f5e9; color: #2e7d32; }
.order-items { border-top: 1px dashed #eee; border-bottom: 1px dashed #eee; padding: 1rem 0; margin: 1rem 0; }
.order-item-detail { display: flex; justify-content: space-between; font-size: 0.9rem; margin-bottom: 0.4rem; color: var(--text-muted); }

/* QR Code */
.order-qr {
    text-align: center; margin-top: 1rem; padding-top: 1rem;
    border-top: 1px dashed #eee; animation: fadeIn 0.5s ease;
}
.order-qr img {
    width: 120px; height: 120px; margin-bottom: 0.5rem;
    padding: 10px; background: white; border: 1px solid #eee; border-radius: 8px;
}
.order-qr p { font-size: 0.8rem; color: var(--text-muted); margin: 0; font-weight: 500; }

/* Profile */
.profile-header-card {
    text-align: center; background: white; padding: 2rem;
    border-radius: var(--radius-md); margin-bottom: 2rem; box-shadow: var(--shadow-sm);
}
.profile-avatar {
    width: 80px; height: 80px; background: #e0f2f1; border-radius: 50%;
    margin: 0 auto 1rem; display: flex; justify-content: center; align-items: center;
    font-size: 2rem; color: var(--primary);
}
.profile-actions { display: grid; gap: 1rem; margin-top: 2rem; }
.action-btn {
    padding: 1rem; background: white; border: 1px solid #eee;
    border-radius: var(--radius-sm); font-weight: 500; cursor: pointer;
}
.action-btn.danger { color: #d32f2f; border-color: #ffebee; background: #fffafa; }

/* Footer */
.footer-bar {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    width: 90%; max-width: 400px; height: 65px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 35px;
    display: flex; justify-content: space-evenly; align-items: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    z-index: 1500; border: 1px solid rgba(255,255,255,0.5);
}

.footer-btn {
    background: none; border: none; color: #aaa;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 50px; cursor: pointer; position: relative;
}
.footer-btn i { font-size: 1.2rem; transition: 0.3s; }
.footer-btn span { font-size: 0.6rem; margin-top: 4px; font-weight: 600; opacity: 0; transition: 0.3s; transform: translateY(10px); }

.footer-btn.active { color: var(--primary); }
.footer-btn.active i { transform: translateY(-4px); }
.footer-btn.active span { opacity: 1; transform: translateY(0); }

/* Login Modal (Premium Re-Design) */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px); z-index: 3000;
    display: flex; justify-content: center; align-items: center;
    opacity: 0; pointer-events: none; transition: 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.login-modal-style {
    background: white; width: 90%; max-width: 380px;
    border-radius: var(--radius-lg); overflow: hidden;
    position: relative; transform: scale(0.95); 
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding: 0;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}
.modal-overlay.open .login-modal-style { transform: scale(1); }

.close-btn-clean {
    position: absolute; top: 1rem; right: 1rem; background: #f0f0f0; color: #555;
    border: none; width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center; z-index: 2;
}

.login-body { padding: 2.5rem 2rem; }

.login-welcome { text-align: left; margin-bottom: 2rem; }
.login-welcome h2 { font-size: 1.8rem; color: var(--primary); margin-bottom: 0.5rem; }
.login-welcome p { color: var(--text-muted); font-size: 0.95rem; margin: 0; }

.input-wrapper { margin-bottom: 1.5rem; }
.input-label { 
    display: block; font-size: 0.75rem; font-weight: 700; color: var(--text-muted); 
    text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.8rem;
}

.modern-input-group {
    background: #f8f9fa; border: 1px solid #e0e0e0; border-radius: 12px;
    display: flex; align-items: center; transition: 0.3s;
    overflow: hidden; height: 50px;
}
.modern-input-group:focus-within { 
    background: white; border-color: var(--primary); 
    box-shadow: 0 4px 12px rgba(5,74,41,0.1); 
}

.country-code { 
    padding: 0 1rem; background: #eaeaea; 
    height: 100%; display: flex; align-items: center; justify-content: center;
    gap: 6px; font-weight: 600; color: #333;
    border-right: 1px solid #ddd;
}
.country-code img { width: 22px; height: auto; display: block; }
.modern-input-group input { 
    flex: 1; border: none; background: transparent; padding: 0 1rem; 
    font-size: 1.1rem; outline: none; height: 100%; color: var(--text-main); font-weight: 500;
}

.otp-instruction { color: var(--text-muted); font-size: 0.9rem; margin: -0.5rem 0 1.5rem; }

.otp-input-container input {
    width: 100%; text-align: center; letter-spacing: 8px; font-size: 1.5rem;
    padding: 12px; border: 1px solid #ddd; border-radius: 12px; 
    background: #f8f9fa; outline: none; transition: 0.3s;
    font-family: 'DM Sans', sans-serif; font-weight: 700;
}
.otp-input-container input:focus {
    border-color: var(--primary); background: white;
    box-shadow: 0 4px 15px rgba(5,74,41,0.15);
}

.recaptcha-wrapper { margin-bottom: 1.5rem; display: flex; justify-content: center; }

.text-link-btn {
    display: block; width: 100%; text-align: center; margin-top: 1rem;
    background: none; border: none; color: var(--text-muted); 
    text-decoration: underline; cursor: pointer; font-size: 0.9rem;
}

#order-success-overlay {
    position: fixed; inset: 0; background: white; z-index: 5000;
    display: flex; justify-content: center; align-items: center;
    opacity: 0; pointer-events: none; transition: 0.5s;
}
#order-success-overlay.active { opacity: 1; pointer-events: auto; }
.success-content { text-align: center; transform: scale(0.8); transition: 0.5s; }
#order-success-overlay.active .success-content { transform: scale(1); }
.success-icon {
    width: 80px; height: 80px; background: #e8f5e9; color: var(--primary);
    border-radius: 50%; display: flex; justify-content: center; align-items: center;
    font-size: 2.5rem; margin: 0 auto 1.5rem; animation: pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }

/* Map */
#map-container { width: 100%; height: 300px; background: #eee; border-radius: var(--radius-md); margin-bottom: 1rem; }
.map-controls { display: flex; gap: 1rem; }
.secondary-btn { background: white; border: 1px solid #ddd; color: var(--text-main); flex: 1; padding: 1rem; border-radius: var(--radius-sm); cursor: pointer; }

/* Toast */
.toast-container { position: fixed; top: 1rem; left: 50%; transform: translateX(-50%); z-index: 6000; }
.toast {
    background: #323232; color: white; padding: 12px 24px; border-radius: 30px;
    font-size: 0.9rem; box-shadow: 0 5px 15px rgba(0,0,0,0.2); opacity: 0;
    transform: translateY(-20px); transition: 0.3s;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* --- Animation Styles --- */

/* Cart Fly Animation */
@keyframes cartBump {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

.cart-bump-anim {
    animation: cartBump 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: var(--primary) !important;
}

.flying-img {
    position: fixed;
    z-index: 9999;
    border-radius: 50%;
    object-fit: cover;
    pointer-events: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    transition: all 0.8s cubic-bezier(0.19, 1, 0.22, 1);
}

/* Order Loader Animation (Truck & Box) */
.order-loader-wrapper {
    position: relative;
    height: 30px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.truck-anim-icon {
    font-size: 1.4rem;
    color: white;
    position: absolute;
    bottom: 2px;
    left: -50px;
    animation: truckDrive 2.5s infinite ease-in-out;
    z-index: 2;
}
.box-anim-icon {
    font-size: 0.8rem;
    color: #ffcc00;
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    animation: boxLoad 2.5s infinite ease-in-out;
}
@keyframes truckDrive {
    0% { left: -50px; }
    40% { left: calc(50% - 15px); } /* Arrive and Stop */
    60% { left: calc(50% - 15px); } /* Wait for packing */
    100% { left: 120%; } /* Drive away */
}
@keyframes boxLoad {
    0% { top: -25px; opacity: 1; }
    40% { top: -25px; opacity: 1; } /* Wait for truck */
    50% { top: 4px; opacity: 1; } /* Drop into truck */
    55% { opacity: 0; } /* Disappear inside */
    100% { opacity: 0; top: 4px; }
}