/* 기본 리셋 및 변수 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4CAF50;
    --primary-dark: #388E3C;
    --primary-light: #81C784;
    --secondary-color: #FF9800;
    --secondary-dark: #F57C00;
    --accent-color: #2196F3;
    --text-primary: #212121;
    --text-secondary: #757575;
    --text-light: #BDBDBD;
    --background: #FAFAFA;
    --surface: #FFFFFF;
    --error: #F44336;
    --success: #4CAF50;
    --warning: #FF9800;
    --border-radius: 12px;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 헤더 */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 2rem 0;
    text-align: center;
    box-shadow: var(--shadow);
}

.logo {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.logo i {
    color: var(--secondary-color);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* 메인 컨텐츠 */
.main {
    padding: 3rem 0;
    min-height: calc(100vh - 200px);
}

/* 버튼 스타일 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

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

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: var(--secondary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

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

/* 업로드 섹션 */
.upload-section {
    margin-bottom: 3rem;
}

.upload-container {
    max-width: 600px;
    margin: 0 auto;
}

.upload-area {
    background: var(--surface);
    border: 3px dashed var(--primary-light);
    border-radius: var(--border-radius);
    padding: 3rem 2rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: #f8fff8;
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: #f0fff0;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.upload-content h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.upload-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.upload-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* 미리보기 섹션 */
.preview-section {
    margin-bottom: 3rem;
}

.preview-container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.preview-container h3 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.image-preview {
    text-align: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.image-preview .btn {
    margin: 0.5rem;
}

/* 로딩 섹션 */
.loading-section {
    margin-bottom: 3rem;
}

.loading-container {
    max-width: 400px;
    margin: 0 auto;
    text-align: center;
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 3rem 2rem;
    box-shadow: var(--shadow);
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--primary-light);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

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

.loading {
    display: inline-block;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border-radius: var(--border-radius);
    font-weight: 500;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.loading-container h3 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.loading-container p {
    color: var(--text-secondary);
}

/* 결과 섹션 */
.result-section {
    margin-bottom: 3rem;
}

.result-container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.result-container h3 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.food-info {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
}

.food-info h4 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.confidence {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.nutrition-info {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
}

.calorie-display {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.nutrition-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.nutrition-item {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: var(--border-radius);
    text-align: center;
}

.nutrition-item .label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.nutrition-item .value {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.daily-intake {
    margin-bottom: 2rem;
}

.daily-intake h4 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    transition: width 0.5s ease;
    width: 0%;
}

.intake-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.intake-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

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

.percentage {
    text-align: center;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* 기록 섹션 */
.history-section {
    margin-bottom: 3rem;
}

.history-container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.history-container h3 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.history-list {
    display: grid;
    gap: 1rem;
}

.history-item {
    background: #f8f9fa;
    border-radius: var(--border-radius);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}

.history-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.history-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
}

.history-info {
    flex: 1;
}

.history-food-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.history-calorie {
    color: var(--primary-color);
    font-weight: 500;
}

.history-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* 푸터 */
.footer {
    background: var(--text-primary);
    color: white;
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    margin-bottom: 1rem;
    color: var(--primary-light);
}

.data-sources, .accuracy-info {
    display: grid;
    gap: 1rem;
}

.source-item, .accuracy-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: var(--border-radius);
}

.source-item h5, .accuracy-item h5 {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.source-item p, .accuracy-item p {
    font-size: 0.9rem;
    line-height: 1.5;
}

.service-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: var(--border-radius);
}

.feature i {
    color: var(--primary-light);
    font-size: 1.2rem;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-bottom p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .logo {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .upload-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 250px;
        justify-content: center;
    }
    
    .nutrition-details {
        grid-template-columns: 1fr;
    }
    
    .intake-details {
        grid-template-columns: 1fr;
    }
    
    .result-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .result-actions .btn {
        width: 100%;
        max-width: 250px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
    
    .service-features {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .main {
        padding: 2rem 0;
    }
    
    .upload-icon {
        font-size: 3rem;
    }
    
    .calorie-display {
        font-size: 2.5rem;
    }
    
    .history-item {
        flex-direction: column;
        text-align: center;
    }
    
    .service-features {
        grid-template-columns: 1fr;
    }
}

/* 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.upload-section, .preview-section, .loading-section, .result-section, .history-section {
    animation: fadeIn 0.5s ease-out;
}

/* 드래그 앤 드롭 스타일 */
.upload-area.dragover {
    background: #f0fff0;
    border-color: var(--primary-color);
    transform: scale(1.02);
}

/* 접근성 개선 */
.btn:focus, .upload-area:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* 토스트 알림 스타일 */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 다크 모드 지원 */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #121212;
        --surface: #1e1e1e;
        --text-primary: #ffffff;
        --text-secondary: #b0b0b0;
        --text-light: #666666;
    }
    
    .nutrition-item {
        background: #2a2a2a;
    }
    
    .history-item {
        background: #2a2a2a;
    }
    
    .history-item:hover {
        background: #333333;
    }
} 