/* Apple-style 깔끔한 디자인 */

/* 기본 설정 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Apple Blue */
    --primary-color: #007AFF;
    --primary-hover: #0051D5;
    --primary-light: #E5F1FF;

    /* Neutral Colors */
    --bg-color: #F5F5F7;
    --card-bg: #FFFFFF;
    --text-primary: #1D1D1F;
    --text-secondary: #86868B;
    --border-color: #D2D2D7;

    /* Semantic Colors */
    --success-color: #34C759;
    --warning-color: #FF9500;
    --danger-color: #FF3B30;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', 'Roboto', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-bottom: 100px;
}

/* 컨테이너 */
.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 헤더 */
.header {
    background: linear-gradient(180deg, #FFFFFF 0%, #F5F5F7 100%);
    padding: 48px 0 32px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.logo {
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.subtitle {
    font-size: 17px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* 네비게이션 탭 */
.nav-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    padding: 6px;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-radius: 7px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-secondary);
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

.tab-btn:hover:not(.active) {
    background: var(--primary-light);
    color: var(--primary-color);
}

/* 탭 콘텐츠 */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* 카드 */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.card h2 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.3px;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.card h3 {
    font-size: 19px;
    font-weight: 600;
    margin: 24px 0 16px;
    color: var(--text-primary);
}

/* 칼로리 진행률 */
.calorie-progress {
    text-align: center;
}

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

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #00C7FF);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
    border-radius: 4px;
}

.progress-text {
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -1px;
    margin: 16px 0 8px;
    color: var(--text-primary);
}

.progress-text span {
    color: var(--primary-color);
}

.remaining-text {
    font-size: 15px;
    color: var(--text-secondary);
}

/* 버튼 */
.btn {
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: -0.3px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 12px rgba(0, 122, 255, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #F5F5F7;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #E8E8ED;
}

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

.btn-danger:hover {
    background: #E6342A;
}

/* 입력 버튼 */
.input-buttons {
    display: grid;
    gap: 12px;
}

.input-buttons .btn {
    width: 100%;
    padding: 18px;
    font-size: 17px;
}

/* 식사 목록 */
.meal-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.meal-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-color);
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.meal-item:hover {
    background: #EBEBF0;
}

.meal-info {
    flex: 1;
}

.meal-name {
    font-size: 17px;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.meal-time {
    font-size: 15px;
    color: var(--text-secondary);
}

.meal-calories {
    font-size: 19px;
    font-weight: 600;
    color: var(--primary-color);
}

/* 이미지 미리보기 */
.image-preview-container {
    margin-bottom: 24px;
}

.image-preview {
    width: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-color);
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.food-image {
    width: 100%;
    height: auto;
    display: block;
}

/* 영양 그래프 */
.nutrition-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.chart-section {
    background: var(--bg-color);
    padding: 20px;
    border-radius: var(--radius-lg);
}

.chart-section h4 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 16px;
    text-align: center;
    color: var(--text-primary);
}

.macro-chart-container,
.daily-chart-container {
    position: relative;
    height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nutrition-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.legend-label {
    flex: 1;
    color: var(--text-primary);
}

.legend-value {
    font-weight: 600;
    color: var(--primary-color);
}

/* 분석 결과 */
.analysis-result {
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.food-name input {
    width: 100%;
    padding: 16px;
    font-size: 20px;
    font-weight: 600;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    background: var(--bg-color);
    transition: all 0.2s;
}

.food-name input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px var(--primary-light);
}

.nutrition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.nutrition-item {
    padding: 16px;
    background: var(--bg-color);
    border-radius: var(--radius-md);
    text-align: center;
}

.nutrition-item label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nutrition-item input {
    width: 70px;
    padding: 8px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-weight: 600;
    font-size: 17px;
    background: white;
}

.nutrition-item input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* 운동량 목록 */
.exercise-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.exercise-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg-color);
    border-radius: var(--radius-md);
}

.exercise-name {
    font-size: 17px;
    font-weight: 500;
    color: var(--text-primary);
}

.exercise-time {
    font-size: 17px;
    font-weight: 600;
    color: var(--primary-color);
}

/* 액션 버튼 */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 12px;
    margin-top: 24px;
}

/* 통계 */
.stats-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    padding: 4px;
    background: var(--bg-color);
    border-radius: var(--radius-md);
}

.stats-btn {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.stats-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.chart-container {
    position: relative;
    height: 280px;
    margin-bottom: 24px;
    background: var(--bg-color);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background: var(--bg-color);
    border-radius: var(--radius-md);
}

.stat-label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    display: block;
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
}

/* 주요 음식 */
.top-foods-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.top-food-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-color);
    border-radius: var(--radius-md);
}

.food-rank {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    min-width: 50px;
    text-align: center;
}

.food-details {
    flex: 1;
}

.food-details > div {
    font-size: 17px;
    font-weight: 500;
    margin-bottom: 4px;
}

.food-details small {
    font-size: 15px;
    color: var(--text-secondary);
}

.food-percentage {
    font-size: 19px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* 폼 그룹 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 15px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 17px;
    background: var(--bg-color);
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px var(--primary-light);
}

/* API 상태 */
.api-status {
    font-size: 15px;
    margin-left: 8px;
    font-weight: 500;
}

.api-status.saved {
    color: var(--success-color);
}

.api-status.error {
    color: var(--danger-color);
}

/* 정보 박스 */
.info-box {
    margin-top: 20px;
    padding: 20px;
    background: #F0F8FF;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-color);
}

.info-box p {
    margin-bottom: 12px;
    font-size: 15px;
    line-height: 1.6;
}

.info-box ol {
    margin-left: 20px;
    margin-bottom: 12px;
}

.info-box ol li {
    margin-bottom: 8px;
    font-size: 15px;
}

.info-box a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.info-box a:hover {
    text-decoration: underline;
}

.note {
    font-size: 14px;
    color: var(--warning-color);
    font-weight: 500;
}

/* 데이터 정보 */
.data-info {
    margin-bottom: 20px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: var(--radius-md);
}

.data-info p {
    margin-bottom: 8px;
    font-size: 17px;
}

.data-info strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* 빈 메시지 */
.empty-message {
    text-align: center;
    color: var(--text-secondary);
    padding: 60px 20px;
    font-size: 17px;
}

/* 숨김 */
.hidden {
    display: none !important;
}

/* 로딩 오버레이 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading p {
    font-size: 17px;
    font-weight: 500;
}

/* Toast 알림 */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    color: white;
    padding: 16px 28px;
    border-radius: var(--radius-md);
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 90%;
    font-size: 17px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 푸터 */
.footer {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 15px;
    margin-top: 60px;
}

.footer p {
    margin-bottom: 8px;
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.footer a:hover {
    text-decoration: underline;
}

/* 반응형 디자인 */
@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .header {
        padding: 40px 0 24px;
    }

    .logo {
        font-size: 28px;
    }

    .subtitle {
        font-size: 15px;
    }

    .nav-tabs {
        gap: 4px;
        padding: 4px;
    }

    .tab-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .card {
        padding: 20px;
        border-radius: var(--radius-md);
    }

    .card h2 {
        font-size: 20px;
    }

    .progress-text {
        font-size: 28px;
    }

    .nutrition-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-summary {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .action-buttons {
        grid-template-columns: 1fr;
    }

    .chart-container {
        height: 240px;
    }
}

/* 다크모드 미디어 쿼리 (시스템 설정 반영) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #000000;
        --card-bg: #1C1C1E;
        --text-primary: #FFFFFF;
        --text-secondary: #98989D;
        --border-color: #38383A;
    }

    .header {
        background: linear-gradient(180deg, #1C1C1E 0%, #000000 100%);
        border-bottom-color: #38383A;
    }

    .btn-secondary {
        background: #2C2C2E;
        color: white;
    }

    .btn-secondary:hover {
        background: #3A3A3C;
    }

    .info-box {
        background: #1C2A3A;
    }
}

/* 애니메이션 추가 */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* 접근성 향상 */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* 스크롤 부드럽게 */
html {
    scroll-behavior: smooth;
}

/* 선택 영역 스타일 */
::selection {
    background: var(--primary-light);
    color: var(--primary-color);
}

/* AI 조언 박스 */
.ai-advice {
    padding: 20px;
    background: linear-gradient(135deg, #E5F1FF 0%, #F0F8FF 100%);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-color);
    margin-bottom: 24px;
}

.ai-advice p {
    font-size: 17px;
    line-height: 1.7;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.ai-advice p:last-child {
    margin-bottom: 0;
}

.ai-advice strong {
    color: var(--primary-color);
    font-weight: 600;
}

.advice-loading {
    text-align: center;
    color: var(--text-secondary);
    font-size: 15px;
    padding: 20px;
    animation: pulse 2s infinite;
}

/* AI 추천 메뉴 */
.recommendation-box {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.recommendation-header {
    text-align: center;
    padding: 16px;
    background: var(--primary-light);
    border-radius: var(--radius-md);
}

.remaining-kcal {
    font-size: 17px;
    color: var(--text-primary);
}

.remaining-kcal strong {
    font-size: 24px;
    color: var(--primary-color);
    font-weight: 700;
}

.ai-recommendation {
    min-height: 120px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: var(--radius-md);
    border: 2px dashed var(--border-color);
}

.recommendation-loading {
    text-align: center;
    color: var(--text-secondary);
    font-size: 15px;
    padding: 40px 20px;
    animation: pulse 2s infinite;
}

.recommendation-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: white;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

.recommendation-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.recommendation-item:last-child {
    margin-bottom: 0;
}

.recommendation-emoji {
    font-size: 36px;
}

.recommendation-details {
    flex: 1;
}

.recommendation-name {
    font-size: 19px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.recommendation-desc {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.recommendation-calories {
    font-size: 19px;
    font-weight: 700;
    color: var(--primary-color);
}

/* 식사 타임라인 뷰 */
.timeline-view {
    position: relative;
    padding-left: 40px;
}

.timeline-item {
    position: relative;
    padding: 20px;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -28px;
    top: 24px;
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
    border: 3px solid var(--bg-color);
    box-shadow: 0 0 0 2px var(--primary-color);
}

.timeline-item::after {
    content: '';
    position: absolute;
    left: -23px;
    top: 36px;
    width: 2px;
    height: calc(100% + 8px);
    background: var(--border-color);
}

.timeline-item:last-child::after {
    display: none;
}

.timeline-time {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.timeline-meal {
    font-size: 19px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.timeline-calories {
    font-size: 17px;
    color: var(--primary-color);
    font-weight: 600;
}

.timeline-nutrients {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.timeline-nutrient {
    padding: 6px 12px;
    background: var(--bg-color);
    border-radius: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* 스트릭 & 영양 점수 */
.achievements-card .achievement-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.streak-box {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: linear-gradient(135deg, #FF9500 0%, #FF6B00 100%);
    border-radius: var(--radius-md);
    color: white;
}

.streak-icon {
    font-size: 48px;
    line-height: 1;
}

.streak-info {
    display: flex;
    flex-direction: column;
}

.streak-number {
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
}

.streak-label {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 4px;
}

.nutrition-score-box {
    flex: 1;
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #007AFF 0%, #0051D5 100%);
    border-radius: var(--radius-md);
    color: white;
}

.score-circle {
    width: 80px;
    height: 80px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid rgba(255, 255, 255, 0.4);
}

.score-value {
    font-size: 32px;
    font-weight: 700;
}

.score-label {
    font-size: 13px;
    opacity: 0.9;
}

/* 배지 그리드 */
.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.badge-item {
    padding: 16px;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    text-align: center;
    transition: transform 0.2s;
    cursor: pointer;
}

.badge-item:hover {
    transform: translateY(-4px);
}

.badge-icon {
    font-size: 40px;
    margin-bottom: 8px;
}

.badge-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.badge-desc {
    font-size: 11px;
    color: var(--text-secondary);
}

.badge-date {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* 간헐적 단식 */
.fasting-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 51px;
    height: 31px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #E5E5EA;
    transition: 0.3s;
    border-radius: 31px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 27px;
    width: 27px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .toggle-slider {
    background-color: var(--success-color);
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.fasting-timer {
    text-align: center;
}

.fasting-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.fasting-mode {
    font-size: 15px;
    color: var(--text-secondary);
}

.fasting-state {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary-color);
}

.timer-display {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 8px;
    margin: 24px 0;
}

.time-value {
    font-size: 56px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.time-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.time-separator {
    font-size: 40px;
    color: var(--text-secondary);
    margin: 0 8px;
}

.fasting-progress-bar {
    height: 8px;
    background: var(--bg-color);
    border-radius: 4px;
    overflow: hidden;
    margin: 24px 0;
}

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

.fasting-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.fasting-actions button {
    flex: 1;
}

.fasting-setup {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.fasting-mode-select {
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 15px;
    background: var(--card-bg);
    color: var(--text-primary);
}

/* 분석 모드 토글 */
.analysis-mode-toggle {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    padding: 6px;
    background: var(--bg-color);
    border-radius: var(--radius-md);
}

.mode-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
}

.mode-option input[type="radio"] {
    display: none;
}

.mode-option span {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
}

.mode-option input[type="radio"]:checked + span {
    color: var(--primary-color);
}

.mode-option:has(input[type="radio"]:checked) {
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
}

/* 메뉴 비교 그리드 */
.menu-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.menu-item-card {
    background: var(--bg-color);
    border-radius: var(--radius-md);
    padding: 20px;
    position: relative;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.menu-item-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.menu-item-card.recommended {
    border-color: var(--success-color);
    background: linear-gradient(135deg, rgba(52, 199, 89, 0.05) 0%, rgba(52, 199, 89, 0.1) 100%);
}

.menu-item-card.warning {
    border-color: var(--warning-color);
}

.menu-item-card.danger {
    border-color: var(--danger-color);
}

.menu-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.menu-badge.best {
    background: var(--success-color);
}

.menu-badge.good {
    background: var(--primary-color);
}

.menu-badge.caution {
    background: var(--warning-color);
}

.menu-item-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.menu-item-calories {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.menu-item-nutrients {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.nutrient-chip {
    padding: 8px;
    background: var(--card-bg);
    border-radius: 8px;
    text-align: center;
}

.nutrient-label {
    font-size: 11px;
    color: var(--text-secondary);
    display: block;
}

.nutrient-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
}

.menu-item-pros {
    margin-bottom: 12px;
}

.menu-item-cons {
    margin-bottom: 16px;
}

.pros-title,
.cons-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pros-title {
    color: var(--success-color);
}

.cons-title {
    color: var(--danger-color);
}

.pros-list,
.cons-list {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.pros-list li {
    margin-bottom: 4px;
}

.cons-list li {
    margin-bottom: 4px;
}

.select-menu-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--primary-color);
    color: white;
}

.select-menu-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.02);
}

.ai-recommendation-box {
    background: linear-gradient(135deg, #007AFF 0%, #0051D5 100%);
    color: white;
    padding: 20px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
}

.ai-recommendation-box h3 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-recommendation-box p {
    font-size: 15px;
    line-height: 1.6;
    opacity: 0.95;
}

/* 반응형 */
@media (max-width: 600px) {
    .achievements-card .achievement-header {
        flex-direction: column;
    }

    .streak-box,
    .nutrition-score-box {
        width: 100%;
    }

    .badges-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .menu-items-grid {
        grid-template-columns: 1fr;
    }
}

/* 다크모드 추가 스타일 */
@media (prefers-color-scheme: dark) {
    .ai-advice {
        background: linear-gradient(135deg, #1C2A3A 0%, #1C3044 100%);
    }

    .recommendation-item {
        background: #2C2C2E;
    }

    .timeline-item {
        background: #2C2C2E;
    }

    .timeline-nutrient {
        background: #3A3A3C;
    }

    .badge-item {
        background: rgba(0, 122, 255, 0.15);
    }

    .toggle-slider {
        background-color: #3A3A3C;
    }

    .fasting-mode-select {
        background: #1C1C1E;
        border-color: #3A3A3C;
        color: white;
    }
}
