/* /assets/css/style.css */

:root {
    /* Color Palette derived from Logo */
    --bg-primary: #E0E5EC;
    --text-primary: #1a2f1c; /* Dark tint for text */
    --text-secondary: #5e6b60;
    
    /* Logo Colors */
    --accent-color: #224b27; /* Dark Green */
    --accent-hover: #17361b;
    --accent-light: #699e31; /* Light Leaf Green */
    --accent-orange: #ee7b22; /* Box Orange */
    
    --warning: #ee7b22;
    --danger: #EF4444;

    /* Neumorphic Shadows */
    --shadow-light: 9px 9px 16px rgb(163,177,198,0.6), -9px -9px 16px rgba(255,255,255, 0.5);
    --shadow-inner: inset 6px 6px 10px 0 rgba(163,177,198, 0.7), inset -6px -6px 10px 0 rgba(255,255,255, 0.8);
    --shadow-pressed: inset 4px 4px 6px rgba(163, 177, 198, 0.7), inset -4px -4px 6px rgba(255, 255, 255, 0.7);
    
    /* Neumorphic Box Background */
    --surface: #E0E5EC;

    /* Typography */
    --font-main: 'Inter', sans-serif;
    
    /* Layout */
    --border-radius-sm: 8px;
    --border-radius-md: 16px;
    --border-radius-lg: 24px;
    --border-radius-round: 50%;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 80px; /* Space for bottom nav on mobile */
}

/* Typography Utilities */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--text-primary);
}

p {
    color: var(--text-secondary);
}

/* Neumorphic Base Classes */
.neu-card {
    background-color: var(--surface);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-light);
    padding: 20px;
}

.neu-button {
    background-color: var(--surface);
    border: none;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-light);
    color: var(--text-primary);
    padding: 12px 24px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.neu-button:active {
    box-shadow: var(--shadow-pressed);
}

.neu-button.primary {
    color: #fff;
    background-color: var(--accent-orange);
    box-shadow: 4px 4px 8px rgba(238, 123, 34, 0.4), -4px -4px 8px rgba(255, 255, 255, 0.5);
}
.neu-button.primary:active {
    box-shadow: inset 4px 4px 6px rgba(0, 0, 0, 0.2), inset -4px -4px 6px rgba(255, 255, 255, 0.3);
}

.neu-inset {
    background-color: var(--surface);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-inner);
    padding: 20px;
}

/* Layout Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation - Mobile First */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 75px;
    background-color: var(--surface);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-nav .logo {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--accent-color);
}

.nav-actions {
    display: flex;
    gap: 15px;
}

.nav-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-round);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-light);
    background-color: var(--surface);
    cursor: pointer;
}

.nav-icon:active {
    box-shadow: var(--shadow-pressed);
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--surface);
    display: flex;
    justify-content: space-around;
    padding: 10px 0 25px; /* Extra padding for iOS home bar */
    box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
    z-index: 100;
    border-top-left-radius: var(--border-radius-lg);
    border-top-right-radius: var(--border-radius-lg);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.75rem;
    gap: 4px;
    cursor: pointer;
}

.bottom-nav-item.active {
    color: var(--accent-color);
}

.bottom-nav-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 40px 20px;
}

.hero h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.hero p {
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.hero-box-preview {
    margin: 30px auto;
    width: 100%;
    max-width: 350px;
    aspect-ratio: 4/3;
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Pricing Cards */
.pricing-section {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.price-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Box Builder Layout */
.builder-section {
    display: none; /* Hidden by default, shown by JS */
    padding: 20px;
}

.builder-section.active {
    display: block;
}

/* Lunch Box Grid (Based on provided 8-compartment image) */
.lunch-box-container {
    background-color: #1a1a1a; /* Dark tray color like the image */
    border-radius: 30px;
    padding: 10px;
    box-shadow: 0 15px 25px rgba(0,0,0,0.2), inset 0 2px 5px rgba(255,255,255,0.1);
    margin: 20px auto;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1 / 1.1;
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr;
    grid-template-rows: 1fr 1.5fr 1fr;
    gap: 8px;
}

.compartment {
    background-color: #0f0f0f;
    border-radius: 15px;
    box-shadow: inset 0 5px 10px rgba(0,0,0,0.8), 0 1px 1px rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
}

.compartment:hover {
    box-shadow: inset 0 5px 15px rgba(0,0,0,0.9), 0 0 0 2px var(--accent-color);
}

.compartment.drag-over {
    box-shadow: inset 0 0 0 2px var(--accent-color), inset 0 5px 15px rgba(76, 175, 80, 0.3);
}

.compartment img {
    width: 90%;
    height: 90%;
    object-fit: cover;
    border-radius: 10px;
}

.compartment-placeholder {
    color: #444;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    pointer-events: none;
}

/* Specific Compartment Spans to match the image */
.comp-top-left { grid-column: 1; grid-row: 1; }
.comp-top-mid { grid-column: 2; grid-row: 1; }
.comp-top-right { grid-column: 3; grid-row: 1; }

.comp-mid-left { grid-column: 1; grid-row: 2; }
.comp-mid-main { grid-column: 2 / 4; grid-row: 2; } /* Large compartment spanning 2 cols */

.comp-bot-left { grid-column: 1; grid-row: 3; }
.comp-bot-mid { grid-column: 2; grid-row: 3; }
.comp-bot-right { grid-column: 3; grid-row: 3; }

/* Nutrition & Price Summary Strip */
.live-summary {
    position: sticky;
    bottom: 75px; /* Above bottom nav */
    left: 0;
    width: 100%;
    background-color: var(--surface);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.05);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    z-index: 90;
}

.protein-tracker {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tracker-ring {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: conic-gradient(var(--accent-color) 0%, #d1d5db 0%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tracker-ring-inner {
    width: 32px;
    height: 32px;
    background-color: var(--surface);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
}

.tracker-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.tracker-text strong {
    color: var(--text-primary);
    display: block;
}

.price-total {
    text-align: right;
}

.price-total span {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: block;
}

.price-total strong {
    font-size: 1.2rem;
    color: var(--accent-color);
}

/* Category Tabs */
.category-tabs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 0;
    scrollbar-width: none; /* Firefox */
}
.category-tabs::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.tab {
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow-light);
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: nowrap;
    cursor: pointer;
}
.tab.active {
    box-shadow: var(--shadow-pressed);
    color: var(--accent-color);
    font-weight: bold;
}

/* Food Cards List */
.food-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding: 10px 0 20px;
}

.food-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    cursor: pointer;
}

.food-card img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: var(--shadow-light);
    margin-bottom: 5px;
}

.food-card h4 {
    font-size: 0.9rem;
    margin: 0;
}
.food-card span {
    font-size: 0.8rem;
    color: var(--accent-color);
    font-weight: bold;
}

/* Bottom Sheet / Modal */
.bottom-sheet-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    display: none;
}
.bottom-sheet-overlay.active {
    display: block;
}

.bottom-sheet {
    position: fixed;
    bottom: -100%;
    left: 0;
    width: 100%;
    background: var(--surface);
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    padding: 25px;
    z-index: 201;
    transition: bottom 0.3s ease-in-out;
    box-shadow: 0 -10px 25px rgba(0,0,0,0.1);
}
.bottom-sheet.active {
    bottom: 0;
}

.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.sheet-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.nutrition-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 20px 0;
}
.price-card {
    text-align: center;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.price-card:hover {
    transform: translateY(-5px);
}

.price-card.selected {
    box-shadow: var(--shadow-inner) !important;
    transform: scale(0.98) !important;
    border: 2px solid var(--accent-color);
}

.nutri-box {
    text-align: center;
    padding: 10px;
}
.nutri-box span {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
}
.nutri-box strong {
    font-size: 0.9rem;
}

.plan-section {
    padding: 20px;
}
.plan-section.active {
    display: block !important;
}

/* Responsive adjustments */
@media (min-width: 768px) {
    .bottom-nav {
        display: none; /* Hide bottom nav on tablet/desktop */
    }
    
    body {
        padding-bottom: 0;
    }

    .pricing-section {
        flex-direction: row;
        justify-content: center;
    }
    
    .price-card {
        width: 30%;
    }

    .builder-section {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 30px;
        align-items: start;
    }

    .live-summary {
        position: static;
        border-radius: 20px;
        margin-top: 20px;
    }
}
