@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Playfair+Display:wght@700&display=swap');

:root {
    /* Color Palette */
    --primary: #FF69B4;       /* Hot Pink */
    --primary-dark: #C2185B;  /* Darker Pink for gradients */
    --accent-purple: #7045e7; /* Purple for price tags/accents */
    
    /* Layout Variables */
    --radius-xl: 20px;
    --radius-md: 16px;
    --radius-sm: 12px;
    
    /* Shadows */
    --shadow-soft: 0 8px 25px rgba(0,0,0,0.06);
    --shadow-card: 0 8px 20px rgba(0,0,0,0.06);
    --shadow-hover: 0 15px 35px rgba(0,0,0,0.12);
}

/* === RESET & GLOBAL === */
* { 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent; 
}

body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    padding-bottom: 90px; /* Space for fixed bottom nav */
    overflow-x: hidden;
    color: #2D3436;
    
    /* Animated Colorful Background */
    background: linear-gradient(-45deg, #FFF0F5, #E3F2FD, #F3E5F5, #FFF3E0);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* View Transition Utility */
.view { display: none; animation: fadeIn 0.4s ease-out; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

/* === 1. TOP HEADER (Glassmorphism) === */
.top-bar {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 90;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

.user-info h4 { margin: 0; font-size: 1.1rem; font-weight: 700; color: #333; }
.location-pin { display: flex; align-items: center; gap: 4px; font-size: 0.8rem; color: #666; margin-top: 2px; }

/* === 2. SEARCH BAR === */
.search-wrapper { margin: 15px 20px; position: relative; }

.search-box {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 2px solid transparent;
    border-radius: 18px;
    background: white;
    box-shadow: var(--shadow-soft);
    font-family: inherit;
    font-size: 0.95rem;
    transition: 0.3s;
}
.search-box:focus { border-color: var(--primary); outline: none; }

.search-btn {
    position: absolute; right: 6px; top: 6px;
    width: 36px; height: 36px;
    background: var(--primary);
    border: none; border-radius: 12px;
    color: white; font-size: 1.2rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

/* Search Suggestions Dropdown */
.suggestions-list {
    position: absolute; top: 60px; left: 10px; right: 10px;
    background: white; border-radius: 15px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.12);
    list-style: none; padding: 10px; margin: 0; z-index: 200;
    max-height: 250px; overflow-y: auto; display: none;
}
.suggestion-item {
    padding: 10px 15px; border-radius: 10px;
    display: flex; justify-content: space-between; align-items: center;
    cursor: pointer; border-bottom: 1px solid #f5f5f5;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: #F9F9F9; }

/* === 3. BANNERS (Auto Scroll) === */
.banner-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 5px 20px 20px;
    scrollbar-width: none;
    scroll-behavior: smooth;
}
.banner-scroll::-webkit-scrollbar { display: none; }

.promo-card {
    min-width: 260px;
    height: 140px;
    border-radius: 22px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
    color: white;
    box-shadow: var(--shadow-soft);
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.3s;
}
.promo-card:hover { transform: translateY(-3px); }

/* Banner Gradients */
.promo-card.pink { background: linear-gradient(135deg, #FF9A9E, #FECFEF); }
.promo-card.blue { background: linear-gradient(135deg, #a18cd1, #fbc2eb); }
.promo-card.orange { background: linear-gradient(135deg, #f6d365, #fda085); }
.promo-card.purple { background: linear-gradient(135deg, #e0c3fc, #8ec5fc); }
.promo-card.green { background: linear-gradient(135deg, #84fab0, #8fd3f4); }

.promo-card h3 { 
    margin: 0 0 5px; font-size: 1.2rem; 
    font-family: 'Playfair Display', serif; 
    text-shadow: 0 2px 4px rgba(0,0,0,0.1); 
}
.promo-card p { margin: 0; font-size: 0.85rem; opacity: 0.95; }
.promo-card ion-icon { animation: floatIcon 3s ease-in-out infinite; }
@keyframes floatIcon { 0%, 100% { transform: translateY(0) rotate(10deg); } 50% { transform: translateY(-5px) rotate(15deg); } }

/* === 4. CATEGORIES === */
.section-title { 
    padding: 0 20px; 
    margin-bottom: 12px; 
    font-weight: 700; 
    font-size: 1.1rem; 
    color: #444; 
}

.cat-grid {
    display: grid;
    /* This forces exactly 4 items to fit on the screen width */
    grid-template-columns: repeat(4, 1fr); 
    gap: 10px;
    padding: 0 15px 25px; /* Side padding */
    width: 100%;
}

.cat-item { 
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer; 
    transition: 0.2s; 
    width: 100%; /* Fill the grid cell */
}

.cat-item:active { transform: scale(0.95); }

.cat-icon {
    width: 100%; /* Responsive width based on grid */
    aspect-ratio: 1 / 1; /* Keep it square */
    max-width: 65px; /* Maximum size */
    border-radius: 22px; /* Soft square look */
    display: flex; 
    align-items: center; 
    justify-content: center;
    font-size: 1.5rem; /* Icon size */
    margin-bottom: 8px;
    background: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: 0.3s;
}

.cat-item:hover .cat-icon { 
    transform: translateY(-3px) rotate(5deg); 
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.cat-name { 
    font-size: 0.75rem; 
    font-weight: 600; 
    color: #555; 
    white-space: nowrap; /* Prevent text wrapping */
}
/* Specific Adjustment for very small screens (e.g. iPhone SE) */
@media (max-width: 360px) {
    .cat-grid { gap: 5px; padding: 0 10px 20px; }
    .cat-icon { font-size: 1.3rem; border-radius: 18px; }
    .cat-name { font-size: 0.7rem; }
}

/* === 5. PRODUCT GRID (Responsive Logic) === */
.pop-grid {
    display: grid;
    /* Mobile: 2 Columns, tight gap */
    grid-template-columns: repeat(2, 1fr);
    gap: 15px; 
    padding: 0 15px 40px; /* Side padding optimized for mobile */
    width: 100%;
    margin: 0 auto;
}

/* Tablet (Small) -> 3 Columns */
@media (min-width: 600px) {
    .pop-grid { grid-template-columns: repeat(3, 1fr); padding: 0 25px 40px; gap: 20px; }
}
/* Tablet (Large) -> 4 Columns */
@media (min-width: 900px) {
    .pop-grid { grid-template-columns: repeat(4, 1fr); }
}
/* Desktop -> 5 Columns */
@media (min-width: 1200px) {
    .pop-grid { grid-template-columns: repeat(5, 1fr); }
}
/* Large Screens -> 6 Columns */
@media (min-width: 1400px) {
    .pop-grid { grid-template-columns: repeat(6, 1fr); }
}

/* === 6. THE NEW CARD DESIGN ("Travel Card" Style) === */
.product-card {
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden; /* Clips image at corners */
    position: relative;
    box-shadow: var(--shadow-card);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s;
    border: none;
    display: flex;
    flex-direction: column;
    height: 100%; /* Uniform height */
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    z-index: 5;
}

/* Image Area - Full Width */
.card-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 Aspect Ratio Square */
    background: #f4f4f4;
    overflow: hidden;
}

.product-card img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-card:hover img { transform: scale(1.05); }

/* Floating Wishlist Button (Glassmorphism) */
.fav-btn-card {
    position: absolute;
    top: 10px; right: 10px;
    width: 32px; height: 32px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #999;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 5;
    transition: 0.2s;
}
.fav-btn-card.liked { color: var(--primary); background: #FFF0F5; }

/* Card Content Area */
.card-details {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Pushes footer to bottom */
}

.p-cat {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #999;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.p-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #2D3436;
    margin: 0 0 6px;
    line-height: 1.3;
    /* Limit to 2 lines text */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Footer: Price Pill & Add Button */
.card-footer {
    margin-top: auto; /* Pushes to bottom */
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.p-price-tag {
    background: linear-gradient(35deg, #ffbadf, #ff0064);
    color: white;
    padding: 4px 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 4px 10px rgba(194, 24, 91, 0.2);
}

.add-btn-round {
    width: 32px; height: 32px;
    background: #2D3436;
    color: white;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: transform 0.2s, background 0.2s;
}
.add-btn-round:active { transform: scale(0.9); }
.add-btn-round.added { background: #25D366; }


/* === 7. ADDRESS CARD === */
.address-card {
    background: white;
    margin: 30px 20px 50px;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}
.address-card::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 5px;
    background: linear-gradient(90deg, #FF9A9E, #FECFEF);
}

.contact-btn {
    flex: 1; padding: 12px; border-radius: 12px;
    text-align: center; text-decoration: none;
    font-weight: 600; font-size: 0.9rem;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: 0.2s;
}
.call-btn { background: #E3F2FD; color: #1976D2; }
.map-btn { background: #E8F5E9; color: #388E3C; }

/* === 8. BOTTOM NAVIGATION === */
.bottom-nav {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    width: 90%; max-width: 400px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 10px 25px;
    display: flex; justify-content: space-between;
    align-items: center;
    border-radius: 50px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    z-index: 1000;
    border: 1px solid rgba(255,255,255,0.5);
}

.nav-item { font-size: 1.5rem; color: #bbb; transition: 0.3s; position: relative; }
.nav-item.active { color: var(--primary); transform: translateY(-3px); }
.nav-item.active::after {
    content: ''; position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
    width: 4px; height: 4px; background: var(--primary); border-radius: 50%;
}

.cart-badge {
    position: absolute; top: -5px; right: -8px;
    background: var(--primary); color: white;
    font-size: 0.65rem; width: 16px; height: 16px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
}

/* === 9. MODALS & BOTTOM SHEETS === */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: flex-end; /* Align to bottom */
    justify-content: center;
}

.modal-bottom-sheet {
    background: rgba(255, 255, 255, 0.95);
    width: 100%;
    max-width: 600px;
    padding: 25px;
    border-top-left-radius: 30px;
    border-top-right-radius: 30px;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.1);
    animation: slideUp 0.3s ease-out;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.full-cat-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.cat-pill {
    padding: 12px 20px; border-radius: 25px; border: none;
    background: white; box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    font-size: 0.95rem; font-weight: 500; color: #444;
    cursor: pointer; flex-grow: 1; text-align: center; transition: 0.2s;
}
.cat-pill:hover, .cat-pill:active {
    background: var(--primary); color: white; transform: translateY(-2px);
}

/* === 10. PRODUCT DETAIL VIEW === */
.detail-header {
    padding: 20px; display: flex; justify-content: space-between;
    position: absolute; width: 100%; top: 0; z-index: 10;
}
.icon-btn {
    background: white; border: none; width: 40px; height: 40px;
    border-radius: 50%; font-size: 1.2rem; cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1); display: flex; align-items: center; justify-content: center;
}

.hero-img-container {
    width: 100%; height: 45vh; background: #FFF0F5;
    display: flex; align-items: center; justify-content: center;
    padding-top: 20px;
}
.hero-img { width: 80%; height: 80%; object-fit: contain; filter: drop-shadow(0 10px 20px rgba(0,0,0,0.1)); }

.detail-body {
    background: white; border-top-left-radius: 35px; border-top-right-radius: 35px;
    padding: 30px 25px 100px; min-height: 60vh; position: relative; top: -30px;
}
.qty-selector {
    background: #F5F5F5; border-radius: 15px; padding: 5px 15px;
    display: flex; align-items: center; gap: 15px;
}
.qty-btn { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: #555; }

.includes-scroll {
    display: flex; gap: 10px; overflow-x: auto; margin: 15px 0 30px;
    scrollbar-width: none;
}
.inc-item {
    background: #F9F9F9; padding: 10px 15px; border-radius: 12px;
    display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: #555;
    white-space: nowrap; border: 1px solid #eee;
}

.floating-action {
    position: fixed; bottom: 0; left: 0; width: 100%;
    background: white; padding: 15px 25px;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.05); z-index: 100;
}
.btn-primary {
    background: var(--primary); color: white; width: 100%; padding: 16px;
    border: none; border-radius: 16px; font-size: 1rem; font-weight: 600;
    cursor: pointer; box-shadow: 0 10px 25px rgba(255, 105, 180, 0.4);
    display: flex; align-items: center; justify-content: center; transition: 0.2s;
}
.btn-primary:active { transform: scale(0.95); }

/* === 11. CART VIEW === */
.cart-list { padding: 20px; padding-bottom: 150px; }
.cart-item {
    background: white; padding: 10px; margin-bottom: 15px;
    border-radius: 15px; display: flex; align-items: center; gap: 15px;
    box-shadow: var(--shadow-soft);
}
.bill-section {
    background: white; margin: 20px; padding: 20px;
    border-radius: 20px; box-shadow: var(--shadow-soft);
}
.bill-row { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.9rem; color: #555; }
.bill-total { font-weight: 700; font-size: 1.1rem; color: var(--primary); border-top: 1px dashed #ddd; padding-top: 10px; margin-top: 10px; }

/* Loading Skeleton */
.loading-skeleton {
    width: 100%; padding: 50px; text-align: center; color: #999;
    grid-column: 1 / -1; font-style: italic;
}

/* --- NEW: Quantity Control Styles --- */

/* 1. Grid View Qty Control (Floating Pill) */
.qty-control-pill {
    position: absolute; bottom: 10px; right: 10px;
    background: #2D3436; /* Dark Charcoal */
    border-radius: 30px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 2px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    min-width: 85px;
    height: 34px;
    z-index: 15; /* Above card click area */
    animation: popIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.qty-btn-sm {
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 1.2rem; cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
}
.qty-btn-sm:active { background: rgba(255,255,255,0.2); }

.qty-val-sm {
    color: white; font-weight: 600; font-size: 0.95rem;
    min-width: 20px; text-align: center;
}

/* 2. Cart View Qty Control (Gray Box) */
.cart-qty-box {
    display: flex; align-items: center; gap: 5px;
    background: #F5F5F5;
    border-radius: 12px;
    padding: 4px;
    border: 1px solid #EEE;
}
.cart-qty-btn {
    width: 28px; height: 28px;
    background: white;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 1.1rem; color: #555;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.cart-qty-val {
    font-weight: 600; font-size: 0.9rem; color: #333;
    min-width: 20px; text-align: center;
}