* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #E8F5E9;
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    min-height: 100vh;
    position: relative;
    padding-bottom: 100px;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background-color: #E8F5E9;
    position: sticky;
    top: 0;
    z-index: 100;
}

.back-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #000;
    cursor: pointer;
    padding: 8px;
    margin-right: 12px;
}

.header-title {
    font-size: 20px;
    font-weight: 600;
    color: #000;
    flex: 1;
    text-align: center;
    margin-right: 40px;
}

/* Cards */
.card {
    background-color: #FFFFFF;
    border-radius: 16px;
    padding: 20px;
    margin: 16px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.card-header {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.card-icon {
    color: #00897B;
    font-size: 20px;
    margin-right: 12px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: #000;
    flex: 1;
}

.date-text {
    font-size: 14px;
    color: #000;
}

/* Food Analysis Card */
.button-group {
    display: flex;
    gap: 12px;
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    background-color: #F5F5F5;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    color: #000;
    cursor: pointer;
    transition: background-color 0.2s;
}

.action-btn:hover {
    background-color: #E0E0E0;
}

.action-btn:active {
    background-color: #D0D0D0;
}

.action-btn i {
    font-size: 18px;
}

/* Summary Card */
.calories-section {
    margin-bottom: 20px;
}

.calories-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.calories-label {
    font-size: 16px;
    color: #000;
    font-weight: 500;
}

.calories-value {
    font-size: 16px;
    color: #000;
    font-weight: 600;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #E0E0E0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: #4FC3F7;
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.macros-section {
    display: flex;
    gap: 12px;
}

.macro-box {
    flex: 1;
    background-color: #FFFFFF;
    border: 1px solid #E0E0E0;
    border-radius: 12px;
    padding: 16px 12px;
    text-align: center;
}

.macro-value {
    font-size: 24px;
    font-weight: 700;
    color: #000;
    margin-bottom: 4px;
}

.macro-percentage {
    font-size: 14px;
    color: #000;
}

.carbs-percentage {
    color: #00897B;
}

.fats-percentage {
    color: #E53935;
}

/* Scanner Section */
.scanner-section {
    padding: 0 20px;
    margin-top: 16px;
}

.scanner-header {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.scanner-icon {
    color: #000;
    font-size: 20px;
    margin-right: 12px;
}

.scanner-title {
    font-size: 18px;
    font-weight: 600;
    color: #000;
    flex: 1;
}

.info-btn {
    background: none;
    border: none;
    color: #2196F3;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
}

.scanner-card {
    background-color: #FFFFFF;
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
}

.scanner-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.scanner-main-icon {
    color: #00897B;
    font-size: 48px;
    margin-bottom: 16px;
}

.scanner-subtitle {
    font-size: 20px;
    font-weight: 600;
    color: #000;
    margin-bottom: 8px;
}

.scanner-description {
    font-size: 14px;
    color: #757575;
}

.food-image-preview {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin-top: 20px;
}

.food-image-preview img {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: 12px;
}

.remove-image-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
}

/* Analyze Button */
.analyze-btn {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    padding: 18px 20px;
    background-color: #FFFFFF;
    border: none;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 600;
    color: #000;
    cursor: pointer;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    z-index: 50;
    transition: background-color 0.2s;
}

.analyze-btn:hover:not(:disabled) {
    background-color: #F5F5F5;
}

.analyze-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.analyze-btn i {
    font-size: 18px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    color: white;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay p {
    font-size: 16px;
    margin-top: 12px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background-color: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    width: 100%;
    max-width: 500px;
}

.close-modal {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    color: #757575;
    cursor: pointer;
    padding: 4px;
}

.modal-content h2 {
    font-size: 22px;
    margin-bottom: 20px;
    color: #000;
}

.nutrition-item {
    padding: 12px 0;
    border-bottom: 1px solid #E0E0E0;
}

.nutrition-item:last-child {
    border-bottom: none;
}

.nutrition-item-label {
    font-size: 16px;
    color: #757575;
    margin-bottom: 4px;
}

.nutrition-item-value {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
}

.food-name {
    font-size: 26px;
    font-weight: 800;
    color: #00897B;
    margin-bottom: 24px;
    text-align: center;
    letter-spacing: -0.5px;
}

/* Portion Selector */
.portion-selector {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    border: 1px solid #e9ecef;
}

.portion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.portion-label {
    font-weight: 600;
    color: #495057;
    font-size: 15px;
}

.portion-input-wrapper {
    display: flex;
    align-items: center;
    background: white;
    padding: 4px 12px;
    border-radius: 8px;
    border: 2px solid #00897B;
}

.portion-input-wrapper input {
    width: 60px;
    border: none;
    outline: none;
    font-size: 18px;
    font-weight: 700;
    text-align: right;
    color: #00897B;
}

.portion-unit {
    margin-left: 4px;
    font-weight: 600;
    color: #adb5bd;
}

.portion-slider {
    width: 100%;
    height: 6px;
    background: #dee2e6;
    border-radius: 5px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    margin: 10px 0;
}

.portion-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: #00897B;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Confirm Button */
.confirm-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #00897B, #00bfa5);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0, 137, 123, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 137, 123, 0.4);
}

.confirm-btn:active {
    transform: translateY(0);
}

.source-tag {
    text-align: center;
    font-size: 12px;
    color: #adb5bd;
    margin-top: 15px;
    font-style: italic;
}

/* Responsive Design */
@media (min-width: 768px) {
    .container {
        max-width: 480px;
        margin: 0 auto;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    }

    body {
        background-color: #F5F5F5;
        padding: 20px 0;
    }
}

@media (max-width: 480px) {
    .card {
        margin: 12px 16px;
        padding: 16px;
    }

    .scanner-section {
        padding: 0 16px;
    }

    .header {
        padding: 12px 16px;
    }
}