:root {
    --bg-color: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --success-hover: #059669;
    --error: #ef4444;
    
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

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

/* Background Blobs for Modern Aesthetic */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.6;
    animation: float 20s infinite alternate;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: #3b82f6;
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 40vw;
    height: 40vw;
    background: #8b5cf6;
    animation-delay: -5s;
}

.blob-3 {
    top: 40%;
    left: 50%;
    width: 30vw;
    height: 30vw;
    background: #10b981;
    animation-delay: -10s;
}

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

.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.icon-btn:hover {
    transform: rotate(45deg);
}

/* Glass Panels */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--glass-shadow);
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

/* Forms & Inputs */
.input-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 600px) {
    .input-row {
        flex-direction: column;
    }
}

.input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

input {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.2s ease;
}

input:focus {
    border-color: var(--accent);
}

/* Buttons */
button {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.primary-btn {
    background: var(--accent);
    color: white;
    width: 100%;
}

.primary-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.success-btn {
    background: var(--success);
    color: white;
    flex: 1;
}

.success-btn:hover {
    background: var(--success-hover);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    flex: 1;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.small-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    flex: none;
}

/* Loader */
.loader {
    border: 3px solid rgba(255,255,255,0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

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

.hidden {
    display: none !important;
}

/* Result Section */
.result-section {
    border: 1px solid var(--accent);
    background: rgba(59, 130, 246, 0.1);
}

.macro-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 600px) {
    .macro-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

.macro-card {
    background: rgba(15, 23, 42, 0.6);
    padding: 1rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    border-top: 4px solid;
}

.macro-card.calories { border-color: #f59e0b; }
.macro-card.protein { border-color: #3b82f6; }
.macro-card.carbs { border-color: #8b5cf6; }
.macro-card.fat { border-color: #ef4444; }

.macro-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.macro-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.action-buttons {
    display: flex;
    gap: 1rem;
}

/* Report Section */
.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.daily-summary {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
}

@media (max-width: 600px) {
    .daily-summary {
        flex-direction: column;
    }
}

.calories-progress {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: conic-gradient(var(--accent) 0%, rgba(255,255,255,0.1) 0%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

.calories-progress::before {
    content: '';
    position: absolute;
    width: 130px;
    height: 130px;
    background: var(--bg-color);
    border-radius: 50%;
}

.summary-value, .summary-label {
    position: relative;
    z-index: 1;
}

.summary-value {
    font-size: 1.75rem;
    font-weight: 700;
}

.summary-label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.chart-tooltip {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 10;
    pointer-events: none;
    box-shadow: var(--glass-shadow);
}

.circular-progress:hover .chart-tooltip {
    opacity: 1;
    visibility: visible;
    top: -50px;
}

.summary-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 8px;
    border-left: 4px solid;
}

.detail-row.protein { border-color: #3b82f6; }
.detail-row.carbs { border-color: #8b5cf6; }
.detail-row.fat { border-color: #ef4444; }

/* Food List */
.food-list {
    margin-top: 1rem;
}

#food-list-container {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

#food-list-container li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.4);
    padding: 1rem;
    border-radius: 8px;
    transition: transform 0.2s ease;
}

#food-list-container li:hover {
    transform: translateX(5px);
    background: rgba(255, 255, 255, 0.05);
}

.food-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.food-name-display {
    font-weight: 600;
}

.food-volume-display {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.food-macros-display {
    text-align: right;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.food-macros-display strong {
    color: var(--text-main);
    font-size: 1rem;
    display: block;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    width: 90%;
    max-width: 400px;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.close-btn:hover {
    color: white;
}

.modal-content p {
    margin-bottom: 1.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.5;
}

.success-text {
    color: var(--success);
    margin-top: 1rem;
    text-align: center;
    font-weight: 500;
}

.error-text {
    color: var(--error);
    margin-top: 1rem;
    font-size: 0.875rem;
    text-align: center;
}

/* Modern Range Slider */
.modern-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 4px;
    outline: none;
    padding: 0;
    margin: 0;
    border: 1px solid var(--glass-border);
}

.modern-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
    transition: transform 0.1s;
}

.modern-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    background: #60a5fa;
}

.modern-slider::-webkit-slider-thumb:active {
    transform: scale(1.05);
}

.modern-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
    border: none;
}
