:root {
    --bg-dark: #0b0e14;
    --bg-card: rgba(30, 34, 53, 0.6);
    --border-glass: rgba(255, 255, 255, 0.05);
    --text-main: #ffffff;
    --text-muted: #8b92a5;
    --cyan: #64ffd0;
    --pink: #ff2a85;
    --purple-grad: linear-gradient(135deg, #7b42f6 0%, #b01eff 100%);
    --danger: #ff5c5c;
}

/* SLEEK NEW FONT */
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Outfit', -apple-system, sans-serif; }

body { background-color: var(--bg-dark); color: var(--text-main); overflow: hidden; height: 100vh; }
.view { display: none; height: 100vh; width: 100vw; position: relative; }
.view.active { display: flex; flex-direction: column; }

/* GLASSMORPHISM */
.glass-card {
    background: var(--bg-card); border: 1px solid var(--border-glass);
    border-radius: 24px; padding: 25px; backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px); box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.header-card { margin: 60px 20px 30px; text-align: center; }
.header-card .label { color: var(--text-muted); font-size: 0.9rem; display: block; margin-bottom: 15px; }
.header-card .value { font-size: 4.5rem; font-weight: 700; display: block; margin-bottom: 5px; letter-spacing: -2px; line-height: 1; }
.cyan-glow { color: var(--cyan); text-shadow: 0 0 25px rgba(100, 255, 208, 0.4); }
.goal-indicator { font-size: 0.9rem; font-weight: 500; display: block; margin-bottom: 25px; }

.sub-macros { display: flex; justify-content: space-between; padding-top: 20px; border-top: 1px solid var(--border-glass); }
.macro-box { text-align: center; flex: 1; }
.macro-box .val { display: block; font-size: 1.3rem; font-weight: 600; margin-bottom: 4px; }
.macro-box .lab { color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; }

.text-gradient { background: var(--purple-grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.section-header { margin: 10px 25px; color: var(--text-main); font-size: 1.2rem; font-weight: 600; }

input, select {
    width: 100%; background: rgba(0,0,0,0.3); border: 1px solid var(--border-glass); color: white;
    padding: 18px; border-radius: 16px; margin-bottom: 15px; font-size: 1.05rem; transition: border 0.2s; font-weight: 400;
}
input:focus { outline: none; border-color: var(--cyan); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.helper-text { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 10px; margin-top: -5px; }
label { display: block; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 8px; }
.mini-text { font-size:0.75rem; color: var(--text-muted); }

.btn-primary { background: var(--purple-grad); color: white; border: none; width: 100%; padding: 18px; border-radius: 16px; font-size: 1.15rem; font-weight: 600; cursor: pointer; box-shadow: 0 4px 20px rgba(123, 66, 246, 0.4); }
.btn-secondary { background: rgba(255,255,255,0.05); color: white; border: 1px solid var(--border-glass); width: 100%; padding: 18px; border-radius: 16px; font-size: 1.05rem; cursor: pointer; font-weight: 500; }

#timeline-list { padding: 0 20px; }
.timeline-item { background: transparent; padding: 15px 0; border-bottom: 1px solid var(--border-glass); display: flex; justify-content: space-between; align-items: center; cursor: pointer; transition: opacity 0.2s; }
.timeline-item:active { opacity: 0.6; }
.food-name { font-weight: 500; font-size: 1.15rem; margin-bottom: 4px; }
.food-macros { color: var(--text-muted); font-size: 0.9rem; }
.food-cals { font-weight: 600; color: var(--cyan); font-size: 1.2rem; }

/* THE SLEEK PLUS BUTTON */
.fab { position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%); z-index: 50; cursor: pointer; }
.round-fab {
    background: var(--purple-grad); border: none; border-radius: 50%; color: white;
    width: 65px; height: 65px; display: flex; justify-content: center; align-items: center;
    box-shadow: 0 8px 30px rgba(123, 66, 246, 0.6); transition: transform 0.2s;
}
.round-fab i { width: 32px; height: 32px; stroke-width: 2.5px; }
.round-fab:active { transform: translateX(-50%) scale(0.9); }

.bottom-nav {
    position: fixed; bottom: 0; width: 100%; height: 80px; background: rgba(11, 14, 20, 0.9);
    backdrop-filter: blur(10px); display: flex; justify-content: space-around; align-items: center; border-top: 1px solid var(--border-glass); z-index: 40;
}
.nav-item { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 10px; transition: color 0.2s; }
.nav-item.active { color: var(--cyan); }

#screen-main { overflow-y: auto; height: 100vh; padding-bottom: 120px; }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: var(--bg-dark); z-index: 100; display: flex; flex-direction: column; }
.slide-screen { transform: translateX(100%); transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
.slide-screen.active-screen { transform: translateX(0); }
.screen-header { display: flex; justify-content: space-between; align-items: center; padding: 50px 20px 20px; }
.screen-header h2 { font-size: 1.3rem; font-weight: 600; }
.icon-btn { background: none; border: none; color: var(--text-main); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 5px; }

/* SEARCH LIST */
.search-container { padding: 0 20px 20px; position: relative; }
.search-icon { position: absolute; left: 35px; top: 18px; color: var(--text-muted); width: 22px; height: 22px; }
#input-search-profiles { padding-left: 50px; background: rgba(255,255,255,0.05); }
.list-container { flex: 1; overflow-y: auto; padding: 0 20px; }
.profile-item { padding: 20px; background: rgba(255,255,255,0.02); border-radius: 16px; margin-bottom: 10px; border: 1px solid var(--border-glass); display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.profile-info { flex: 1; }
.edit-icon-btn { background: none; border: none; color: var(--text-muted); padding: 10px; cursor: pointer; }

/* GRAMS INPUT */
.grams-input-wrapper { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; }
#input-grams { font-size: 5.5rem; text-align: center; background: transparent; border: none; color: var(--cyan); width: 100%; margin-bottom: 0; padding: 0; font-weight: 700; letter-spacing: -3px; }
.unit-label { color: var(--text-muted); font-size: 1.2rem; margin-top: -10px; }
.macros-preview-card { margin: 20px; display: flex; justify-content: space-around; padding: 20px; }
.preview-item { text-align: center; }
.preview-item .val { display: block; font-size: 1.3rem; font-weight: 600; margin-bottom: 5px; }

/* STATS */
.stats-header { display: flex; justify-content: space-between; align-items: center; padding: 60px 20px 10px; }
.stat-select { width: auto; background: var(--bg-card); padding: 10px 20px; border-radius: 20px; margin: 0; font-weight: 500; text-align: center; -webkit-appearance: none; color: var(--cyan); border-color: var(--cyan); }
.date-display { text-align: center; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 20px; }
.stat-card { margin: 0 20px 20px; padding: 20px; }
.stat-card h3 { font-size: 1.05rem; color: var(--text-muted); margin-bottom: 15px; font-weight: 500; }
.canvas-wrapper { position: relative; height: 220px; width: 100%; }

/* --- DATE NAVIGATOR --- */
.date-navigator {
    display: flex; justify-content: space-between; align-items: center;
    margin: 20px 20px 0; padding: 12px 20px;
    background: rgba(255,255,255,0.03); border-radius: 20px;
    border: 1px solid var(--border-glass);
}
#display-date { font-size: 1.15rem; font-weight: 500; color: var(--text-main); }

/* --- MACRO PREVIEW CARD FIX --- */
.macros-preview-card {
    margin: 40px 20px; /* Separates it from input and button natively */
    display: flex; justify-content: space-around; padding: 25px 15px;
}
.preview-item { text-align: center; }
.preview-item .val { display: block; font-size: 1.4rem; font-weight: 600; margin-bottom: 5px; }
.preview-item .lab { color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; }

/* Removes the old absolute position logic from button wrappers */
.grams-input-wrapper { display: flex; flex-direction: column; align-items: center; }

/* --- PREMIUM WELCOME SCREEN --- */
#auth-view {
    /* Adds a subtle purple glowing orb in the background */
    background: radial-gradient(circle at 50% 25%, rgba(123, 66, 246, 0.15) 0%, var(--bg-dark) 70%);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.auth-wrapper {
    width: 100%;
    max-width: 380px;
    text-align: center;
    animation: slideUpFade 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Glowing App Icon */
.brand-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}
.logo-glow {
    width: 75px;
    height: 75px;
    background: var(--purple-grad);
    border-radius: 22px; /* iOS style squircle */
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 30px rgba(123, 66, 246, 0.5);
    transform: rotate(10deg); /* Playful tilt */
}
.logo-glow i {
    color: white;
    width: 38px;
    height: 38px;
    stroke-width: 2.5px;
    transform: rotate(-10deg); /* Untilt the icon itself */
}

/* Typography */
.brand-title {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -1.5px;
    margin-bottom: 5px;
    color: white;
}
.brand-subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 40px;
}

/* The Glass Form */
.auth-card {
    padding: 35px 25px;
}

/* --- CUSTOM APP ICON --- */
.app-icon-img {
    width: 90px;
    height: 90px;
    border-radius: 50%; /* Smooth iOS-style squircle */
    box-shadow: 0 12px 35px rgba(123, 66, 246, 0.4); /* Maintains the purple glow */
    object-fit: cover;
}

/* --- GLOBAL CARET (CURSOR) FIX --- */
input, textarea {
    caret-color: var(--cyan) !important;
}

/* --- FIX FOR INPUT ICONS (LUCIDE SVG FIX) --- */
.input-group {
    position: relative;
    margin-bottom: 15px;
    width: 100%;
}

/* We must target 'svg' because Lucide replaces the <i> tag! */
.input-group svg {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 22px;
    height: 22px;
    z-index: 10;
    pointer-events: none;
}

.input-group input {
    width: 100%;
    box-sizing: border-box;
    padding-top: 18px;
    padding-bottom: 18px;
    padding-right: 20px;
    padding-left: 55px !important; /* Pushes text to the right of the icon */
    margin-bottom: 0 !important;
}

/* KILLS THE UGLY WHITE BROWSER AUTO-FILL */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active{
    -webkit-box-shadow: 0 0 0 1000px #171926 inset !important; 
    -webkit-text-fill-color: white !important;
    caret-color: var(--cyan) !important;
    border: 1px solid var(--border-glass) !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* --- TOAST NOTIFICATIONS --- */
.toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translate(-50%, -150px); /* Hidden above screen */
    background: rgba(255, 92, 92, 0.15); /* Red tint */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 92, 92, 0.3);
    color: #fff;
    padding: 16px 24px;
    border-radius: 50px; /* Pill shape */
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 9999;
    box-shadow: 0 10px 30px rgba(255, 92, 92, 0.2);
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    font-weight: 500;
    pointer-events: none; /* Can't be clicked accidentally */
}

/* Slide in animation */
.toast.show {
    transform: translate(-50%, 0);
}

/* Success Toast Override */
.toast.success {
    background: rgba(100, 255, 208, 0.15); /* Cyan tint */
    border: 1px solid rgba(100, 255, 208, 0.3);
    box-shadow: 0 10px 30px rgba(100, 255, 208, 0.2);
}

.toast i { width: 22px; height: 22px; }
.toast.error i { color: var(--danger); }
.toast.success i { color: var(--cyan); }