/* 미미 식단 관리 - 메인 스타일시트 */

/* CSS 변수 정의 */
:root {
  --primary-color: #FF9F6B;
  --primary-hover: #FF8A4D;
  --secondary-color: #FFD4B8;
  --background: #FFF5EB;
  --surface: #FFFFFF;
  --text-primary: #4A3728;
  --text-secondary: #8B7355;
  --text-muted: #B8A99A;
  --border-color: #E8DDD4;
  --error-color: #E57373;
  --success-color: #81C784;
  --shadow: 0 2px 8px rgba(74, 55, 40, 0.1);
  --shadow-hover: 0 4px 12px rgba(74, 55, 40, 0.15);
  --radius-small: 8px;
  --radius-medium: 12px;
  --radius-large: 20px;
}

/* 리셋 및 기본 스타일 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 500px;
  margin: 0 auto;
  min-height: 100vh;
}

/* 화면 기본 스타일 */
.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

/* 헤더 */
.header {
  background: var(--surface);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header h1 {
  font-size: 1.2rem;
  font-weight: 600;
  flex: 1;
  text-align: center;
}

.header .cat-emoji {
  margin-right: 4px;
}

.header-spacer {
  width: 44px;
}

/* 버튼 스타일 */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-medium);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.btn-primary:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.btn-large {
  width: 100%;
  padding: 16px 24px;
  font-size: 1.1rem;
}

.btn-icon {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-small);
  transition: background 0.2s;
}

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

/* ================== */
/* 로그인 화면 */
/* ================== */
#login-screen {
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.login-container {
  background: var(--surface);
  padding: 40px 30px;
  border-radius: var(--radius-large);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.login-header {
  margin-bottom: 32px;
}

.login-header .cat-icon {
  font-size: 4rem;
  display: block;
  margin-bottom: 16px;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.login-header h1 {
  font-size: 1.8rem;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.login-header .subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.login-form {
  margin-bottom: 24px;
}

.input-group {
  margin-bottom: 20px;
  text-align: left;
}

.input-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.input-group input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-medium);
  font-size: 1.1rem;
  transition: border-color 0.2s;
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.error-message {
  color: var(--error-color);
  font-size: 0.9rem;
  margin-top: 12px;
  text-align: center;
}

.login-footer {
  margin-top: 20px;
}

.login-footer .paw {
  font-size: 1.5rem;
  opacity: 0.5;
}

/* ================== */
/* 홈 화면 */
/* ================== */
.home-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 20px;
  gap: 20px;
}

.menu-btn {
  background: var(--surface);
  border: none;
  border-radius: var(--radius-large);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
  min-height: 140px;
}

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

.menu-btn:active {
  transform: translateY(-2px);
}

.menu-icon {
  font-size: 3rem;
}

.menu-text {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
}

.footer {
  padding: 20px;
  text-align: center;
}

.paw-prints {
  font-size: 1.2rem;
  opacity: 0.4;
}

/* ================== */
/* 기록하기 화면 */
/* ================== */
.record-content {
  padding: 20px;
  padding-bottom: 100px;
}

.current-time {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 20px;
  padding: 10px;
  background: var(--surface);
  border-radius: var(--radius-small);
}

.option-section {
  background: var(--surface);
  border-radius: var(--radius-medium);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.option-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

/* 라디오 버튼 그룹 */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-group.horizontal {
  flex-direction: row;
  gap: 16px;
}

.radio-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-small);
  transition: all 0.2s;
}

.radio-label:hover {
  border-color: var(--primary-color);
}

.radio-label input[type="radio"] {
  margin-right: 10px;
  accent-color: var(--primary-color);
  width: 18px;
  height: 18px;
}

.radio-label input[type="radio"]:checked + .radio-text {
  color: var(--primary-color);
  font-weight: 600;
}

.radio-group.horizontal .radio-label {
  flex: 1;
  justify-content: center;
  padding: 10px 12px;
}

/* 체크박스 + 입력 조합 */
.checkbox-with-input {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  margin-right: 10px;
  accent-color: var(--primary-color);
  width: 20px;
  height: 20px;
}

.checkbox-text {
  font-size: 1rem;
  color: var(--text-primary);
}

/* 스텝퍼 */
.stepper-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px;
  background: var(--background);
  border-radius: var(--radius-small);
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 0.2s;
}

.stepper-container.active {
  opacity: 1;
  pointer-events: auto;
}

.stepper-container.small {
  gap: 8px;
  padding: 6px;
}

.stepper-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: var(--primary-color);
  color: white;
  font-size: 1.5rem;
  font-weight: bold;
  border-radius: var(--radius-small);
  cursor: pointer;
  transition: background 0.2s;
}

.stepper-btn:hover {
  background: var(--primary-hover);
}

.stepper-btn.small {
  width: 36px;
  height: 36px;
  font-size: 1.2rem;
}

.stepper-value {
  font-size: 1.5rem;
  font-weight: 700;
  min-width: 50px;
  text-align: center;
  color: var(--primary-color);
}

.stepper-value.small {
  font-size: 1.2rem;
  min-width: 40px;
}

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

/* 간식 옵션 */
.snack-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.snack-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}

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

/* 메모 그리드 */
.memo-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.memo-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-small);
  transition: all 0.2s;
}

.memo-label:hover {
  border-color: var(--primary-color);
}

.memo-label input[type="checkbox"] {
  margin-right: 10px;
  accent-color: var(--primary-color);
  width: 18px;
  height: 18px;
}

.memo-label input[type="checkbox"]:checked + .memo-text {
  color: var(--primary-color);
  font-weight: 600;
}

.memo-text {
  font-size: 0.95rem;
}

/* 저장 섹션 */
.save-section {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 20px;
  background: var(--surface);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.save-section .btn {
  max-width: 500px;
  margin: 0 auto;
  display: block;
}

/* ================== */
/* 조회하기 화면 */
/* ================== */
.view-content {
  padding: 20px;
  padding-bottom: 40px;
}

/* 기간 필터 */
.period-filter {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  padding: 4px;
  background: var(--surface);
  border-radius: var(--radius-medium);
  box-shadow: var(--shadow);
}

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

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

.period-btn:hover:not(.active) {
  background: var(--secondary-color);
}

/* 탭 메뉴 */
.tab-menu {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.tab-btn {
  flex: 1;
  min-width: 80px;
  padding: 12px 8px;
  border: none;
  background: var(--surface);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-small);
  transition: all 0.2s;
  white-space: nowrap;
}

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

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

/* 탭 컨텐츠 */
.tab-panel {
  animation: fadeIn 0.3s ease;
}

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

/* 통계 카드 */
.stats-card {
  background: var(--surface);
  border-radius: var(--radius-medium);
  padding: 20px;
  box-shadow: var(--shadow);
}

.stats-card h3 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.stats-content {
  font-size: 0.95rem;
  line-height: 1.8;
}

.stats-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

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

.stats-label {
  color: var(--text-secondary);
}

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

.stats-subitem {
  padding-left: 20px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.no-data {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
}

.no-data-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

/* 상세 기록 */
.detail-section {
  margin-top: 20px;
}

.detail-records {
  margin-top: 16px;
  background: var(--surface);
  border-radius: var(--radius-medium);
  padding: 16px;
  box-shadow: var(--shadow);
  max-height: 400px;
  overflow-y: auto;
}

.detail-day {
  margin-bottom: 16px;
}

.detail-day:last-child {
  margin-bottom: 0;
}

.detail-date {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-color);
}

.detail-record {
  padding: 8px 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  border-bottom: 1px dashed var(--border-color);
}

.detail-record:last-child {
  border-bottom: none;
}

.detail-time {
  font-weight: 600;
  color: var(--text-primary);
  margin-right: 8px;
}

/* 로딩 */
.loading {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
}

/* ================== */
/* 토스트 메시지 */
/* ================== */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: white;
  padding: 14px 24px;
  border-radius: var(--radius-medium);
  font-size: 0.95rem;
  z-index: 1000;
  animation: toastIn 0.3s ease;
}

.toast.success {
  background: var(--success-color);
}

.toast.error {
  background: var(--error-color);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ================== */
/* 확인 모달 */
/* ================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background: var(--surface);
  padding: 24px;
  border-radius: var(--radius-large);
  max-width: 320px;
  width: 100%;
  text-align: center;
}

.modal-content p {
  margin-bottom: 20px;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.modal-buttons {
  display: flex;
  gap: 12px;
}

.modal-buttons .btn {
  flex: 1;
}

/* ================== */
/* 반응형 */
/* ================== */
@media (max-width: 360px) {
  html {
    font-size: 14px;
  }

  .menu-btn {
    padding: 24px 20px;
    min-height: 120px;
  }

  .menu-icon {
    font-size: 2.5rem;
  }

  .tab-btn {
    font-size: 0.8rem;
    padding: 10px 6px;
  }
}

@media (min-width: 500px) {
  .save-section {
    left: 50%;
    transform: translateX(-50%);
    max-width: 500px;
  }
}

/* 다크모드 지원 (선택적) */
@media (prefers-color-scheme: dark) {
  /* 다크모드 스타일은 추후 추가 가능 */
}
