:root {
    --bg-color: #f0f4f8;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(14, 165, 233, 0.2);
    --glass-shadow: 0 10px 40px rgba(14, 165, 233, 0.08);
    --accent-primary: #0ea5e9;
    --accent-hover: #0284c7;
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.3);
    --warning: #f59e0b;
    --chart-container-height: 250px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Animations - Futuristic Light */
.bg-animated {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background: #f8fafc;
    /* Futuristic grid lines */
    background-image: 
        linear-gradient(rgba(14, 165, 233, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(14, 165, 233, 0.03) 1px, transparent 1px);
    background-size: 30px 30px;
}

.blob {
    position: absolute;
    filter: blur(100px);
    border-radius: 50%;
    opacity: 0.4;
    animation: float 25s infinite alternate ease-in-out;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 600px;
    height: 600px;
    background: #38bdf8; /* light blue */
    animation-delay: 0s;
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: #818cf8; /* indigo */
    animation-delay: -5s;
}

.blob-3 {
    top: 30%;
    left: 40%;
    width: 400px;
    height: 400px;
    background: #34d399; /* emerald */
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(50px, -50px) scale(1.1); }
    66% { transform: translate(-30px, 30px) scale(0.9); }
    100% { transform: translate(0, 0) scale(1); }
}

/* Layout Elements */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.glass-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--glass-shadow);
    animation: fadeInDown 0.8s ease-out forwards;
    position: relative;
    overflow: hidden;
}

.glass-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 4px;
    background: linear-gradient(90deg, #0ea5e9, #34d399);
}

.glass-header h1 {
    font-size: 3.5rem;
    font-weight: 700;
    letter-spacing: -1px;
    background: linear-gradient(to right, #0ea5e9, #6366f1, #10b981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.glass-header p {
    color: var(--text-secondary);
    font-size: 1.2rem;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.grid-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 850px) {
    .grid-layout {
        grid-template-columns: 1fr;
    }
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--glass-shadow);
    margin-bottom: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
    position: relative;
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 50px rgba(14, 165, 233, 0.15);
    border-color: rgba(14, 165, 233, 0.4);
}

.left-column .glass-card:nth-child(1) { animation-delay: 0.1s; }
.left-column .glass-card:nth-child(2) { animation-delay: 0.2s; }
.right-column .glass-card { animation-delay: 0.3s; }

h2 {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

h2::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-primary);
}

/* Input Section */
.input-wrapper {
    position: relative;
    display: flex;
    gap: 1rem;
}

input[type="text"], input[type="number"] {
    flex: 1;
    padding: 1.2rem 1.5rem;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(14, 165, 233, 0.2);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.02);
}

input[type="text"]:focus, input[type="number"]:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
}

.btn-primary {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #0ea5e9, #3b82f6);
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.5);
}

.btn-primary:active {
    transform: translateY(1px);
}

.suggestions {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: calc(100% - 140px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 10;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.suggestions.hidden {
    display: none;
}

.suggestion-item {
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: rgba(14, 165, 233, 0.1);
}

.suggestion-cal {
    color: var(--accent-primary);
    font-size: 0.9rem;
    font-weight: 600;
}

/* History Section */
.food-list {
    list-style: none;
    max-height: 350px;
    overflow-y: auto;
    padding-right: 5px;
}

.food-list::-webkit-scrollbar {
    width: 6px;
}
.food-list::-webkit-scrollbar-thumb {
    background: rgba(14, 165, 233, 0.3);
    border-radius: 3px;
}

.food-list li {
    padding: 1.2rem;
    background: white;
    border-radius: 12px;
    margin-bottom: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    animation: slideInLeft 0.3s ease-out forwards;
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
}

.food-list li:hover {
    border-color: rgba(14, 165, 233, 0.3);
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.1);
    transform: translateX(5px);
}

.empty-state {
    color: var(--text-secondary);
    text-align: center;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    font-style: italic;
}

.food-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.food-details {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.food-item-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.remove-btn {
    background: transparent;
    border: none;
    color: #cbd5e1;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 0.5rem;
    transition: color 0.2s, transform 0.2s;
    margin-left: 10px;
}

.remove-btn:hover {
    color: var(--danger);
    transform: scale(1.2);
}

/* Dashboard Section */

.chart-container {
    height: var(--chart-container-height);
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.mt-2 {
    margin-top: 1rem;
}

.nutrient-tracker {
    margin-bottom: 1.5rem;
}

.nutrient-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.nutrient-header span:last-child {
    color: var(--text-secondary);
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

.progress-bar-bg {
    height: 10px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.progress-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
}

/* Neon vibrant gradients for progress bars on light bg */
.cal-fill { background: linear-gradient(90deg, #38bdf8, #0ea5e9); }
.protein-fill { background: linear-gradient(90deg, #818cf8, #6366f1); }
.fat-fill { background: linear-gradient(90deg, #fcd34d, #f59e0b); }
.carbs-fill { background: linear-gradient(90deg, #34d399, #10b981); }
.sugar-fill { background: linear-gradient(90deg, #f472b6, #ec4899); }
.sodium-fill { background: linear-gradient(90deg, #fdba74, #f97316); }

.over-limit {
    background: linear-gradient(90deg, #f87171, #ef4444) !important;
    animation: pulseDanger 2s infinite;
    box-shadow: 0 0 10px var(--danger-glow);
}

.text-danger {
    color: #ef4444 !important;
    font-weight: bold !important;
}

/* Alerts Section */
.alerts-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.alert-card {
    background: rgba(254, 226, 226, 0.8);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-left: 4px solid #ef4444;
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    animation: slideInRight 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.1);
}

.alert-icon {
    font-size: 1.8rem;
    line-height: 1;
}

.alert-content h3 {
    color: #b91c1c;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.alert-content p {
    color: #7f1d1d;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Modal Styling */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(10px);
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    position: relative;
    transform: translateY(0);
    transition: transform 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

.modal.hidden .modal-content {
    transform: translateY(-50px);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
    line-height: 1;
}

.close-modal:hover {
    color: var(--danger);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Animations */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pulseDanger {
    0% { opacity: 1; box-shadow: 0 0 10px var(--danger-glow); }
    50% { opacity: 0.8; box-shadow: 0 0 20px rgba(239, 68, 68, 0.6); }
    100% { opacity: 1; box-shadow: 0 0 10px var(--danger-glow); }
}

/* Spinner */
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(14, 165, 233, 0.2);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* AI Analysis Cards */
.analysis-card {
    padding: 1.2rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    border-left: 5px solid transparent;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
}

.disease-card {
    border-left-color: #ef4444;
    background: linear-gradient(to right, rgba(239, 68, 68, 0.05), transparent);
}

.disease-card h4 {
    color: #b91c1c;
    margin-bottom: 0.5rem;
    font-size: 1.05rem;
}

.disease-card p {
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.alternative-card {
    border-left-color: #10b981;
    background: linear-gradient(to right, rgba(16, 185, 129, 0.05), transparent);
}

.alternative-card h4 {
    color: #047857;
    margin-bottom: 0.5rem;
    font-size: 1.05rem;
}

.alternative-card p {
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.5;
}
