/* ============================================================
   営業日報記録 - スタイルシート
   デザインコンセプト: プロフェッショナル × 和モダン
   配色: ディープネイビー × ゴールドアクセント × アイボリー背景
   ============================================================ */

/* ---------- CSS変数（カラーパレット・フォント） ---------- */
:root {
  /* メインカラー */
  --color-primary: #1a2744;       /* ディープネイビー */
  --color-primary-mid: #2a3f6e;   /* ミッドネイビー */
  --color-accent: #c9a84c;        /* ゴールド */
  --color-accent-light: #f0d98f;  /* ライトゴールド */
  --color-accent-dark: #a6862e;   /* ダークゴールド */

  /* 背景・サーフェス */
  --color-bg: #f5f3ee;            /* アイボリー背景 */
  --color-surface: #ffffff;       /* カード背景 */
  --color-surface-alt: #faf9f6;   /* サブ背景 */

  /* テキスト */
  --color-text-main: #1a1a2e;     /* メインテキスト */
  --color-text-sub: #5a6070;      /* サブテキスト */
  --color-text-muted: #9aa0b0;    /* ミュートテキスト */

  /* ボーダー */
  --color-border: #e0dbd0;        /* 通常ボーダー */
  --color-border-focus: #c9a84c;  /* フォーカス時ゴールド */

  /* ステータス */
  --color-success: #2d7a5a;
  --color-warn: #b85c2e;
  --color-warn-bg: #fdf3ee;
  --color-error: #c0392b;

  /* AI */
  --color-ai: #4a3f8c;
  --color-ai-light: #ede9f8;

  /* フォント */
  --font-serif: 'Noto Serif JP', serif;
  --font-sans: 'Noto Sans JP', sans-serif;

  /* サイズ */
  --card-radius: 16px;
  --input-radius: 10px;
  --btn-radius: 12px;
  --shadow-card: 0 4px 24px rgba(26, 39, 68, 0.08);
  --shadow-hover: 0 8px 32px rgba(26, 39, 68, 0.14);

  /* トランジション */
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- リセット・ベーススタイル ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  color: var(--color-text-main);
  background-color: var(--color-bg);
  /* 背景に薄いテクスチャ */
  background-image:
    radial-gradient(circle at 20% 20%, rgba(201, 168, 76, 0.04) 0%, transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(26, 39, 68, 0.04) 0%, transparent 60%);
  min-height: 100vh;
}

/* ---------- ヘッダー ---------- */
.app-header {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-mid) 100%);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(26, 39, 68, 0.3);
}


.header-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}


.header-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  overflow: hidden; /* 角丸を画像に適用 */
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(201, 168, 76, 0.4);
}

/* 画像を親要素いっぱいに表示 */
.logo-image {
  width: 100%;
  height: 100%;
  object-fit: cover; /* アスペクト比維持 */
  display: block;
}

/* ===============================
   ロゴ：金色グロー演出
================================ */
.header-logo {
  position: relative; /* 疑似要素の基準 */
  width: 48px;
  height: 48px;
  border-radius: 12px;
  overflow: visible; /* 光を外へ出す */
  flex-shrink: 0;
}

/* 金色の発光レイヤー */
.header-logo::before {
  content: "";
  position: absolute;
  inset: -6px; /* 少し広げる */
  border-radius: 16px;
  background: radial-gradient(
    circle,
    rgba(201, 168, 76, 0.65) 0%,
    rgba(201, 168, 76, 0.35) 40%,
    rgba(201, 168, 76, 0.1) 70%,
    rgba(201, 168, 76, 0) 80%
  );
  z-index: -1;
  filter: blur(6px);
}

/* アイコン画像 */
.logo-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 12px;
   filter: drop-shadow(0 0 6px rgba(201, 168, 76, 0.6));
}


.app-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.05em;
  line-height: 1.2;
}

.app-subtitle {
  font-size: 11px;
  color: var(--color-accent-light);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 2px;
  font-weight: 300;
}

/* ---------- メインコンテナ ---------- */
.main-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---------- カードコンポーネント ---------- */
.card {
  background: var(--color-surface);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border);
  overflow: hidden;
  transition: box-shadow var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-hover);
}

/* APIカードは上部に強調 */
.card--api {
  border-top: 3px solid var(--color-accent);
  background: linear-gradient(to bottom, #fffdf7 0%, var(--color-surface) 100%);
}

/* カードヘッダー */
.card-header {
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-surface-alt);
}

.card-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--color-primary);
  flex: 1;
  letter-spacing: 0.03em;
}

/* STEPバッジ */
.card-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--color-primary);
  color: var(--color-accent-light);
  text-transform: uppercase;
  flex-shrink: 0;
}

/* AIバッジ */
.card-badge--ai {
  background: linear-gradient(135deg, var(--color-ai), #6a5abf);
  color: white;
}

/* カードボディ */
.card-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---------- フォームフィールド ---------- */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-sub);
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 必須マーク（ラベルに.requiredクラスがある場合） */
.field-label.required::after {
  content: '必須';
  font-size: 10px;
  font-weight: 600;
  color: white;
  background: var(--color-warn);
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0;
}

/* テキスト・日付入力 */
.field-input {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--color-text-main);
  background: var(--color-surface-alt);
  border: 1.5px solid var(--color-border);
  border-radius: var(--input-radius);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

.field-input:focus {
  border-color: var(--color-border-focus);
  background: #fffdf7;
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.15);
}

.field-input::placeholder {
  color: var(--color-text-muted);
  font-size: 14px;
}

/* セレクトボックスのラッパー（矢印カスタマイズ） */
.select-wrapper {
  position: relative;
}

.select-wrapper::after {
  content: '▾';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-accent);
  font-size: 16px;
  pointer-events: none;
}

.field-select {
  cursor: pointer;
  padding-right: 40px;
}

/* テキストエリア */
.field-textarea {
  width: 100%;
  padding: 14px 16px;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.8;
  color: var(--color-text-main);
  background: var(--color-surface-alt);
  border: 1.5px solid var(--color-border);
  border-radius: var(--input-radius);
  outline: none;
  resize: vertical;
  transition: border-color var(--transition), box-shadow var(--transition);
  min-height: 140px;
}

.field-textarea:focus {
  border-color: var(--color-border-focus);
  background: #fffdf7;
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.15);
}

/* readonlyスタイル削除済み：特記事項は自由入力可 */

/* 注意書き */
.field-note {
  font-size: 12px;
  color: var(--color-text-muted);
}

.field-note--warn {
  color: var(--color-warn);
  background: var(--color-warn-bg);
  padding: 8px 12px;
  border-radius: 8px;
  border-left: 3px solid var(--color-warn);
  font-size: 12px;
  font-weight: 500;
}

/* ---------- チェックボックス（カスタム） ---------- */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

/* チェックボックスラベル全体 */
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 10px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface-alt);
  transition: all var(--transition);
  user-select: none;
}

.checkbox-item:hover {
  border-color: var(--color-accent);
  background: #fffdf7;
}

/* チェック時のスタイル変化 */
.checkbox-item:has(.checkbox-input:checked) {
  border-color: var(--color-accent);
  background: linear-gradient(135deg, #fffdf0 0%, #fef9e0 100%);
  box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.2);
}

/* ネイティブのチェックボックスを隠す */
.checkbox-input {
  display: none;
}

/* カスタムチェックボックスの四角 */
.checkbox-box {
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-border);
  border-radius: 5px;
  background: white;
  flex-shrink: 0;
  position: relative;
  transition: all var(--transition);
}

/* チェック時：ゴールドに塗る */
.checkbox-item:has(.checkbox-input:checked) .checkbox-box {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

/* チェックマーク（::after疑似要素） */
.checkbox-item:has(.checkbox-input:checked) .checkbox-box::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 6px;
  height: 10px;
  border: 2px solid white;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.checkbox-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-main);
}

/* ---------- 条件付き表示エリア ---------- */
.conditional-input {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--color-border);
}

/* 非表示クラス */
.hidden {
  display: none !important;
}

/* ---------- ファイルアップロード ---------- */
.file-upload-area {
  position: relative;
  border: 2px dashed var(--color-border);
  border-radius: var(--input-radius);
  background: var(--color-surface-alt);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}

.file-upload-area:hover {
  border-color: var(--color-accent);
  background: #fffdf7;
}

/* ファイルinputは非表示にして、エリア全体をクリッカブルにする */
.file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-icon {
  display: block;
  font-size: 32px;
  margin-bottom: 8px;
}

.file-text {
  font-size: 14px;
  color: var(--color-text-sub);
  font-weight: 500;
}

.file-subtext {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* 選択されたファイル名表示 */
.file-name-display {
  font-size: 13px;
  color: var(--color-success);
  font-weight: 500;
  padding: 8px 12px;
  background: #f0faf5;
  border-radius: 8px;
  border-left: 3px solid var(--color-success);
  margin-top: 8px;
}

/* ---------- リアクションボタン ---------- */
.reaction-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.reaction-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 12px;
  border: 2px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface-alt);
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-sans);
}

.reaction-btn:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(201, 168, 76, 0.15);
}

/* 選択状態 */
.reaction-btn.selected {
  border-color: var(--color-accent);
  background: linear-gradient(135deg, #fffae0 0%, #fff7cc 100%);
  box-shadow: 0 4px 16px rgba(201, 168, 76, 0.25);
  transform: translateY(-2px);
}

.reaction-emoji {
  font-size: 28px;
  line-height: 1;
}

.reaction-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-main);
  letter-spacing: 0.02em;
}

.reaction-btn.selected .reaction-text {
  color: var(--color-accent-dark);
}

/* ---------- ボタン共通 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: var(--btn-radius);
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.btn-icon {
  font-size: 18px;
  line-height: 1;
}

/* AI生成ボタン */
.btn--ai {
  width: 100%;
  background: linear-gradient(135deg, var(--color-ai), #6a5abf);
  color: white;
  box-shadow: 0 4px 16px rgba(74, 63, 140, 0.25);
}

.btn--ai:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(74, 63, 140, 0.35);
}

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

/* 保存ボタン */
.btn--save {
  width: 100%;
  padding: 18px 32px;
  font-size: 17px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-mid) 100%);
  color: white;
  box-shadow: 0 6px 24px rgba(26, 39, 68, 0.3);
  border-radius: 16px;
}

.btn--save:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(26, 39, 68, 0.4);
  background: linear-gradient(135deg, var(--color-primary-mid) 0%, #3a5090 100%);
}

.btn--save:active {
  transform: translateY(-1px);
}

/* ---------- ローディングインジケーター ---------- */
.loading-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #f8f6ff 0%, #ece8ff 100%);
  border-radius: 10px;
  color: var(--color-ai);
  font-size: 14px;
  font-weight: 500;
  margin-top: 10px;
}

/* スピナーアニメーション */
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(74, 63, 140, 0.2);
  border-top-color: var(--color-ai);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

/* ---------- アクションバー（保存ボタンエリア） ---------- */
.action-bar {
  padding: 8px 0 0;
}

/* ---------- フッター ---------- */
.app-footer {
  background: var(--color-primary);
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  padding: 16px 24px;
  font-size: 12px;
  letter-spacing: 0.06em;
}

/* ---------- スクロールバー（おしゃれに） ---------- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--color-accent);
  border-radius: 3px;
}

/* ---------- レスポンシブ（スマホ対応） ---------- */
@media (max-width: 600px) {
  .header-inner {
    padding: 14px 16px;
  }

  .app-title {
    font-size: 17px;
  }

  .main-container {
    padding: 16px 12px 48px;
    gap: 14px;
  }

  .card-body {
    padding: 16px;
    gap: 16px;
  }

  .card-header {
    padding: 14px 16px 12px;
  }

  .card-title {
    font-size: 15px;
  }

  /* チェックボックスグリッドをスマホでは1列に */
  .checkbox-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  /* リアクションボタンはスマホでも2列 */
  .reaction-buttons {
    grid-template-columns: repeat(2, 1fr);
  }

  .btn--save {
    font-size: 15px;
    padding: 15px 24px;
  }
}

@media (max-width: 380px) {
  .checkbox-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---------- アニメーション：カードのフェードイン ---------- */
.card {
  animation: cardFadeIn 0.4s ease forwards;
}

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

/* 各カードにディレイをつけてずらす */
.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.10s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.20s; }
.card:nth-child(5) { animation-delay: 0.25s; }
.card:nth-child(6) { animation-delay: 0.30s; }

/* --------------------------------------------------------
   文字数カウンター
   -------------------------------------------------------- */
.char-counter {
  text-align: right;
  font-size: 0.75rem;
  color: #888;
  margin-top: 4px;
  transition: color 0.2s;
}

.char-counter--warn {
  color: #e67e22;
  font-weight: 500;
}

.char-counter--over {
  color: #e74c3c;
  font-weight: 700;
}

/* --------------------------------------------------------
   音声タブ切り替え
   -------------------------------------------------------- */
.audio-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.audio-tab {
  padding: 6px 16px;
  border: 1.5px solid #ccc;
  border-radius: 20px;
  background: #f5f5f5;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
  color: #555;
}

.audio-tab.active {
  background: #2C2C2C;
  color: #fff;
  border-color: #2C2C2C;
  font-weight: 600;
}

.audio-panel {
  transition: opacity 0.2s;
}

/* --------------------------------------------------------
   録音エリア
   -------------------------------------------------------- */
.record-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
  border: 1.5px dashed #ccc;
  border-radius: 10px;
  background: #fafafa;
}

/* ビジュアライザー */
.record-visualizer {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  height: 52px;
  width: 100%;
}

.record-wave-idle {
  font-size: 2rem;
  line-height: 52px;
}

.wave-bar {
  width: 6px;
  background: linear-gradient(to top, #2C2C2C, #888);
  border-radius: 3px;
  height: 4px;
  transition: height 0.05s;
}

/* タイマー */
.record-timer {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #e74c3c;
  font-variant-numeric: tabular-nums;
}

/* 録音コントロール */
.record-controls {
  display: flex;
  gap: 10px;
}

.btn-record {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: #e74c3c;
  color: #fff;
  border: none;
  border-radius: 24px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn-record:hover {
  background: #c0392b;
  transform: scale(1.03);
}

.record-dot {
  width: 10px;
  height: 10px;
  background: #fff;
  border-radius: 50%;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

.btn-record-stop {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: #555;
  color: #fff;
  border: none;
  border-radius: 24px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-record-stop:hover {
  background: #333;
}

/* プレビュー & ファイル名 */
.record-preview {
  width: 100%;
  border-radius: 8px;
}

.record-filename {
  font-size: 0.8rem;
  color: #27ae60;
  font-weight: 600;
}

/* --------------------------------------------------------
   ファイルバリデーション
   -------------------------------------------------------- */
.file-name-display.file-error {
  color: #e74c3c;
  font-weight: 600;
  font-size: 0.83rem;
  line-height: 1.6;
}

.file-meta {
  margin-left: 6px;
  font-size: 0.78rem;
  color: #888;
  font-weight: 400;
}
