:root {
    --bg-color: #0d0e15;
    --text-color: #e2e8f0;
    --heading-color: #ffffff;
    --accent-color: #8b5cf6;
    --accent-hover: #a78bfa;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --card-bg: rgba(15, 23, 42, 0.6);
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', -apple-system, sans-serif;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
    line-height: 1.6;
}

/* Animated Background Orbs */
.background-orbs {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s infinite ease-in-out;
}
.orb-1 {
    top: -10%; left: -10%;
    width: 50vw; height: 50vw;
    background: radial-gradient(circle, rgba(139,92,246,0.3) 0%, transparent 70%);
}
.orb-2 {
    bottom: -10%; right: -10%;
    width: 60vw; height: 60vw;
    background: radial-gradient(circle, rgba(16,185,129,0.2) 0%, transparent 70%);
    animation-delay: -5s;
}

@keyframes float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(30px) scale(1.05); }
}

/* Layout */
.container {
    max-width: 1000px;
    margin: 40px auto;
    padding: 40px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

h1 {
    color: var(--heading-color);
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 20px;
    background: linear-gradient(to right, #a855f7, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2, h3 {
    color: var(--heading-color);
}

nav {
    display: flex;
    justify-content: center;
    gap: 15px;
}

nav a {
    color: var(--text-color);
    text-decoration: none;
    padding: 10px 24px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

nav a.active, nav a:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.4);
    color: #fff;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}

/* Dashboard & Cards */
.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 20px;
}

.header-actions h2 {
    margin: 0;
    font-size: 1.8rem;
}

.btn-run {
    background: linear-gradient(135deg, var(--accent-color), #6d28d9);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-run:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px var(--accent-color);
    background: linear-gradient(135deg, var(--accent-hover), var(--accent-color));
}

.btn-run:active {
    transform: translateY(0);
}

.icon.spin {
    animation: spin 1s linear infinite;
    display: inline-block;
}

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

.grid-container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 25px;
}

@media (max-width: 768px) {
    .grid-container {
        grid-template-columns: 1fr;
    }
    .header-actions {
        flex-direction: column;
        gap: 20px;
        align-items: flex-start;
    }
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 25px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    border-color: rgba(255,255,255,0.15);
}

.meal-card h3, .ai-card h3 {
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.empty-card {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

/* Markdown AI Report Styling */
.markdown-body {
    font-size: 15px;
    color: #cbd5e1;
}

.markdown-body h3 {
    margin-top: 25px;
    color: var(--accent-hover);
    font-size: 1.3rem;
}

.markdown-body ul {
    padding-left: 20px;
}

.markdown-body li {
    margin-bottom: 10px;
}

.markdown-body strong {
    color: #f8fafc;
    background: rgba(255,255,255,0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

/* History Page */
.history-title {
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--glass-border);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.history-card {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-header h3 {
    margin: 0;
}

.badge {
    background: rgba(139, 92, 246, 0.2);
    color: var(--accent-hover);
    border: 1px solid rgba(139, 92, 246, 0.3);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.meal-details summary {
    cursor: pointer;
    font-weight: 600;
    color: #94a3b8;
    user-select: none;
    padding: 10px 0;
    transition: color 0.3s;
}

.meal-details summary:hover {
    color: var(--text-color);
}

.meal-content-small {
    padding: 15px;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    margin-top: 10px;
    font-size: 0.9rem;
    color: #94a3b8;
}
