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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
}

.upload-section {
    text-align: center;
    margin-bottom: 20px;
}

.meal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
}

.meal-btn {
    padding: 10px 20px;
    border: 2px solid #e9ecef;
    border-radius: 20px;
    background: white;
    color: #666;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.meal-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: #667eea;
    transform: scale(1.05);
}

.meal-btn:hover {
    border-color: #667eea;
}

.meal-select {
    padding: 12px 20px;
    border: 2px solid #667eea;
    border-radius: 25px;
    font-size: 16px;
    margin-right: 10px;
    background: white;
    color: #667eea;
    cursor: pointer;
}

#imageInput {
    display: none;
}

.upload-btn {
    display: inline-block;
    padding: 15px 40px;
    background: #667eea;
    color: white;
    border-radius: 50px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.upload-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.preview img {
    width: 100%;
    border-radius: 10px;
    margin-bottom: 20px;
}

.result {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.food-item {
    background: white;
    padding: 15px;
    margin: 10px 0;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.tabs {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

.tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.tab.active {
    background: #667eea;
    color: white;
}

.tab-content {
    display: none;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.tab-content.active {
    display: block;
}

.daily-summary {
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: 10px;
    margin-bottom: 15px;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.3s;
}

.history-item {
    background: white;
    padding: 15px;
    margin: 10px 0;
    border-radius: 8px;
}

.goal-form input {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
}

.goal-form select {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    cursor: pointer;
}

.goal-form input:focus,
.goal-form select:focus {
    outline: none;
    border-color: #667eea;
}

.goal-form button {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
    transition: transform 0.2s;
}

.goal-form button:hover {
    transform: translateY(-2px);
}

.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(102, 126, 234, 0.95);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.scan-line {
    position: absolute;
    width: 80%;
    height: 3px;
    background: linear-gradient(90deg, transparent, white, transparent);
    box-shadow: 0 0 20px white;
    animation: scan 2s ease-in-out infinite;
}

@keyframes scan {
    0% { top: 20%; }
    50% { top: 80%; }
    100% { top: 20%; }
}

.loading-text {
    color: white;
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    z-index: 1;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    max-width: 400px;
    width: 90%;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #667eea;
}

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 20px 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 10001;
    animation: slideDown 0.3s ease;
}

.toast.success {
    border-left: 5px solid #4caf50;
}

.toast.error {
    border-left: 5px solid #f44336;
}

@keyframes slideDown {
    from {
        transform: translateX(-50%) translateY(-100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}
