/* BASKET APP - FINAL GOLD MASTER STYLESHEET 
   Version: 1.1.0 (Organized & Fixed)
*/

/* --- 1. FONT DEFINITIONS (Google CDN) --- */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:wght@300;600;800&family=Outfit:wght@300;400;500;600;700&display=swap');

/* --- 2. VARIABLES --- */
:root {
    --basket-dark: #203b25;   /* Forest Green */
    --basket-accent: #d64d4d; /* Tomato Red */
    --basket-cream: #f9f8f4;  /* Oat Milk */
    --basket-surface: #ffffff; 
    --text-main: #2b2b2b;
    --text-muted: #8a968b;
    
    --font-main: 'Outfit', sans-serif;
    --font-heading: 'Fraunces', serif;

    --shadow-soft: 0 8px 30px rgba(44, 82, 52, 0.06);
    --shadow-card: 0 4px 12px rgba(0,0,0,0.03);
    --radius: 20px;
    --radius-sm: 12px;
    --transition-standard: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- 3. GLOBAL RESET --- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; padding: 0; }

body {
    font-family: var(--font-main);
    background-color: #ffffff;
    color: var(--text-main);
    line-height: 1.6;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    overscroll-behavior-y: none;
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

/* --- 4. LAYOUT CONTAINERS --- */
.container, .tab-content {
    max-width: 600px;
    margin: 0 auto;
    padding: 24px;
    padding-top: 90px;   /* Clears the Fixed Header */
    padding-bottom: 100px; /* Clears the Bottom Nav */
    min-height: 100vh;
    position: relative; 
}

.tab-content[style*="display:none"] {
    pointer-events: none;
    -webkit-user-select: none;
    user-select: none;
}

.scroll-spacer { height: 50px; width: 100%; display: block; }

/* --- 5. FIXED HEADER --- */
.app-header-fixed {
    position: fixed;
    top: 0; left: 0; width: 100%;
    height: 60px;
    background-color: var(--basket-dark);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    padding-top: env(safe-area-inset-top);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-logo {
    height: 24px;
    width: auto;
    display: block;
}

/* --- THE WHITE ICON FIX --- */
/* This positions the account icon on the right and makes it white */
.header-account-icon {
    position: absolute;
    right: 20px;       
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    stroke: #ffffff;   /* Forces icon to be White */
    opacity: 0.9;
    transition: opacity 0.2s;
    padding-top: env(safe-area-inset-top); 
}
.header-account-icon:active { opacity: 0.5; }


/* --- 6. NAVIGATION BAR --- */
.nav-bar {
    position: fixed; bottom: 0; left: 0; right: 0; width: 100%; height: 70px;
    background-color: var(--basket-dark);
    display: flex; justify-content: space-between; align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    border-top: none;
}

.nav-btn {
    flex: 1; height: 100%; background: transparent; border: none;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px; padding-bottom: 5px; cursor: pointer;
    font-family: var(--font-main);
    color: rgba(255, 255, 255, 0.9); 
    transition: transform 0.1s ease;
}

.nav-btn svg { width: 24px; height: 24px; stroke-width: 2px; }
.nav-btn span { font-size: 10px; font-weight: 500; }

.nav-btn.active { color: #ffffff; font-weight: 700; }
.nav-btn.active svg { stroke-width: 2.5px; transform: translateY(-2px); }
.nav-btn.active::after {
    content: ''; width: 4px; height: 4px; background-color: #ffffff;
    border-radius: 50%; position: absolute; bottom: 8px;
    box-shadow: 0 0 6px rgba(255,255,255,0.4);
}

/* --- 7. BUTTONS & INPUTS --- */
input[type="text"], input[type="url"] {
    font-family: var(--font-main); background: var(--basket-surface);
    border: 2px solid transparent; border-radius: var(--radius);
    padding: 16px 20px; font-size: 1.05rem; box-shadow: var(--shadow-card);
    width: 100%; transition: var(--transition-standard);
    outline: none; color: var(--basket-dark); font-weight: 500;
}
input:focus {
    border-color: var(--basket-dark); transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}
.input-group { display: flex; gap: 12px; position: relative; margin-bottom: 20px; }

.asda-btn {
    font-family: var(--font-main); background: var(--basket-dark); color: #f1f1f1;
    border: none; border-radius: var(--radius); font-weight: 600; font-size: 1rem;
    padding: 18px; width: 100%; box-shadow: 0 6px 20px rgba(32, 59, 37, 0.2);
    transition: var(--transition-standard); position: relative; overflow: hidden;
    display: flex; justify-content: center; align-items: center; gap: 10px; cursor: pointer;
}
.asda-btn:active { transform: scale(0.98); }

.add-btn {
    background: var(--basket-dark); color: white; border: none; border-radius: 16px;
    width: 56px; height: 56px; display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem; font-weight: 300; box-shadow: 0 4px 15px rgba(32, 59, 37, 0.15);
    cursor: pointer; flex-shrink: 0; transition: 0.2s;
}
.add-btn:active { transform: scale(0.9) rotate(90deg); background: var(--basket-accent); }

.button-grid {
    display: grid; grid-template-columns: 1.8fr 1fr; gap: 12px; margin-top: 30px; width: 100%;
}
.clear-style {
    background: transparent; color: var(--text-muted); border: 2px solid #e0e0e0;
    border-radius: var(--radius); font-weight: 600; font-family: var(--font-main);
    transition: var(--transition-standard); cursor: pointer;
}
.clear-style:active {
    border-color: var(--basket-accent); color: var(--basket-accent);
    background: rgba(214, 77, 77, 0.05);
}

/* --- 8. LIST ITEMS (SHOPPING) --- */
.shop-item {
    background: var(--basket-surface); padding: 18px 20px; margin-bottom: 10px;
    border-radius: var(--radius); box-shadow: var(--shadow-card);
    display: flex; align-items: center; gap: 15px; transition: var(--transition-standard); cursor: pointer;
}
.shop-item span { font-size: 1.05rem; font-weight: 400; }
.checkbox-circle {
    width: 24px; height: 24px; border: 2px solid #ccd1ce; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: 0.2s;
}
.shop-item.checked {
    background-color: #f1f3f1; opacity: 0.6; box-shadow: none; transform: scale(0.98);
}
.shop-item.checked span { text-decoration: line-through; color: var(--text-muted); }
.shop-item.checked .checkbox-circle { background: var(--basket-dark); border-color: var(--basket-dark); }
.shop-item.checked .checkbox-circle::after { content: '✓'; color: white; font-size: 14px; font-weight: bold; }

.aisle-header {
    margin-top: 30px; margin-bottom: 12px; color: var(--basket-dark);
    font-family: var(--font-heading); font-size: 1.2rem; font-weight: 600;
    border-bottom: 2px solid #eae8e0; padding-bottom: 5px;
}
.preview-item-card {
    background: var(--basket-surface); padding: 16px 20px; margin-bottom: 12px;
    border-radius: var(--radius-sm); display: flex; justify-content: space-between;
    align-items: center; box-shadow: var(--shadow-card); border: 1px solid rgba(0,0,0,0.03);
    animation: itemEntrance 0.4s forwards;
}

/* --- 9. RECIPES & LIBRARY --- */
.recipe-card {
    background: white; padding: 10px; border-radius: 16px; margin-bottom: 12px;
    display: flex; align-items: center; gap: 15px; box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    border: 1px solid #f0f0f0; cursor: pointer;
}
.recipe-thumb {
    width: 60px !important; height: 60px !important; border-radius: 12px;
    object-fit: cover; background-color: #f1f8f4; flex-shrink: 0;
}
.recipe-info { flex-grow: 1; overflow: hidden; display: flex; flex-direction: column; }
.recipe-name {
    font-family: var(--font-heading); font-weight: 600; color: var(--basket-dark);
    font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.logo-pill {
    display: flex; align-items: center; justify-content: center; background: #f9f8f4;
    padding: 10px 5px; border-radius: 16px; border: 1px solid #eee; height: 50px;
    flex: 1; max-width: 120px;
}
.brand-logo {
    max-width: 100%; max-height: 100%; object-fit: contain;
    filter: grayscale(100%) opacity(0.6); transition: 0.3s;
}
.logo-pill:hover .brand-logo { filter: grayscale(0%) opacity(1); }

/* --- 10. SEASONAL TAB --- */
/* --- 10. SEASONAL TAB (Flagship Deli Edition) --- */

.month-scroll-container {
    display: flex; overflow-x: auto; gap: 8px; padding-bottom: 15px; margin-bottom: 25px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Hides scrollbar on modern browsers */
}
.month-scroll-container::-webkit-scrollbar { display: none; } /* Hides scrollbar on iOS/Chrome */

.month-pill {
    background: #f1f3f1; border: none; padding: 10px 20px; border-radius: 24px;
    font-weight: 600; font-family: var(--font-main); color: #8a968b; 
    white-space: nowrap; cursor: pointer; flex-shrink: 0; transition: var(--transition-standard);
}
.month-pill.active { background: var(--basket-dark); color: white; transform: scale(1.05); box-shadow: 0 4px 12px rgba(32, 59, 37, 0.2); }

.seasonal-header-wrapper {
    display: flex; align-items: center; gap: 12px; margin-bottom: 18px;
    padding-bottom: 10px; border-bottom: 1px solid rgba(32, 59, 37, 0.08);
}

.seasonal-png-icon { width: 40px; height: 40px; object-fit: contain; display: block; }
.seasonal-header { font-size: 1.6rem; color: var(--basket-dark); font-family: var(--font-heading); margin: 0; }

/* The Premium Grid */
.seasonal-grid {
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); 
    gap: 12px; 
    margin-bottom: 35px;
}

/* The Premium Card */
.seasonal-item {
    background: #ffffff; 
    border: 1px solid rgba(32, 59, 37, 0.08); /* A very subtle forest green tint, not generic grey */
    padding: 14px 16px; 
    border-radius: 16px; /* Smooth, modern corners */
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02); /* Extremely soft luxury shadow */
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* The Item Text */
.seasonal-item span:first-child {
    font-family: var(--font-main);
    font-weight: 500;
    color: var(--text-main);
    font-size: 0.95rem;
    line-height: 1.2;
    padding-right: 8px;
}

/* The '+' Button inside the card */
.seasonal-item .plus-icon {
    background: var(--basket-cream);
    color: var(--basket-dark);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 600;
    font-size: 1.2rem;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

/* The Tactile Tap Effect (Turns Green, Text goes White) */
.seasonal-item:active {
    transform: scale(0.96); 
    background-color: var(--basket-dark);
    border-color: var(--basket-dark);
    box-shadow: 0 4px 15px rgba(32, 59, 37, 0.2);
}

.seasonal-item:active span:first-child {
    color: #ffffff;
}

.seasonal-item:active .plus-icon {
    background: rgba(255,255,255,0.2);
    color: #ffffff;
}

/* --- 11. ACCOUNT & PROFILE (FIXED) --- */
/* This correctly aligns the profile items in the center */
.profile-header {
    display: flex;
    flex-direction: column; 
    align-items: center;    
    justify-content: center;
    text-align: center;
    width: 100%;
    padding: 30px 0 20px 0;
}
.profile-header div[onclick]:hover h2 { opacity: 0.7; }

.avatar-circle {
    width: 80px; height: 80px; background: white; border-radius: 28px;
    display: flex; align-items: center; justify-content: center; margin: 0 auto; box-shadow: var(--shadow-soft);
}
.stats-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 30px;
}
.stat-card {
    background: white; padding: 15px 10px; border-radius: var(--radius-sm); text-align: center;
    box-shadow: var(--shadow-card); border: 1px solid rgba(0,0,0,0.02);
}
.stat-value {
    display: block; font-size: 1.2rem; font-weight: 700; color: var(--basket-dark); font-family: var(--font-heading);
}
.settings-group {
    background: white; border-radius: 20px; margin-bottom: 25px; overflow: hidden; border: 1px solid #f0f0f0;
}
.template-card {
    display: flex; align-items: center; justify-content: space-between; background: white;
    padding: 16px 20px; border-radius: var(--radius-sm); margin-bottom: 12px; box-shadow: var(--shadow-card); gap: 12px;
}
.template-btn {
    flex: 1; background: none; border: none; text-align: left; font-family: var(--font-heading);
    font-weight: 600; font-size: 1.1rem; color: var(--basket-dark);
}
.icon-btn {
    width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
    background: var(--basket-cream); border: none; cursor: pointer;
}
.icon-btn.delete { color: var(--basket-accent); }
.switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background-color: #e0dfd9; transition: .4s; border-radius: 34px;
}
.slider:before {
  position: absolute; content: ""; height: 20px; width: 20px;
  left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%;
}
input:checked + .slider { background-color: var(--basket-accent); }
input:checked + .slider:before { transform: translateX(22px); }

/* --- 12. OVERLAYS & ANIMATIONS --- */
#suggestions-box {
    position: absolute; top: 110%; left: 0; width: 100%; background: var(--basket-surface);
    border-radius: var(--radius-sm); box-shadow: 0 10px 30px rgba(0,0,0,0.1); z-index: 1001;
    max-height: 250px; overflow-y: auto; display: none; padding: 5px;
}
.search-loader {
    width: 20px; height: 20px; border: 2px solid rgba(255,255,255,0.3); border-top: 2px solid #fff;
    border-radius: 50%; animation: rotation 0.6s linear infinite; display: inline-block;
}
#splash-screen {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: var(--basket-dark); display: flex; justify-content: center; align-items: center;
    z-index: 2000; transition: opacity 0.8s ease, visibility 0.8s;
}
#splash-screen.fade-out { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-logo { width: 120px; opacity: 0; animation: splashReveal 0.8s ease forwards 0.2s; }
.splash-logo img { width: 100%; height: auto; display: block; }
.splash-loader { opacity: 0; margin-top: 30px; animation: splashReveal 0.8s ease forwards 0.6s; }

.onboarding-wrapper {
    position: fixed; inset: 0; background: rgba(43, 43, 43, 0.3);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    z-index: 1500; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.onboarding-card {
    background: var(--basket-cream); padding: 40px 30px; border-radius: 32px;
    text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,0.2); max-width: 340px; width: 100%;
}
.onboarding-slide { display: none; animation: fadeIn 0.4s ease; }
.onboarding-slide.active { display: block; }
.onboarding-dots { display: flex; justify-content: center; gap: 8px; margin-top: 30px; }
.dot { width: 8px; height: 8px; background: #ccc; border-radius: 50%; }
.dot.active { background: var(--basket-dark); width: 20px; border-radius: 10px; }

#success-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.4);
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); opacity: 0; display: none; transition: opacity 0.5s ease; z-index: 1500;
}
#success-overlay.active { display: block; opacity: 1; }
#success-card {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: var(--basket-cream); padding: 40px; border-radius: 32px;
    text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    z-index: 1501; width: 85%; max-width: 400px; display: none;
}

@keyframes splashReveal { to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes rotation { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes itemEntrance { from { opacity: 0; transform: scale(0.9) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
.loader {
    width: 24px; height: 24px; border: 3px solid rgba(255, 255, 255, 0.3); border-radius: 50%;
    border-top-color: #fff; animation: spin 1s ease-in-out infinite; position: relative; margin: 0 auto;
}
#progress-bar-fill {
    position: absolute; top: 0; left: 0; height: 100%; background: rgba(255, 255, 255, 0.15);
    width: 0%; transition: width 0.4s ease-out; z-index: 0; pointer-events: none;
}
#btn-text { position: relative; z-index: 1; }

.template-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0; 
    flex-wrap: nowrap; 
    white-space: nowrap; 
}

/* --- CINEMATIC INTRO STYLES --- */
#cinematic-intro {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999; 
    background-color: var(--basket-dark); 
    transition: opacity 1.5s ease-out;
}
.cine-slide {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    opacity: 0; 
    transition: opacity 1.5s ease-in-out; 
    pointer-events: none;
}
.cine-slide.active { opacity: 1; z-index: 2; }

.cine-photo {
    height: 50vh; width: 100%;
    background-size: cover; background-position: center center;
    animation: subtleZoom 20s infinite alternate;
}
.cine-text {
    height: 50vh; width: 100%;
    background-color: var(--basket-dark); color: white;
    display: flex; align-items: center; justify-content: center;
    text-align: center; padding: 40px; box-sizing: border-box;
}
.cine-content-wrapper h1 {
    font-family: 'Fraunces', serif; font-size: 2.8rem;
    margin: 0 0 15px 0; font-weight: 300; letter-spacing: -0.5px;
    opacity: 0; animation: textFadeUp 1s ease 0.5s forwards;
}
.cine-content-wrapper p {
    font-family: 'Outfit', sans-serif; font-size: 1.1rem;
    line-height: 1.6; opacity: 0.9; max-width: 400px; margin: 0 auto;
    opacity: 0; animation: textFadeUp 1s ease 0.7s forwards;
}

@keyframes textFadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes subtleZoom {
    from { transform: scale(1); }
    to { transform: scale(1.05); }
}

/* --- PREMIUM DROPDOWN STYLING --- */
#region-selector {
    width: 100%;
    padding: 14px 16px;
    font-family: var(--font-main);
    font-size: 1rem;
    color: var(--basket-dark);
    background-color: #f1f3f1;
    border: 1px solid rgba(32, 59, 37, 0.1);
    border-radius: 12px;
    appearance: none; /* Hides the ugly default OS arrow */
    -webkit-appearance: none;
    /* Custom luxury arrow */
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23203b25%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 16px top 50%;
    background-size: 12px auto;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

#region-selector:focus {
    outline: none;
    border-color: var(--basket-accent);
    box-shadow: 0 0 0 3px rgba(214, 77, 77, 0.1);
}

/* --- 11. PREMIUM HERO BANNERS --- */
.premium-hero {
    position: relative;
    width: 100%;
    height: 200px;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.premium-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.premium-hero-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to bottom, rgba(32,59,37,0.05), rgba(32,59,37,0.85));
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 24px;
}

.premium-hero-title {
    color: #ffffff;
    font-family: 'Fraunces', serif;
    font-size: 2rem;
    margin: 0;
    line-height: 1.1;
    text-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.premium-hero-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    margin-top: 6px;
    font-weight: 500;
    letter-spacing: 0.5px;
}