/* 냠냠 기록 - 스타일시트 */

/* CSS 변수 */
:root {
  /* 소프트 파스텔 컬러 팔레트 */
  --primary: #F8B4B4;
  --primary-light: #FCDEDE;
  --primary-dark: #E8989A;
  --secondary: #A8D8EA;
  --accent: #B8E0D2;
  --success: #B8E0D2;
  --warning: #FCE8B2;
  
  /* 카드 컬러 */
  --card-yellow: #FEF3C7;
  --card-mint: #D1FAE5;
  --card-pink: #FCE7F3;
  --card-blue: #DBEAFE;
  
  /* 배경 컬러 */
  --bg-cream: #FFFBF7;
  --bg-peach: #FFF5F5;
  --bg-card: #FFFFFF;
  
  /* 텍스트 컬러 */
  --text-primary: #374151;
  --text-secondary: #6B7280;
  --text-light: #9CA3AF;
  
  /* 그림자 */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
  
  /* 기타 */
  --radius-sm: 16px;
  --radius-md: 20px;
  --radius-lg: 24px;
  --radius-full: 50px;
  
  --font-display: 'Noto Sans KR', sans-serif;
  --font-body: 'Noto Sans KR', sans-serif;
}

/* 리셋 및 기본 스타일 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg-cream);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

/* Blob 배경 장식 */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  z-index: -1;
  opacity: 0.6;
}

body::before {
  width: 300px;
  height: 300px;
  background: linear-gradient(135deg, #FCDEDE 0%, #F8B4B4 100%);
  top: -100px;
  right: -80px;
  filter: blur(40px);
}

body::after {
  width: 250px;
  height: 250px;
  background: linear-gradient(135deg, #DBEAFE 0%, #A8D8EA 100%);
  bottom: 100px;
  left: -80px;
  filter: blur(40px);
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: 100px;
}

/* 헤더 */
.header {
  background: transparent;
  padding: 20px 20px 16px;
  border-radius: 0;
  box-shadow: none;
  position: relative;
  overflow: hidden;
}


.header-content {
  position: relative;
  text-align: center;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1;
  letter-spacing: -0.02em;
}

.subtitle {
  color: rgba(255,255,255,0.9);
  font-size: 0.95rem;
  font-weight: 500;
}

/* 네비게이션 탭 */
.nav-tabs {
  display: flex;
  gap: 8px;
  padding: 0 16px;
  margin-top: 12px;
}

.nav-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border: none;
  border-radius: var(--radius-md);
  background: #FFF5F5;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.nav-tab:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.nav-tab.active {
  background: linear-gradient(135deg, #FFE4E6 0%, #FECDD3 100%);
  color: var(--text-primary);
  font-weight: 600;
}

.nav-icon {
  font-size: 1.2rem;
}

/* 메인 콘텐츠 */
.main-content {
  padding: 16px;
}

.view {
  display: none;
  animation: fadeIn 0.3s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 타임라인 뷰 */
.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--text-primary);
}

.today-date {
  font-size: 0.9rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  padding: 6px 12px;
  border-radius: var(--radius-full);
}

/* 식사 카드 */
.meal-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.meal-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  animation: slideUp 0.4s ease;
  border: 1px solid rgba(0,0,0,0.03);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.meal-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.meal-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--bg-peach) 0%, var(--primary-light) 100%);
}

.meal-card-image.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
}

.meal-card-content {
  padding: 16px;
  background: #FFFFFF;
}

.meal-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.meal-card-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}

.meal-card-type {
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary-dark);
}

.meal-card-details {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.meal-card-nutrients {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.nutrient-tag {
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-peach);
}

.meal-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px dashed var(--bg-peach);
}

.meal-card-reaction {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
}

.meal-card-date {
  font-size: 0.85rem;
  color: var(--text-light);
}

.meal-card-delete {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
  padding: 4px;
}

.meal-card-delete:hover {
  opacity: 1;
}

/* 빈 상태 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state.hidden {
  display: none;
}

.empty-icon {
  font-size: 5rem;
  margin-bottom: 16px;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.empty-sub {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-top: 8px;
}

/* 캘린더 뷰 */
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.current-month {
  font-family: var(--font-display);
  font-size: 1.5rem;
}

.month-nav {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--primary);
  font-size: 1rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.month-nav:hover {
  background: var(--primary);
  color: white;
}

.calendar-grid {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.weekday-headers {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.weekday-headers span:first-child {
  color: var(--secondary);
}

.weekday-headers span:last-child {
  color: var(--accent);
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.calendar-day:hover {
  background: var(--bg-peach);
}

.calendar-day.other-month {
  color: var(--text-light);
}

.calendar-day.today {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  font-weight: 700;
}

.calendar-day.has-record::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--secondary);
}

.calendar-day.today.has-record::after {
  background: white;
}

.calendar-day .meal-count {
  font-size: 0.6rem;
  margin-top: 2px;
  opacity: 0.7;
}

/* 월간 통계 */
.monthly-stats {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.stats-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin-bottom: 16px;
  text-align: center;
}

.stats-grid {
  display: grid;
  gap: 16px;
}

.stat-item {
  background: linear-gradient(135deg, var(--bg-cream) 0%, var(--bg-peach) 100%);
  padding: 16px;
  border-radius: var(--radius-sm);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.stat-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.stat-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-bar-label {
  width: 60px;
  font-size: 0.8rem;
}

.stat-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.5);
  border-radius: 4px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--primary);
  transition: width 0.5s ease;
}

.stat-bar-fill.protein { background: #e17055; }
.stat-bar-fill.vegetable { background: #00b894; }
.stat-bar-fill.grain { background: #fdcb6e; }
.stat-bar-fill.dairy { background: #74b9ff; }
.stat-bar-fill.fruit { background: #fd79a8; }

/* 하단 기록 버튼 (FAB - 원형 플로팅 버튼) */
.record-btn {
  position: fixed;
  bottom: 24px;
  right: 20px;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: var(--text-primary);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(248, 180, 180, 0.5);
  transition: all 0.3s ease;
  z-index: 100;
}

.record-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(248, 180, 180, 0.6);
}

.record-btn:active {
  transform: scale(0.95);
}

.record-icon {
  font-size: 1.5rem;
  line-height: 1;
  transform: scaleX(-1);
}

/* 모달 */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-card);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.modal.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--bg-peach);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 10;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
}

.modal-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--bg-peach);
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--secondary);
  color: white;
}

/* 폼 스타일 */
.meal-form {
  padding: 20px;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--bg-peach);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-primary);
  transition: border-color 0.2s;
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-textarea {
  min-height: 80px;
  resize: vertical;
}

/* 식사 종류 버튼 */
.meal-type-btns {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.meal-type-btn {
  padding: 12px 8px;
  border: 2px solid var(--bg-peach);
  border-radius: var(--radius-sm);
  background: white;
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.meal-type-btn:hover {
  border-color: var(--primary-light);
}

.meal-type-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* 이미지 업로드 */
.image-upload-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.image-btn {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 20px;
  border: 2px dashed var(--bg-peach);
  border-radius: var(--radius-md);
  background: white;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  min-width: 0;
}

.image-btn:hover {
  border-color: var(--primary);
  background: var(--bg-cream);
  color: var(--primary-dark);
}

.image-btn span:first-child {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.image-preview-container {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.image-preview {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--radius-md);
}

.image-preview.hidden {
  display: none;
}

.image-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.image-remove-btn:hover {
  background: var(--secondary);
}

.image-remove-btn.hidden {
  display: none;
}

/* 영양 정보 버튼 */
.nutrient-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nutrient-btn {
  padding: 10px 14px;
  border: 2px solid var(--bg-peach);
  border-radius: var(--radius-full);
  background: white;
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.nutrient-btn:hover {
  border-color: var(--accent);
}

.nutrient-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* 반응 버튼 */
.reaction-btns {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.reaction-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px;
  border: 2px solid var(--bg-peach);
  border-radius: var(--radius-sm);
  background: white;
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.reaction-btn:hover {
  border-color: var(--primary-light);
}

.reaction-btn.active {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--warning) 100%);
  border-color: var(--primary);
}

.reaction-icon {
  font-size: 1.8rem;
}

/* 제출 버튼 */
.submit-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: var(--shadow-md);
}

.submit-btn:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* 날짜별 상세 모달 */
.day-meals {
  padding: 20px;
}

/* 로딩 오버레이 */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.loading-overlay.hidden {
  display: none;
}

.loading-spinner {
  font-size: 4rem;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* 토스트 메시지 */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text-primary);
  color: white;
  padding: 14px 24px;
  border-radius: var(--radius-full);
  font-size: 0.95rem;
  box-shadow: var(--shadow-lg);
  z-index: 3000;
  opacity: 0;
  transition: all 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.hidden {
  display: none;
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--secondary);
}

/* 반응형 - 모바일 */
@media (max-width: 600px) {
  .header {
    padding: 16px 16px 12px;
  }
  
  .logo {
    font-size: 1.3rem;
  }
  
  body::before {
    width: 200px;
    height: 200px;
    top: -60px;
    right: -60px;
  }
  
  body::after {
    width: 180px;
    height: 180px;
    bottom: 80px;
    left: -60px;
  }
}

@media (max-width: 400px) {
  .meal-type-btns {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .reaction-btns {
    grid-template-columns: 1fr;
  }
}

/* 유틸리티 클래스 */
.hidden {
  display: none !important;
}

