@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@500&display=swap');

:root {
    --primary-color: #000000;      
    --background-color: #F8F9FA;   
    --surface-color: #FFFFFF;      
    --accent-color: #00FFea;
    --text-muted-color: #666666;   
    --activity-button-hover-color: #FF5252; 
    --font-mono: 'Source Code Pro', monospace;
    --font-sans: 'Inter', sans-serif;
}

/* General Body and Typography */
body {
    background-color: var(--background-color);
    font-family: var(--font-sans); /* Apply sans-serif font globally */
    line-height: 1.6;
    color: var(--primary-color);
}

/* --- UTILITY FIXES --- */
/* Ensures that <strong> tags are always bold, even inside Bootstrap's .lead class */
.lead strong {
    font-weight: 700 !important;
}

/* Container Adjustments */
.container {
    max-width: 1000px;
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

/* --- Navbar Styling --- */
.navbar {
    background-color: var(--surface-color);
    padding: 0.5rem 0;
    /*border-bottom: 1px solid #EAEAEA;*/
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px; /* Space between graphic and text */
    text-decoration: none;
}

.logo-graphic {
    display: flex;
    align-items: flex-end; /* Align bars to the bottom */
    height: 24px; /* Match font-size of logo-text */
    gap: 3px;
}

.logo-bar {
    display: inline-block;
    width: 5px;
    background-color: var(--accent-color);
    transition: height 0.2s ease-in-out;
}

.logo-bar.bar-1 { height: 8px; }
.logo-bar.bar-2 { height: 14px; }
.logo-bar.bar-3 { height: 20px; }

.logo-container:hover .logo-bar.bar-1 { height: 20px; background-color: var(--accent-color);}
.logo-container:hover .logo-bar.bar-2 { height: 8px; background-color: var(--accent-color);}
.logo-container:hover .logo-bar.bar-3 { height: 14px; background-color: var(--accent-color);}

.logo-text {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-color) !important;
    letter-spacing: 1px;
}


.nav-link, .nav-link:focus {
    font-weight: 500;
    color: var(--primary-color) !important;
    padding: 8px 15px;
    transition: all 0.2s ease-in-out; /* Standardized transition */
    border-radius: 6px;
    margin: 0 2px;
}

.nav-link:hover,
.nav-link.active {
    transform: translateY(-2px); /* Add lift effect */
    box-shadow: 0 4px 8px rgba(0,0,0,0.07); /* Add subtle shadow */
    color: var(--primary-color) !important;
    background-color: var(--accent-color);
}

/* --- Main Content Card --- */
.makeitcount-card {
    background-color: var(--surface-color);
    padding: 30px;
    border-radius: 12px;
    /*border: 1px solid #EAEAEA;*/
    /*box-shadow: 0 4px 12px rgba(0,0,0,0.05);*/
}

h2 {
    font-weight: 700 !important;
    font-size: 2rem !important;
}

.text-muted {
    color: var(--text-muted-color) !important;
    font-size: 0.9rem;
}

/* --- Custom Input Box Styling --- */
.custom-input-box {
    padding: 15px;
    background-color: var(--background-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 80px; /* Ensures consistent height */
    border-radius: 8px;
    /*border: 1px solid #E0E0E0;*/
    border: 1px solid var(--text-muted-color);
}

.custom-input-box label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.custom-input-box .input-box-value {
    background: transparent;
    border: none;
    font-family: var(--font-sans);
    font-size: 1.2rem;
    color: var(--primary-color);
    width: 100%;
    margin-top: 8px;
}

.custom-input-box .input-box-value:focus {
    outline: none;
    box-shadow: none;
}

.custom-input-box:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 255, 192, 0.3);
}

/* --- Custom Accent Button Styling (for Add/PDF) --- */
.btn-custom-accent {
    display: flex; 
    justify-content: center; /* Horizontal Center */
    align-items: center;

    background-color: var(--accent-color);
    color: var(--primary-color);
    font-family: var(--font-sans);
    font-weight: 600;
    
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    height: 100%; /* For the 'Add' button to match input height */
    border: 2px solid var(--accent-color);
/* --- "Whitewash" Hover Effect --- */
    position: relative; /* Needed for the pseudo-element */
    overflow: hidden;   /* Keeps the wipe effect contained */
    z-index: 1;         /* Ensures button content is above the wipe */
}

/* The white layer that will wipe across the button */
.btn-custom-accent::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--surface-color);
    transform: scaleX(0); /* Start with zero width */
    transform-origin: left;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: -1; /* Place the wipe behind the button's text */
}

.btn-custom-accent:hover::before {
    transform: scaleX(1); /* Expand to full width on hover */
}

.btn-custom-accent:hover {
    border-color: var(--accent-color);
    box-shadow: 4px 4px 0px var(--accent-color);
}

/* --- Visually Captivating Button Loading State --- */
@keyframes loading-wave {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.btn.is-loading {
    /* Create a gradient with a lighter "shine" color in the middle */
    background: linear-gradient(
        90deg, 
        var(--accent-color), 
        #99FFE9, /* A lighter, shinier version of the accent color */
        var(--accent-color)
    );
    background-size: 200% 100%; /* Make the background twice as wide to allow for movement */
    animation: loading-wave 1.5s linear infinite;
    cursor: wait !important; /* Use a wait cursor */
}


.item-list-item {
    /*padding: 8px 0 !important;  Less padding */
    padding: 12px 15px !important;
    display: flex;
    justify-content: space-between;
    align-items: center;    
    background-color: var(--background-color) !important;
    font-family: var(--font-sans);
    border: 1px solid var(--text-muted-color);
    margin-bottom: 10px;
    border-radius: 8px;
}

/* NEW: Style for the "empty list" message */
#emptyMessage {
    color: #B71C1C !important; /* Use the same dark red as alerts */
    font-weight: 500;
}

.food-item-text {
    font-size: 1rem;
    color: var(--primary-color);
    font-family: var(--font-mono);
}

/* for delete button */
.remove-item-btn {
    background-color: var(--activity-button-hover-color);
    color: var(--surface-color);
    border: 2px solid var(--activity-button-hover-color);
    padding: 3px 8px !important;
    font-size: 0.8rem;
    transition: all 0.2s;
    border-radius: 50% !important; /* Keep it circular */
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.remove-item-btn:hover {
    box-shadow: 2px 2px 0px var(--activity-button-hover-color); /* Solid red shadow */
    color: var(--activity-button-hover-color); /* Keep icon red on hover */
    border-color: var(--activity-button-hover-color);
}

/* The white layer that will wipe across the delete button */
.remove-item-btn::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--surface-color);
    transform: scaleX(0); /* Start with zero width */
    transform-origin: left;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: -1; /* Place the wipe behind the button's icon */
}

.remove-item-btn:hover::before {
    transform: scaleX(1); /* Expand to full width on hover */
}


/* Styling for the Print/Save button --- */
#printBtn {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--primary-color);
    background-color: var(--accent-color);
    padding: 5px 10px;
    border-radius: 6px;
    border: 2px solid var(--accent-color);
    transition: all 0.2s ease-in-out;
    /* Add properties for whitewash effect */
    position: relative;
    overflow: hidden;
    z-index: 1;
}

#printBtn:hover {
    box-shadow: 4px 4px 0px var(--accent-color); /* Solid 3D shadow */
    border-color: var(--accent-color) !important; /* Match border */
}

/* Add the pseudo-element for the wipe effect on the Save button */
#printBtn::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--surface-color);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: -1;
}

#printBtn:hover::before {
    transform: scaleX(1);
}

/* --- Footer Styling --- */
footer {
    background-color: var(--surface-color);
    color: var(--text-muted-color);
}

footer a {
    color: var(--primary-color);
    font-weight: 600;
}

footer a:hover {
    color: var(--accent-color);
}




/* --- Macro Bar Chart and Totals Display for HEALTH results --- */
.macro-totals-card {
    background-color: var(--background-color);
    border-radius: 8px;
    padding: 20px !important;
}
.macro-totals-card h4 {
    font-size: 1rem;
    color: var(--text-muted-color);
    text-transform: uppercase;
}
.macro-value {
    font-size: 2rem !important;
    font-family: var(--font-mono);
    margin-bottom: 0;
}
/* --- NEW: Make the total calories value stand out with color --- */
#totalCaloriesValue {
    color: #B71C1C; /* Dark, readable red used in alerts */
    font-size: 3rem !important; /* Make the number larger */
    line-height: 1.1; /* Adjust line height for the larger font */
}

.macro-label {
    font-weight: 600;
    color: var(--text-muted-color);
}

/* New style for centering the total calories display */
.total-calories-display {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

/* New styles for the macro percentage bar */
.macro-bar {
    display: flex;
    height: 24px;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
    background-color: #e0e0e0; /* Fallback background */
}

.bar-segment {
    height: 100%;
    transition: width 0.4s ease-in-out;
    cursor: pointer;
    /* New styles for text inside the bar */
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.8rem;
}

.bar-segment.protein, .color-indicator.protein {
    background-color: #A9D0F5; /* Blue */
}

.bar-segment.carbs, .color-indicator.carbs {
    background-color: #A9F5A9; /* Yellow */
}

.bar-segment.fat, .color-indicator.fat {
    background-color: #F5E0A9; /* Red */
}

.macro-details {
    display: flex;
    justify-content: space-around;
    text-align: center;
}

.macro-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.macro-label {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: var(--text-muted-color);
    margin-bottom: 4px;
}

.color-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
}

/* Error message styling (unchanged) */
.hidden {
    display: none !important;
}

/* --- Standardized Alert/Error Message Styling --- */
.alert-danger {
    background-color: rgba(255, 82, 82, 0.08); /* Softer red background */
    color: #B71C1C; /* Darker, more readable red text */
    border: 1px solid rgba(255, 82, 82, 0.2); /* Subtle red border */
    border-left: 4px solid var(--activity-button-hover-color); /* Prominent left border */
    border-radius: 8px;
    padding: 1rem;
    font-weight: 500;
}
 

/* --- Results Container Styling --- */
#results {
    /* This creates the main box for the output */
    border: 1px solid var(--text-muted-color);
    padding: 30px;
    background-color: var(--surface-color);
    border-radius: 12px; /* Consistent with other cards */
    /*border: 1px solid #EAEAEA;*/
}

/* --- Global Animation for Results Section --- */
@keyframes zoomInAndFade {
    from {
        opacity: 0;
        transform: scale(0.95); /* Start slightly smaller */
    }
    to {
        opacity: 1;
        transform: scale(1); /* End at full size */
    }
}

/* Apply animation when the results are made visible */
#results:not(.hidden) {
    /* Use a faster duration and a custom "snap" easing function */
    animation: zoomInAndFade 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

/* Print-specific styles */
@media print {
    /* Hide everything except the results */
    body * {
        visibility: hidden;
    }

    #results, #results * {
        visibility: visible;
    }

    /* Keep the results container styled, but position it correctly for printing */
    #results {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        border: none !important; /* Remove the main container border for PDF */
        box-shadow: none !important; /* Remove shadow for PDF */
        background-color: transparent !important; /* Remove background for PDF */
    }

    /* Hide elements that are not useful for print */
    #printBtn {
        display: none !important;
    }

    /* --- Force Print Backgrounds --- */
    /* This tells the browser to render background colors and images for printing. */
    .projection-item,
    .macro-totals-card {
        print-color-adjust: exact !important;
        -webkit-print-color-adjust: exact !important; /* For older Chrome/Safari */
    }
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* --- TIME PAGE SPECIFIC STYLES --- */

/* 1. ACTIVITY ITEM in results
   (Inspired by .breakdown-item from style.css) 
*/
#results .activity-item {
    padding: 15px 5px !important; /* Add a little padding */
    border-color: var(--background-color) !important;
    background-color: var(--surface-color) !important;
}
#results .list-group-item:last-child {
    border-bottom: none !important;
}

#results .activity-item h3 {
    font-size: 1.2rem; 
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 5px;
}
#results .activity-item h4 {
    font-size: 0.9rem; 
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 15px;
    margin-bottom: 10px;
    color: var(--text-muted-color);
}
#results .activity-item p.details {
    font-size: 0.9rem;
    color: var(--text-muted-color);
    margin-bottom: 10px;
}

/* 2. TRACKER ELEMENTS (Boxes & Notes)
*/
#results .hours-grid { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 5px; 
    margin-top: 10px; 
    margin-bottom: 10px; 
}
#results .print-hour-box { 
    display: inline-block; 
    width: 20px; 
    height: 20px; 
    border: 2px solid var(--primary-color); 
    margin-right: 8px; 
    margin-bottom: 8px; 
    background-color: var(--surface-color);
}
#results .notes-area { 
    width: 100%; 
    box-sizing: border-box; 
    padding: 10px; 
    border: none;
    resize: none; 
    margin-top: 5px; 
    min-height: 80px;
    font-family: var(--font-mono);
}

/* --- MONEY PAGE: PROJECTION LIST STYLING --- */
.projection-list {
    margin-top: 20px;
}

.projection-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;    
    background-color: #E6FFFA; /* Use the same pastel green from the homepage card #E6F4EA*/
    margin-bottom: 8px; /* Creates space between items */
}

.projection-year { font-weight: 600; }
.projection-amount { font-size: 1.1rem; font-weight: 700; }

/* --- HEALTH PAGE: NEW RESULTS STYLING --- */
.takeaway-card {
    padding: 20px;
    height: 100%; 
    border-radius: 8px;
    background-color: var(--background-color);
}
.takeaway-card .takeaway-title {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 1rem;
    margin-bottom: 15px;
}
.takeaway-card ul {
    padding-left: 20px;
    margin-bottom: 0;
    font-size: 0.9rem;
}
.takeaway-card.positive .takeaway-title { color: #28a745; }
.takeaway-card.improvement .takeaway-title { color: #ffc107; }
.takeaway-card.calculation .takeaway-title { color: #0d6efd; } /* A standard blue for neutrality */

.breakdown-item-new {
    background-color: var(--background-color);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
}
.breakdown-item-new .item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}
.breakdown-item-new .item-name {
    font-weight: 700;
    font-size: 1.1rem;
}
.breakdown-item-new .item-description {
    font-size: 0.9rem;
    color: var(--text-muted-color);
    margin-bottom: 10px;
    font-style: italic;
}
.breakdown-item-new .item-macros {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    font-weight: 600;
}
.breakdown-item-new .item-gi {
    font-size: 0.8rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    color: var(--primary-color);
}
.gi-low { background-color: #A9F5A9; } /* Light Green */
.gi-medium { background-color: #F5E0A9; } /* Light Yellow */
.gi-high { background-color: #F5BCA9; } /* Light Red */

/* New styles for the itemized breakdown macro bar */
.item-macro-bar {
    display: flex;
    height: 12px; /* Smaller height for a more compact look */
    width: 100%;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 8px;
    background-color: #e9ecef; /* A light background */
}

.item-bar-segment {
    height: 100%;
    transition: width 0.3s ease-in-out;
}

.item-bar-segment.protein { background-color: #A9D0F5; }
.item-bar-segment.carbs { background-color: #A9F5A9; }
.item-bar-segment.fat { background-color: #F5E0A9; }

/* Ensure new elements are visible for printing */
@media print {
    .takeaway-card, .breakdown-item-new, .health-disclaimer {
        print-color-adjust: exact !important;
        -webkit-print-color-adjust: exact !important;
    }
}

.health-disclaimer {
    background-color: var(--background-color);
}

/* --- HOME PAGE: FEATURE CARDS --- */
.feature-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

.feature-card {
    background-color: var(--surface-color);
    border: 1px solid #EAEAEA;
    border-radius: 12px;
    padding: 25px;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    border-color: var(--accent-color);
}

.feature-card-title {
    font-weight: 700;
    margin-bottom: 15px;
}
.feature-card-description {
    font-size: 0.95rem;
    color: var(--text-muted-color);
    flex-grow: 1; /* Pushes the CTA down */
}

/* --- HOME PAGE: CARD COLORS --- */
.feature-card-health {
    background-color: #E6E6FA; /* Soft Pastel Peach */
}
.feature-card-money {
    background-color: #dae9e0; /* Muted Pastel Green */
}
.feature-card-time {
    background-color: #CCEEFF; /* Gentle Pastel Blue #E3F2FD  */
}

/* --- HOME PAGE: LAUNCH TOOL CTA --- */
.feature-card-cta {
    font-weight: 700;
    color: var(--primary-color);
    background-color: rgba(0,0,0,0.05);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.1); /* Subtle border to define the button */
    display: inline-block;
    align-self: flex-start; /* Ensures it doesn't stretch full width */
    transition: all 0.2s ease-in-out;
}

.feature-card:hover .feature-card-cta {
    box-shadow: 4px 4px 0px var(--accent-color); /* Solid 3D shadow */
    background-color: var(--primary-color); /* Dark background on hover */
    color: var(--surface-color); /* Light text on hover */
    border-color: var(--primary-color); /* Match border to background */
}
/* --- NEW: Arrow animation for CTA --- */
.cta-arrow {
    display: inline-block;
    transition: transform 0.2s ease-in-out;
}

.feature-card:hover .cta-arrow {
    transform: translateX(5px);
}

.feature-card-health .feature-card-title i { color: #B71C1C; } /* Dark Red */
.feature-card-time .feature-card-title i { color: #0D47A1; } /* Dark Blue */
.feature-card-money .feature-card-title i { color: #1B5E20; } /* Dark Green */

/* --- NEW: Keyframes to fade in the accent color background --- */
@keyframes fadeInAccent {
    from {
        background-color: rgba(0,0,0,0.05); /* Start with default color */
    }
    to {
        background-color: var(--accent-color); /* End on accent color */
    }
}

/* --- NEW: Keyframes for a smooth "shine" animation on pack buttons --- */
@keyframes shine-sweep {
    0% {
        transform: translateX(-100%) skewX(-25deg);
    }
    100% {
        transform: translateX(250%) skewX(-25deg);
    }
}


/* --- TIME PAGE: HABIT PACK BUTTONS --- */
.btn-habit-pack {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--primary-color);
    background-color: rgba(0,0,0,0.05);
    padding: 8px 12px;
    border-radius: 6px;
    /*border: 1px solid rgba(0,0,0,0.1);*/
    transition: all 0.2s ease-in-out;
    /* NEW: Apply the background fade-in. It runs for 0.4s after a 2.25s delay
       (which is after the shine sweep finishes) and holds the final state. */
    animation: fadeInAccent 0.4s ease-out 1 2.25s forwards;
    /* Add relative positioning and overflow for the shine effect */
    position: relative;
    overflow: hidden;
}

/* The pseudo-element that creates the shine */
.btn-habit-pack::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, rgba(0, 255, 234, 0) 0%, rgba(0, 255, 234, 0.5) 50%, rgba(0, 255, 234, 0) 100%);
    /* NEW: Apply the shine animation and use 'forwards' to keep it at its end state (off-screen). */
    /* Set the initial state to be off-screen to prevent the initial "tinge" */
    transform: translateX(-100%) skewX(-25deg);
    animation: shine-sweep 1.5s ease-in-out 1 0.75s forwards;
    opacity: 0.8;
}

.btn-habit-pack:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}
