:root {
    --primary-color: #6c5ce7;
    --secondary-color: #a29bfe;
    --accent-color: #00b894;
    --background-color: #dfe6e9;
    --card-bg: #ffffff;
    --text-color: #2d3436;
    --warning-color: #d63031;
    --cool-color: #0984e3;
    --winning-color: #fdcb6e;
    --font-family: 'Inter', 'Noto Sans KR', sans-serif;
}

body {
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--text-color);
    min-height: 100vh;
}

header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

header .logo {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

header nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

header nav a {
    text-decoration: none;
    color: #636e72;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.3s;
}

header nav a:hover {
    color: var(--primary-color);
}

.lang-switch {
    font-size: 0.8rem;
    margin-right: 10px;
}

.lang-switch a {
    margin: 0 2px;
}

main {
    max-width: 1200px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}

.dashboard {
    display: grid;
    grid-template-columns: 1fr;
    gap: calc(1.5rem + 5px);
}

@media (min-width: 768px) {
    .dashboard {
        grid-template-columns: 1fr 2fr;
    }

    .summary {
        grid-column: 1 / -1;
    }
}

@media (min-width: 1024px) {
    .dashboard {
        grid-template-columns: 350px 1fr;
    }

    .summary {
        grid-column: 1 / 2;
        grid-row: 1 / 2;
    }

    .calendar-container {
        grid-column: 2 / -1;
        grid-row: 1 / 3;
    }

    .details-container {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
    }
}

.card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
}

h2,
h3 {
    margin-top: 0;
    color: var(--text-color);
}

.stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    background: #f1f2f6;
    padding: 15px;
    border-radius: 12px;
}

.stat {
    text-align: center;
}

.stat .label {
    display: block;
    font-size: 0.75rem;
    color: #b2bec3;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat .value {
    font-size: 1.25rem;
    font-weight: 800;
}

.stat.warning .value {
    color: var(--warning-color);
}

.stat.good .value {
    color: var(--accent-color);
}

.alert {
    color: var(--warning-color);
    font-size: 0.7rem;
    font-weight: bold;
    margin-top: 5px;
}

.upload-section {
    border-top: 1px solid #f1f2f6;
    padding-top: 1.5rem;
}

.manual-toggle {
    margin-bottom: 15px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #636e72;
}

.upload-section input[type="file"],
.upload-section input[type="text"],
.upload-section input[type="number"],
.upload-section select {
    display: block;
    width: 100%;
    margin: 10px 0;
    padding: 12px;
    border: 2px solid #f1f2f6;
    border-radius: 8px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

.upload-section input:focus,
.upload-section select:focus {
    border-color: var(--primary-color);
    outline: none;
}

.upload-section button {
    width: 100%;
    padding: 14px;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
    transition: transform 0.2s;
}

.upload-section button:active {
    transform: scale(0.98);
}

/* Calendar Styling Override */
.fc-event {
    cursor: pointer;
    text-align: center;
    border: none !important;
    border-radius: 4px;
    font-size: 0.8rem;
    padding: 2px;
}

.status-warning {
    background-color: #fab1a0 !important;
    color: #d63031 !important;
}

.status-cool {
    background-color: #81ecec !important;
    color: #00b894 !important;
}

.status-winning {
    background-color: #ffeaa7 !important;
    color: #e17055 !important;
}

/* Food List */
.food-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 8px;
    background: white;
    transition: box-shadow 0.2s;
    position: relative;
    /* For swipe actions */
    overflow: hidden;
    /* For swipe actions */
    height: 85px;
    /* Fixed height for consistency */
}

.food-item:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}



.food-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 10px;
    margin-right: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.food-item .info {
    flex-grow: 1;
}

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

.food-item .info span {
    font-size: 0.8rem;
    color: #b2bec3;
}

.food-item .cal {
    font-weight: 800;
    color: var(--primary-color);
    font-size: 1.1rem;
}

/* Swipe Actions */
.swipe-actions {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 160px;
    /* 2 buttons * 80px */
    display: flex;
    z-index: 1;
}

.swipe-btn {
    width: 80px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: background 0.2s;
}

.edit-action {
    background-color: #f1f2f6;
    color: #0984e3;
}

.edit-action:hover {
    background-color: #e1e2e6;
}

.delete-action {
    background-color: #f1f2f6;
    color: #d63031;
}

.delete-action:hover {
    background-color: #e1e2e6;
}

.food-item-content {
    position: relative;
    z-index: 2;
    background: white;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 12px;
    box-sizing: border-box;
    transition: transform 0.3s ease-out;
}

/* Progress Bar */
.progress-bar-bg {
    width: 100%;
    background-color: #d1d8e0;
    /* Slightly darker than page bg */
    border-radius: 10px;
    height: 20px;
    margin-top: 10px;
    overflow: hidden;
    position: relative;
    /* Ensure stacking context */
}

.progress-bar-fill {
    display: block;
    /* Ensure it renders */
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 0%;
    text-align: center;
    line-height: 20px;
    color: white;
    font-size: 12px;
    transition: width 0.3s ease;
}

/* Spinner Animation */
/* Spinner Animation */
.spinner {
    animation: spin 1s linear infinite;
    display: inline-block !important;
    vertical-align: middle;
    /* Font Based Icon Fixes */
    font-family: 'Material Icons';
    font-weight: normal;
    font-style: normal;
    font-size: 24px !important;
    width: 24px !important;
    height: 24px !important;
    line-height: 24px !important;
    text-align: center;
    margin-right: 5px;
    color: var(--primary-color);
    overflow: visible;
}

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

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

/* Review Section Styles */
.review-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f2f6;
}

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

.review-name {
    flex-grow: 1;
    padding: 8px !important;
    margin: 0 !important;
    font-size: 0.95rem;
}

.review-cal {
    width: 70px !important;
    padding: 8px !important;
    margin: 0 !important;
    text-align: center;
    font-size: 0.95rem;
}

.remove-btn {
    width: 30px !important;
    height: 30px;
    padding: 0 !important;
    background: #fab1a0 !important;
    color: #d63031 !important;
    border-radius: 50% !important;
    font-size: 12px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none !important;
}

.add-item-btn {
    margin-top: 15px;
    background: #dfe6e9 !important;
    color: #636e72 !important;
    box-shadow: none !important;
}

.total-cal-display {
    text-align: right;
    font-weight: bold;
    margin: 15px 0;
    font-size: 1.1rem;
    color: var(--primary-color);
}

/* Mobile Optimization */
@media (max-width: 480px) {
    header {
        flex-direction: column;
        align-items: flex-start;
    }

    header nav {
        margin-top: 10px;
        width: 100%;
        justify-content: space-between;
    }

    .stats {
        padding: 10px;
    }

    .stat .value {
        font-size: 1rem;
    }

    .card {
        padding: 1rem;
    }
}

.hidden-input {
    display: none;
}

/* Meal Group & Feedback Styles */
.meal-group {
    margin-bottom: 25px;
    animation: fadeIn 0.3s ease;
}

.feedback-card {
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
    color: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.feedback-card.status-good {
    background: linear-gradient(135deg, #00b894, #55efc4);
}

.feedback-card.status-soso {
    background: linear-gradient(135deg, #fdcb6e, #ffeaa7);
    color: #2d3436;
}

.feedback-card.status-bad {
    background: linear-gradient(135deg, #d63031, #ff7675);
}

.feedback-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.feedback-header.simple {
    background: #f1f2f6;
    padding: 10px;
    border-radius: 8px;
    color: #2d3436;
    margin-bottom: 10px;
}

.meal-badge {
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.time-badge {
    font-size: 0.8rem;
    opacity: 0.8;
}

.status-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
}

.feedback-text {
    font-size: 0.9rem;
    margin-bottom: 4px;
    line-height: 1.4;
}

.feedback-text.advice {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* Fix Progress Container Visibility */
#progress-container {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-top: 15px;
    z-index: 999;
    position: relative;
    text-align: center;
}

#progress-text {
    margin-top: 10px;
    font-weight: 600;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}