:root {
    --primary: #55287c;
    --primary-light: #7b42aa;
    --accent: #d2b4de;
    --card-bg: rgba(28, 12, 43, 0.88);
    --text-light: #ffffff;
    --text-muted: #bda3d4;
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-image: url('https://i.pinimg.com/736x/c6/48/b5/c648b52766d9bb1190aadc0d5cad1fb6.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-color: #1c0c2b;
    color: var(--text-light);
    min-height: 100vh;
    padding: 12px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.container {
    max-width: 480px;
    width: 100%;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 22px;
    border-radius: 24px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), 0 0 20px rgba(85, 40, 124, 0.5);
    border: 1px solid rgba(210, 180, 222, 0.25);
    margin-top: 10px;
    margin-bottom: 20px;
}

h1 { 
    text-align: center; 
    margin-bottom: 4px; 
    font-size: 1.8rem; 
    text-shadow: 0 2px 4px rgba(0,0,0,0.5); 
}

.subtitle { 
    text-align: center; 
    color: var(--accent); 
    margin-bottom: 24px; 
    font-style: italic; 
    font-size: 0.95rem; 
}

.date-picker { 
    text-align: center; 
    margin-bottom: 20px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 10px; 
}

.date-picker label { 
    font-weight: 500; 
    color: var(--accent); 
}

.date-picker input { 
    padding: 10px 14px; 
    border-radius: 12px; 
    border: 1px solid rgba(210, 180, 222, 0.3); 
    background: rgba(85, 40, 124, 0.4); 
    color: var(--text-light); 
    font-size: 16px; 
    outline: none; 
}

form { 
    display: flex; 
    flex-direction: column; 
    gap: 12px; 
    margin-bottom: 24px; 
}

.form-row { 
    display: flex; 
    gap: 12px; 
}

.form-row input { 
    flex: 1; 
    width: 50%; 
}

input, select { 
    padding: 14px; 
    border: 1px solid rgba(210, 180, 222, 0.3); 
    border-radius: 12px; 
    font-size: 16px; 
    background-color: rgba(40, 20, 55, 0.9);
    color: var(--text-light);
    outline: none;
    transition: all 0.2s ease;
    width: 100%;
}

/* Specific overrides for the Select element to fix the arrow margin */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    
    /* Adds safety space on the right so long text doesn't overlap our custom arrow */
    padding-right: 40px !important; 
    
    /* Injects a clean, modern custom arrow inline */
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>');
    background-repeat: no-repeat;
    
    /* Positions the custom arrow exactly 16px away from the right border margin */
    background-position: right 16px center;
    background-size: 16px;
    cursor: pointer;
}

select option { 
    background: #281437; 
    color: var(--text-light); 
}

input::placeholder { 
    color: rgba(255, 255, 255, 0.4); 
}

input:focus, select:focus { 
    border-color: var(--accent); 
    background: rgba(255, 255, 255, 0.15); 
    box-shadow: 0 0 8px rgba(210, 180, 222, 0.3); 
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--accent);
    cursor: pointer;
    padding: 2px 4px;
}

.checkbox-container input { 
    width: auto; 
    cursor: pointer; 
    transform: scale(1.1); 
}

button[type="submit"] {
    background: var(--primary); 
    color: var(--text-light); 
    border: 1px solid rgba(210, 180, 222, 0.3);
    padding: 14px; 
    border-radius: 12px; 
    font-size: 16px; 
    font-weight: bold; 
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

button[type="submit"]:hover { 
    background: var(--primary-light); 
}

button[type="submit"]:active { 
    transform: scale(0.98); 
}

.totals-box {
    background: rgba(85, 40, 124, 0.6); 
    padding: 16px; 
    border-radius: 14px; 
    text-align: center;
    font-weight: bold; 
    font-size: 1.1rem; 
    color: #ffffff; 
    margin-bottom: 24px;
    border: 1px solid rgba(210, 180, 222, 0.2); 
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.food-list { 
    list-style: none; 
    padding-right: 4px; 
}

.food-list::-webkit-scrollbar { 
    width: 6px; 
}

.food-list::-webkit-scrollbar-thumb { 
    background: var(--primary); 
    border-radius: 10px; 
}

.food-item { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 14px 8px; 
    border-bottom: 1px solid rgba(210, 180, 222, 0.15); 
}

.food-item:last-child { 
    border-bottom: none; 
}

.food-info strong { 
    font-size: 1.05rem; 
    color: var(--text-light); 
}

.food-info small { 
    color: var(--text-muted); 
    font-size: 0.85rem; 
    display: inline-block; 
    margin-top: 2px; 
}

.delete-btn {
    background: rgba(255, 71, 87, 0.15); 
    color: #ff6b81; 
    border: 1px solid rgba(255, 71, 87, 0.3);
    border-radius: 50%; 
    width: 32px; 
    height: 32px; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    cursor: pointer; 
    font-size: 18px; 
    transition: all 0.2s;
}

.delete-btn:hover { 
    background: rgba(255, 71, 87, 0.3); 
    color: #ff4757; 
}

input[type="date"]::-webkit-calendar-picker-indicator { 
    filter: invert(1); 
}
/* --- Favorites Dropdown & Delete Layout Wrapper --- */
.favorites-wrapper {
    display: flex;
    gap: 12px;
    width: 100%;
    margin-bottom: 4px; /* Matches form gaps */
}

/* Ensure the selector stretches cleanly and fits correctly alongside the button */
.favorites-wrapper select {
    flex: 1;
    margin-bottom: 0 !important;
}

/* Custom styled Trash Button that matches Lala's app theme */
#deleteFavBtn {
    background: rgba(255, 71, 87, 0.15); 
    color: #ff6b81; 
    border: 1px solid rgba(255, 71, 87, 0.3);
    padding: 0;
    width: 48px; /* Perfectly squares it to match input heights */
    height: 49px; 
    border-radius: 12px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease, transform 0.1s;
    outline: none;
}

/* Soft hover transition */
#deleteFavBtn:hover {
    background: rgba(255, 71, 87, 0.3); 
    color: #ff4757;
    border-color: #ff4757;
    box-shadow: 0 0 8px rgba(255, 71, 87, 0.2);
}

/* Snappy button depress effect */
#deleteFavBtn:active {
    transform: scale(0.96);
}

#frequentFoods option[value=""] {
    display: none;
}