/* 共通スタイル - 全画面で使用 */
:root {
  color-scheme: light dark;
  font-family: "Noto Sans JP", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  margin: 0;
  padding: 16px 8px 24px;
  background-color: #f5f5f5;
  color: #222;
  padding-bottom: 80px;
    /* 下部ナビゲーション分の余白 */
}

@media (min-width: 600px) {
  body {
    padding: 24px 16px 32px;
  }
}

/* コンテナ */
.container {
  max-width: 960px;
  min-height: calc(100vh - 140px);
  margin: 0 auto;
  padding: 16px;
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}

@media (min-width: 600px) {
  .container {
    padding: 32px;
  }
}

/* 見出し */
h1 {
  font-size: 1.6rem;
  margin: 0 0 8px;
}

@media (max-width: 767px) {
  h1 {
    font-size: 1.4rem;
  }
}
p.description {
  margin: 0 0 24px;
  color: #555;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* フォーム要素 */
label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.field {
  margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 16px;
  }
  
  .field label {
    flex: 0 0 150px;
    margin-bottom: 0;
  }
  
  .field select,
  .field .info-text {
    flex: 1;
}

.field.inline {
  margin-bottom: 0;
}

.info-text {
  font-size: 1rem;
  color: #222;
  margin: 0;
  padding: 8px 0;
  font-weight: 500;
}
input,
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cfd8dc;
  border-radius: 8px;
  font-size: 16px; /* iOSのズーム防止のため16px以上 */
  font-family: inherit;
  box-sizing: border-box;
}

/* select要素の背景を白に設定（Chromeのグレー背景を防ぐ） */
select {
  background-color: #fff;
  color: #222;
}

select:disabled {
  background-color: #f5f5f5;
  color: #999;
  cursor: not-allowed;
}

textarea {
  resize: vertical;
  min-height: 72px;
}

.note-input {
  min-height: 48px;
}

.readonly-field {
  background-color: #f5f5f5;
  color: #333;
  cursor: not-allowed;
}

/* フォームセクション */
.form-section {
  display: grid;
  gap: 16px;
  margin-bottom: 20px;
  grid-template-columns: 1fr;
}

@media (min-width: 600px) {
  .form-section {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .form-section {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* 空の状態 */
.empty-state {
  margin: 32px 0;
  padding: 24px;
  text-align: center;
  border: 1px dashed #b0bec5;
  border-radius: 12px;
  color: #546e7a;
  background-color: #fafafa;
}

/* アクション */
.actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 32px;
}

.actions .button-secondary {
  flex: 1;
  background-color: #fff;
  color: #1976d2;
  border: 1px solid #1976d2;
  padding: 14px 28px;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.actions .button-secondary:hover,
.actions .button-secondary:focus-visible {
  background-color: rgba(25, 118, 210, 0.08);
}

.actions .button-secondary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.actions #submitButton {
  flex: 1;
}

/* メッセージ */
.message {
  font-size: 0.95rem;
  color: #444;
}

.message.success {
  color: #2e7d32;
}

.message.error {
  color: #c62828;
}

/* 下部ナビゲーション */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #fff;
  border-top: 1px solid #e0e6eb;
  display: flex;
  justify-content: space-around;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
  z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: #90a4ae;
  transition: color 0.2s ease;
  gap: 4px;
}

.nav-item:hover {
  color: #546e7a;
}

.nav-item.active {
  color: #1976d2;
}

.nav-icon {
  font-size: 24px;
  line-height: 1;
}

.nav-label {
  font-size: 0.75rem;
  font-weight: 600;
}

/* 戻るリンク */
.page-header {
  margin-bottom: 24px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  color: #546e7a;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
  border-radius: 6px;
}

.back-link:hover {
  color: #1976d2;
  background-color: #f5f5f5;
}

/* 全画面ローディングオーバーレイ */
.global-loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.global-loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background-color: #fff;
  padding: 32px 48px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.global-loading-content p {
  margin: 0;
  color: #546e7a;
  font-size: 0.95rem;
  font-weight: 500;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e3f2fd;
  border-top-color: #1976d2;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* 食事タグ（共通） */
.meal-tag {
  display: inline-block;
  padding: 4px 10px;
  background-color: #e3f2fd;
  color: #1976d2;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.detail-value {
  font-size: 0.95rem;
  color: #222;
}

.meals-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
    margin-top: 4px;
}
