/* style.css - The Elegant CYW Theme */

/* Import Fonts */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=Roboto:wght@400;500&display=swap');


:root {
    --primary: #c43838;    /* Your Brand Red */
    --bg-cream: #fbf9f6;   /* Luxury Off-White */
    --text-dark: #333333;
    --gold: #c5a059;       /* Premium Gold */
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Roboto', sans-serif;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    background-color: var(--bg-cream);
    color: var(--text-dark);
    padding-bottom: 80px; /* Space for bottom nav */
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

/* --- 1. Top Announcement Bar --- */
.announcement-bar {
    background-color: var(--primary);
    color: white;
    text-align: center;
    padding: 12px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* --- 2. Elegant Navigation --- */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 5%;
    background-color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    position: relative;
   
}

.logo img {
    height: 70px; 
    width: auto;
}

.nav-icons {
    position: relative;
    cursor: pointer;
}

.nav-icons i {
    font-size: 24px;
    color: var(--primary);
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -10px;
    background-color: var(--gold);
    color: white;
    border-radius: 50%;
    padding: 4px 7px;
    font-size: 11px;
    font-weight: bold;
}

/* --- 3. Hero Banner --- */
.hero-container {
    width: 100%;
    height: auto; 
    overflow: hidden;
    background-color: #eee;
}

.hero-img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
}

/* --- 4. Diagonal Pattern Divider --- */
.pattern-divider {
    height: 24px;
    width: 100%;
    background: repeating-linear-gradient(
        45deg,
        #ffffff,
        #ffffff 8px,
        #f2f2f2 8px,
        #f2f2f2 16px
    );
    border-bottom: 1px solid #eee;
}

/* --- 5. Best Sellers Section --- */
.best-sellers {
    text-align: center;
    padding: 60px 20px;
}

.subtitle {
    font-size: 12px;
    letter-spacing: 3px;
    color: #888;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 10px;
    font-weight: 500;
}

.subtitle::before, .subtitle::after {
    content: "";
    display: block;
    width: 40px;
    height: 1px;
    background-color: var(--gold);
}

h1.main-title {
    font-family: var(--font-heading);
    color: var(--primary);
    font-size: 3rem;
    margin: 0 0 10px 0;
}

.cookie-icon {
    font-size: 28px;
    margin-bottom: 40px;
    color: var(--gold);
}

/* --- 6. Pill Filter Buttons --- */
.filters {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 40px;
}

.btn-pill {
    padding: 12px 30px;
    border-radius: 50px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-heading);
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-pill.active, .btn-pill:hover {
    background-color: var(--primary);
    color: white;
}

/* --- 7. Product Grid & Cards (HOME PAGE) --- */
.product-grid {
    display: grid;
    /* This change ensures items don't stretch too wide on search */
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 10px;
}

.product-card {
    background-color: white;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #f0f0f0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    /* Force card to stay normal size even if only 1 search result */
    max-width: 350px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.08);
}

.card-image {
    position: relative;
    width: 100%;
    padding-top: 100%; /* Square Aspect Ratio */
    padding-bottom: 15%; /* Square Aspect Ratio */
    background-color: #f9f9f9;
}

.card-image img {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; 
}

.card-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background-color: var(--primary);
    color: white;
    padding: 6px 12px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 4px;
}

.card-details {
    padding: 20px;
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-details h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    margin: 0 0 10px 0;
    color: var(--text-dark);
}

.price {
    color: var(--gold);
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 15px;
}

/* This is the small button on the Home Page Grid */
.add-btn {
    margin-top: auto;
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: bold;
    color: #555;
    transition: all 0.3s;
    border-radius: 4px;
}

.product-card:hover .add-btn {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* --- 8. Bottom Nav (Mobile) --- */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; width: 100%;
    background: white;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    z-index: 90;
}
.nav-item { display: flex; flex-direction: column; align-items: center; font-size: 0.7rem; color: #999; }
.nav-item.active { color: var(--primary); }
.nav-item i { font-size: 1.2rem; margin-bottom: 4px; }

/* --- 9. Utilities & Toast --- */
#toast { visibility: hidden; min-width: 250px; background-color: #333; color: #fff; text-align: center; border-radius: 4px; padding: 16px; position: fixed; z-index: 2000; left: 50%; bottom: 80px; transform: translateX(-50%); font-size: 15px; }
#toast.show { visibility: visible; animation: fadein 0.5s, fadeout 0.5s 2.5s; }

/* Keep these for Cart Page compatibility */
.smart-modal { display: none; } 
.cart-item { display: flex; align-items: center; margin-bottom: 15px; background: white; padding: 10px; border-radius: 10px; border: 1px solid #eee; }
.cart-thumb { width: 60px; height: 60px; object-fit: cover; border-radius: 5px; margin-right: 15px; }
.qty-ctrl { display: flex; align-items: center; gap: 10px; }
.qty-btn { width: 25px; height: 25px; background: #eee; border: none; border-radius: 50%; font-weight: bold; cursor:pointer;}
.pkg-box { background: #fff8e1; border: 1px solid #ffe082; padding: 15px; margin: 15px 0; border-radius: 10px; display: flex; justify-content: space-between; align-items: center; }

@keyframes fadein { from {bottom: 0; opacity: 0;} to {bottom: 80px; opacity: 1;} }
@keyframes fadeout { from {bottom: 80px; opacity: 1;} to {bottom: 0; opacity: 0;} }

/* --- 10. Mobile Responsiveness --- */
@media (max-width: 600px) {
    .logo img { height: 50px; }
    h1.main-title { font-size: 1.8rem; }
    /* Fix for 2 columns on mobile */
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 15px; } 
    .card-details { padding: 10px; }
    .card-details h3 { font-size: 14px; }
    .price { font-size: 14px; }
}

/* =======================================================
   11. NEW PRODUCT DETAILS PAGE (RESPONSIVE SPLIT LAYOUT)
   ======================================================= */

/* Center container on desktop */
.app-container {
    max-width: 1100px; /* Increased for desktop split */
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    box-shadow: 0 0 30px rgba(0,0,0,0.05);
    position: relative;
    padding-bottom: 80px;
}

/* Top Bar (Product Page specific) */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 5%;
    background: white;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid #f9f9f9;
}

/* --- THE FLEX WRAPPER --- */
.product-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    /* Default: Mobile Column Layout */
    display: flex;
    flex-direction: column; 
}

/* --- DEFAULT MOBILE STYLES --- */
.image-stage {
    width: 100%;
    background: var(--bg-cream);
    text-align: center;
    padding: 0;
}

.main-img {
    width: 100%;
    aspect-ratio: 4 / 5;  /* <--- This makes it a TALL RECTANGLE. */
    object-fit: cover;
    /* No border radius on mobile for cleaner edge */
}

/* Info Box overlapping the image (Mobile Style) */
.info-box {
    padding: 30px 25px;
    background: white;
    border-radius: 30px 30px 0 0;
    margin-top: -30px;
    position: relative;
    z-index: 10;
    box-shadow: 0 -5px 15px rgba(0,0,0,0.02);
    min-height: 400px;
}

/* --- DESKTOP STYLES (Split Screen) --- */
@media (min-width: 768px) {
    .product-wrapper {
        flex-direction: row; /* Side by Side */
        gap: 50px;
        padding: 40px;
        align-items: flex-start;
    }

    .image-stage {
        width: 50%; /* Half Width */
        background: transparent;
        padding: 0;
        position: sticky;
        top: 90px;
    }

    .main-img {
        border-radius: 20px; /* Rounded on Desktop */
        box-shadow: 0 10px 30px rgba(0,0,0,0.08);
        border: 1px solid #eee;
    }

    .info-box {
        width: 50%; /* Half Width */
        margin-top: 0; /* Remove Overlap */
        border-radius: 20px;
        box-shadow: none;
        background: transparent;
        padding: 10px;
        min-height: auto;
    }
}

/* --- TYPOGRAPHY & ELEMENTS --- */
.p-title { font-family: var(--font-heading); font-size: 2rem; color: var(--text-dark); margin: 0 0 10px 0; line-height: 1.2; }
.p-price { font-size: 1.8rem; color: var(--primary); font-weight: bold; margin-bottom: 20px; display: flex; align-items: center; gap: 15px; }
.stock-badge { font-size: 0.9rem; padding: 6px 15px; border-radius: 20px; background: #eee; color: #666; font-weight: 500; }
.divider { height: 1px; background: #eee; margin: 25px 0; width: 100%; }
.desc-label { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 2px; color: #999; margin-bottom: 15px; font-weight: bold; }
.p-desc { color: #555; line-height: 1.8; font-size: 1rem; margin-bottom: 30px; }

/* --- RECOMMENDATIONS --- */
.rec-section { max-width: 1100px; margin: 0 auto; padding: 20px 25px 100px 25px; }
.rec-grid { display: flex; gap: 20px; overflow-x: auto; padding-bottom: 15px; scrollbar-width: thin; }
.rec-grid::-webkit-scrollbar { display: none; }

/* 🔴 FIXED: Forced width to prevent giant images */
.rec-card { 
    min-width: 160px; 
    width: 160px;        
    max-width: 160px;    
    flex-shrink: 0;      
    background: white; 
    border: 1px solid #eee; 
    border-radius: 12px; 
    padding: 15px; 
    cursor: pointer; 
    transition: 0.2s; 
    box-sizing: border-box;
}

.rec-card:hover { transform: translateY(-5px); box-shadow: 0 5px 15px rgba(0,0,0,0.05); }
.rec-img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 8px; margin-bottom: 10px; }
.rec-name { font-size: 0.9rem; font-weight: bold; margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-price { font-size: 0.9rem; color: var(--gold); font-weight: bold; }

/* --- STICKY BUTTON LOGIC --- */
/* Mobile Sticky Bar */
.mobile-action-bar { position: fixed; bottom: 0; left: 0; width: 100%; background: white; padding: 15px 20px; box-shadow: 0 -5px 20px rgba(0,0,0,0.05); z-index: 99; box-sizing: border-box; }

/* Desktop Inline Bar (Hidden by default) */
.desktop-action-bar { display: none; margin-top: 30px; }

/* Switch Visibility on Desktop */
@media (min-width: 768px) {
    .mobile-action-bar { display: none !important; }
    .desktop-action-bar { display: block !important; }
}

/* The Big Button Style */
.big-btn {
    background: var(--primary); color: white; width: 100%; padding: 18px;
    border: none; font-size: 1.1rem; font-weight: bold; border-radius: 50px;
    cursor: pointer; text-transform: uppercase; letter-spacing: 1px;
    box-shadow: 0 5px 15px rgba(196, 56, 56, 0.3); transition: 0.2s;
}
.big-btn:active { transform: scale(0.98); }
.big-btn:disabled { background: #ccc; box-shadow: none; cursor: not-allowed; }

/* =======================================================
   🔴 NEW FUNCTION 1: BETTER PHONE LAYOUT 
   (Makes Home Page look like an App on Phone)
   ======================================================= */
@media (max-width: 600px) {
    /* Tighter Grid (2 Columns instead of big 1 column) */
    .product-grid { 
        grid-template-columns: repeat(2, 1fr) !important; 
        gap: 12px !important; 
    } 
    
    /* Remove card borders for cleaner look */
    .product-card { 
        border: none !important; 
        box-shadow: 0 4px 10px rgba(0,0,0,0.03) !important; 
    }
    
    .card-details { padding: 12px !important; }
    
    /* Smaller Fonts so they fit nicely */
    .card-details h3 { 
        font-size: 13px !important; 
        margin-bottom: 5px; 
        height: 32px; 
        overflow: hidden; 
        line-height: 1.2; 
    }
    .price { font-size: 13px !important; margin-bottom: 8px; }
    
    /* Solid Button (Easier to tap on phone) */
    .add-btn { 
        background: var(--primary); 
        color: white; 
        border: none; 
        padding: 8px; 
        font-size: 11px; 
    }
    
    /* Smaller 'Hot Seller' Badge */
    .card-badge { 
        padding: 4px 8px; 
        font-size: 9px; 
        top: 8px; 
        left: 8px; 
    }
    
    /* Compact Filter Buttons */
    .filters { gap: 5px; }
    .btn-pill { padding: 10px 18px; font-size: 12px; }
}   

/* =======================================================
   🔴 NEW FUNCTION 2: SWIPE TO DELETE (Mobile Cart)
   ======================================================= */

/* The wrapper that holds both the item and the red background */
.swipe-wrapper {
    position: relative;
    overflow: hidden;
    margin-bottom: 15px;
    border-radius: 12px;
}

/* The Red Background Layer (Hidden behind the item) */
.swipe-background {
    position: absolute;
    top: 0; bottom: 0; left: 0; right: 0;
    background-color: #c43838; /* Your Brand Red */
    display: flex;
    align-items: center;
    justify-content: flex-end; /* Icon on the right */
    padding-right: 25px;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    z-index: 1; /* Behind the item */
    border-radius: 12px;
}

/* Ensure the cart item sits ON TOP of the red background */
.cart-item {
    position: relative;
    z-index: 10; /* In front of red background */
    background: white; /* Important to hide red background */
    transition: transform 0.2s ease-out; /* Smooth snapping */
}

/* Visual cue for the user */
.swipe-background i {
    transform: scale(1.2);
}

/* =======================================================
   🔴 FINAL PACKAGING STYLES (Box + Progress Bar)
   ======================================================= */

/* 1. The Container */
.pkg-box { 
    background: #fff8e1; 
    border: 1px solid #ffe082; 
    padding: 12px; 
    margin: 15px 0; 
    border-radius: 10px; 
    display: flex; 
    flex-direction: column; /* Stack header and bar */
    gap: 10px;
}

/* 2. The Header (Image + Text) */
.pkg-header {
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    width: 100%;
}

.pkg-thumb { 
    width: 50px;   
    height: 50px; 
    object-fit: cover; 
    border-radius: 5px; 
    margin-right: 12px; 
    border: 1px solid #eec04b;
}

/* 3. The Progress Bar (The missing part!) */
.box-progress { 
    display: flex; 
    gap: 4px; 
    margin-top: 5px; 
    height: 10px;       /* Gives it height */
    width: 100%; 
    border-radius: 4px; 
    overflow: hidden; 
    background: #eee;   /* Grey background */
}

.box-slot { flex: 1; background: #e0e0e0; }
.box-slot.filled { background: #c43838; } /* Red for Jar */
.box-slot.empty { background: #f1c40f; }  /* Yellow for Warning */

/* 4. Text Styles */
.pkg-box strong { font-size: 0.95rem; color: #c43838; }
.pkg-box small { font-size: 0.8rem; color: #8a6d3b; }

/* =======================================================
   🔴 NEW FUNCTION 4: SMART POPUPS & RECEIPT STYLES
   ======================================================= */
.smart-modal { 
    display: none; 
    position: fixed; 
    z-index: 200; 
    left: 0; top: 0; 
    width: 100%; height: 100%; 
    background-color: rgba(0,0,0,0.6); 
    backdrop-filter: blur(3px); 
    align-items: center; 
    justify-content: center; 
}

.smart-content { 
    background: white; 
    padding: 25px; 
    border-radius: 15px; 
    width: 85%; max-width: 400px; 
    text-align: center; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.2); 
    animation: popIn 0.3s; 
}
@keyframes popIn { from {transform: scale(0.8); opacity:0;} to {transform: scale(1); opacity:1;} }

.smart-icon { font-size: 50px; margin-bottom: 15px; display: block; }
.smart-img { width: 100%; height: 180px; object-fit: cover; border-radius: 10px; margin-bottom: 15px; border: 1px solid #eee; }
.smart-title { font-size: 1.2rem; margin-bottom: 10px; color: #c43838; font-weight: bold; }
.smart-text { color: #555; font-size: 0.95rem; line-height: 1.5; margin-bottom: 20px; }

.btn-row { display: flex; flex-direction: column; gap: 10px; }
.btn-primary { background: #c43838; color: white; padding: 12px; border: none; border-radius: 8px; font-weight: bold; width: 100%; font-size: 1rem; cursor: pointer; }
.btn-secondary { background: white; color: #777; border: 1px solid #ddd; padding: 12px; border-radius: 8px; font-weight: bold; width: 100%; font-size: 0.9rem; cursor: pointer; }

/* Receipt Styles */
.receipt-box { text-align: left; background: #f9f9f9; padding: 15px; border-radius: 10px; margin-bottom: 20px; font-size: 0.9rem; border: 1px dashed #ddd; }
.receipt-row { display: flex; justify-content: space-between; margin-bottom: 8px; }
.receipt-total { border-top: 1px solid #ddd; margin-top: 10px; padding-top: 10px; font-weight: bold; font-size: 1.1rem; color: #c43838; display: flex; justify-content: space-between; }