/**
 * PFC Calculator Styles
 * モバイルファースト設計
 */

/* ========================================
   変数定義
======================================== */
:root {
  --primary: #3366cc;
  --primary-light: #5a8adb;
  --primary-dark: #2451a8;
  --secondary: #b28fce;
  --secondary-light: #c8a8db;
  --gradient-main: linear-gradient(135deg, #b28fce, #3366cc);
  --gradient-bg: linear-gradient(to bottom, #b28fce, #3366cc, #b28fce);
  
  --success: #4CAF50;
  --warning: #FF9800;
  --danger: #F44336;
  
  --text-dark: #333;
  --text-medium: #666;
  --text-light: #999;
  --bg-white: #ffffff;
  --bg-gray: #f5f7fa;
  --bg-light-purple: #f8f5fc;
  
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.16);
  
  --transition: all 0.3s ease;
}

/* ========================================
   メインコンテナ
======================================== */
.pfc-calculator {
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  color: var(--text-dark);
  line-height: 1.6;
}

/* ========================================
   ヘッダー
======================================== */
.pfc-header {
  background: var(--gradient-main);
  color: white;
  padding: 24px 16px;
  text-align: center;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  margin-bottom: 0;
}

.pfc-header h2 {
  margin: 0 0 8px 0;
  font-size: 24px;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.pfc-subtitle {
  margin: 0;
  font-size: 14px;
  opacity: 0.95;
  font-weight: 400;
}

/* ========================================
   入力セクション
======================================== */
.pfc-input-section {
  background: var(--bg-white);
  padding: 20px 16px;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
}

/* フォームグループ */
.pfc-form-group {
  margin-bottom: 20px;
}

.pfc-form-group:last-child {
  margin-bottom: 0;
}

.pfc-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-dark);
}

.required {
  color: var(--danger);
  margin-left: 2px;
}

/* フォーム行（2カラム） */
.pfc-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

/* 入力フィールド */
.pfc-input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #e0e0e0;
  border-radius: var(--border-radius-sm);
  font-size: 16px;
  transition: var(--transition);
  background: var(--bg-white);
  box-sizing: border-box;
}

.pfc-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(51, 102, 204, 0.1);
}

.pfc-input::placeholder {
  color: var(--text-light);
}

/* 単位付き入力 */
.pfc-input-with-unit {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pfc-input-with-unit .pfc-input {
  flex: 1;
}

.pfc-unit {
  font-size: 14px;
  color: var(--text-medium);
  font-weight: 600;
  white-space: nowrap;
  min-width: 30px;
}

/* ラジオボタングループ（横並び） */
.pfc-radio-group {
  display: flex;
  gap: 12px;
}

.pfc-radio {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-white);
}

.pfc-radio:hover {
  border-color: var(--primary-light);
  background: var(--bg-light-purple);
}

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

.pfc-radio input[type="radio"]:checked + span {
  color: var(--primary);
  font-weight: 700;
}

.pfc-radio input[type="radio"]:checked ~ * {
  color: var(--primary);
}

.pfc-radio:has(input[type="radio"]:checked) {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(178, 143, 206, 0.1), rgba(51, 102, 204, 0.1));
}

.pfc-radio span {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
  transition: var(--transition);
}

/* ラジオボタングループ（縦並び） */
.pfc-radio-group-vertical {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pfc-radio-group-vertical .pfc-radio {
  justify-content: flex-start;
  padding: 14px 16px;
}

.pfc-radio-group-vertical .pfc-radio span {
  font-size: 13px;
  text-align: left;
}

/* ヘルプテキスト */
.pfc-help-text {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-medium);
}

/* モード切替セクション */
#normalModeSection {
  display: block;
}

#simpleModeSection {
  display: none;
}

/* 計算ボタン */
.pfc-btn {
  width: 100%;
  padding: 16px 24px;
  background: var(--gradient-main);
  color: white;
  border: none;
  border-radius: var(--border-radius-sm);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}

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

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

.btn-icon {
  font-size: 20px;
}

/* ========================================
   結果セクション
======================================== */
.pfc-results-section {
  margin-top: 24px;
}

.pfc-results-header {
  background: var(--gradient-main);
  color: white;
  padding: 20px 16px;
  text-align: center;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  margin-bottom: 0;
}

.pfc-results-header h3 {
  margin: 0 0 12px 0;
  font-size: 22px;
  font-weight: 700;
}

.bmr-display {
  margin: 0;
  font-size: 14px;
  opacity: 0.95;
  line-height: 1.8;
}

.bmr-display strong {
  font-weight: 700;
  font-size: 16px;
  color: #fff;
}

/* カードコンテナ */
.pfc-cards-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  background: var(--bg-gray);
  border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* 個別カード */
.pfc-card {
  background: var(--bg-white);
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--transition);
}

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

/* カードヘッダー */
.card-header {
  background: linear-gradient(135deg, rgba(178, 143, 206, 0.15), rgba(51, 102, 204, 0.15));
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #f0f0f0;
}

.card-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-dark);
}

.pfc-ratio-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--secondary);
  background: white;
  padding: 4px 10px;
  border-radius: 12px;
  white-space: nowrap;
}

/* カードボディ */
.card-body {
  padding: 16px;
}

/* カード説明 */
.card-description {
  text-align: center;
  font-size: 12px;
  color: var(--text-medium);
  margin-bottom: 10px;
  padding: 6px 10px;
  background: rgba(51, 102, 204, 0.05);
  border-radius: 6px;
}

/* カロリー表示 */
.calories-display {
  text-align: center;
  padding: 12px;
  background: linear-gradient(135deg, rgba(178, 143, 206, 0.08), rgba(51, 102, 204, 0.08));
  border-radius: var(--border-radius-sm);
  margin-bottom: 16px;
}

.calories-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  display: inline-block;
}

.calories-unit {
  font-size: 14px;
  color: var(--text-medium);
  margin-left: 4px;
}

/* PFCグリッド */
.pfc-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pfc-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-gray);
  border-radius: var(--border-radius-sm);
}

.pfc-item .pfc-label {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
}

.pfc-value-group {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.pfc-item .pfc-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.pfc-item .pfc-unit {
  font-size: 12px;
  color: var(--text-medium);
}

.pfc-cal {
  font-size: 11px;
  color: var(--text-light);
  margin-left: 4px;
}

/* 注意事項 */
.pfc-note {
  background: var(--bg-white);
  padding: 16px;
  border-radius: var(--border-radius-sm);
  border-left: 4px solid var(--primary);
  margin-top: 16px;
  box-shadow: var(--shadow-sm);
}

.pfc-note p {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-medium);
}

.pfc-note p:first-child {
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-dark);
}

/* ========================================
   レスポンシブ対応
======================================== */

/* 小さめのスマホ（〜375px） */
@media (max-width: 375px) {
  .pfc-header h2 {
    font-size: 20px;
  }
  
  .pfc-subtitle {
    font-size: 12px;
  }
  
  .card-header h4 {
    font-size: 14px;
  }
  
  .pfc-ratio-badge {
    font-size: 10px;
    padding: 3px 8px;
  }
  
  .calories-value {
    font-size: 24px;
  }
}

/* タブレット・大きめスマホ（480px〜） */
@media (min-width: 480px) {
  .pfc-calculator {
    max-width: 600px;
    margin: 0 auto;
  }
  
  .pfc-header {
    padding: 28px 24px;
  }
  
  .pfc-input-section {
    padding: 24px;
  }
  
  .pfc-cards-container {
    padding: 20px;
  }
  
  .card-body {
    padding: 20px;
  }
}

/* デスクトップ（768px〜） */
@media (min-width: 768px) {
  .pfc-calculator {
    max-width: 700px;
  }
  
  .pfc-header h2 {
    font-size: 28px;
  }
  
  .pfc-subtitle {
    font-size: 15px;
  }
  
  .pfc-btn {
    width: auto;
    min-width: 200px;
    padding: 16px 32px;
    margin-left: auto;
    margin-right: auto;
  }
  
  .pfc-cards-container {
    gap: 20px;
  }
  
  .card-header h4 {
    font-size: 17px;
  }
  
  .pfc-ratio-badge {
    font-size: 12px;
  }
  
  .calories-value {
    font-size: 32px;
  }
}

/* ========================================
   アニメーション
======================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pfc-results-section {
  animation: fadeIn 0.4s ease;
}

.pfc-card {
  animation: fadeIn 0.5s ease backwards;
}

.pfc-card:nth-child(1) { animation-delay: 0.1s; }
.pfc-card:nth-child(2) { animation-delay: 0.2s; }
.pfc-card:nth-child(3) { animation-delay: 0.3s; }
.pfc-card:nth-child(4) { animation-delay: 0.4s; }
.pfc-card:nth-child(5) { animation-delay: 0.5s; }

/* ========================================
   印刷用スタイル（スクリーンショット対応）
======================================== */
@media print {
  .pfc-calculator {
    max-width: 100%;
  }
  
  .pfc-input-section {
    display: none;
  }
  
  .pfc-card {
    page-break-inside: avoid;
  }
}