/* ============================================================
   らーめんつづき 店舗管理アプリ スタイル
   ============================================================ */

:root {
  --primary:      #c0392b;
  --primary-dark: #96281b;
  --primary-light:#e74c3c;
  --accent:       #e67e22;
  --success:      #27ae60;
  --warning:      #f39c12;
  --danger:       #e74c3c;
  --bg:           #f5f5f5;
  --card-bg:      #ffffff;
  --text:         #2c3e50;
  --text-light:   #7f8c8d;
  --border:       #ecf0f1;
  --shadow:       0 2px 8px rgba(0,0,0,0.1);
  --radius:       12px;
  --radius-sm:    8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   ヘッダー
   ============================================================ */
.app-header {
  background: var(--primary);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.app-header h1 {
  font-size: 17px;
  font-weight: 700;
}

.store-badge {
  background: rgba(255,255,255,0.2);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
}

/* ============================================================
   メインコンテンツ
   ============================================================ */
.main-content {
  padding: 16px;
  max-width: 480px;
  margin: 0 auto;
}

/* ============================================================
   カード
   ============================================================ */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

/* ============================================================
   メニュー（ホーム画面）
   ============================================================ */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.menu-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: white;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: var(--text);
  gap: 10px;
}

.menu-btn:active {
  transform: scale(0.96);
  border-color: var(--primary);
}

.menu-icon {
  font-size: 36px;
  color: var(--text-light);
}
.menu-btn.primary-action .menu-icon {
  color: var(--primary);
}
.header-icon {
  font-size: 20px;
  vertical-align: middle;
}

.menu-btn .label {
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  line-height: 1.4;
}

.menu-btn.primary-action {
  border-color: var(--primary);
  background: #fff5f5;
}

/* ============================================================
   ボタン
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  width: 100%;
}

.btn:active { opacity: 0.8; transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary   { background: var(--primary);  color: white; }
.btn-success   { background: var(--success);  color: white; }
.btn-warning   { background: var(--warning);  color: white; }
.btn-danger    { background: var(--danger);   color: white; }
.btn-outline   { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-gray      { background: #ecf0f1; color: var(--text); }

.btn-lg { padding: 18px 24px; font-size: 17px; border-radius: var(--radius); }
.btn-sm { padding: 8px 16px; font-size: 13px; }

/* ============================================================
   カメラ / 写真プレビュー
   ============================================================ */
.camera-container {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 3/4;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-video, .camera-canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 20px;
  background: linear-gradient(transparent 60%, rgba(0,0,0,0.6));
}

.capture-btn {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: white;
  border: 4px solid rgba(255,255,255,0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: transform 0.1s;
}

.capture-btn:active { transform: scale(0.9); }

.camera-guide {
  background: rgba(0,0,0,0.5);
  color: white;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 20px;
  margin-bottom: 16px;
  text-align: center;
}

.preview-image {
  width: 100%;
  border-radius: var(--radius);
  display: block;
}

/* ============================================================
   読み取り結果テーブル
   ============================================================ */
.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.result-table th {
  background: #f8f9fa;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--text-light);
  font-size: 11px;
  border-bottom: 1px solid var(--border);
}

.result-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.result-table tr:last-child td { border-bottom: none; }

.result-table .amount { text-align: right; font-weight: 600; }
.result-table .qty    { text-align: center; }

.result-table input[type="number"] {
  width: 70px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-align: center;
  font-size: 14px;
}

.result-table input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
}

.total-row {
  background: #f0f7f4;
  font-weight: 700;
}

/* ============================================================
   アラート
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.alert-icon { font-size: 20px; flex-shrink: 0; line-height: 1; }
.alert-warning { background: #fef9e7; border-left: 4px solid var(--warning); }
.alert-success { background: #eafaf1; border-left: 4px solid var(--success); }
.alert-danger  { background: #fdedec; border-left: 4px solid var(--danger); }
.alert-info    { background: #eaf4fb; border-left: 4px solid #3498db; }

/* ============================================================
   セグメントコントロール（昼/夜選択）
   ============================================================ */
.segment-control {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
}

.segment-btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--text-light);
  transition: all 0.2s;
}

.segment-btn.active {
  background: white;
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

/* ============================================================
   棚卸し入力
   ============================================================ */
.inventory-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

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

.inventory-item-name {
  font-size: 14px;
  font-weight: 500;
  flex: 1;
}

.inventory-item-unit {
  font-size: 12px;
  color: var(--text-light);
  margin-right: 8px;
}

.inventory-input {
  width: 80px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 16px;
  -webkit-appearance: none;
}

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

.inventory-amount {
  font-size: 13px;
  color: var(--text-light);
  min-width: 70px;
  text-align: right;
}

/* ============================================================
   ローディング
   ============================================================ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  color: white;
  gap: 16px;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text { font-size: 15px; font-weight: 500; }

/* ============================================================
   昼/夜 自動判定バー
   ============================================================ */
.period-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #eaf4fb;
  border-left: 4px solid #3498db;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
}

.period-bar-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #2980b9;
}

.period-bar-info .material-icons {
  font-size: 22px;
}

.period-toggle-btn {
  background: none;
  border: 1px solid #3498db;
  color: #3498db;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* ============================================================
   成功アイコン
   ============================================================ */
.success-icon {
  font-size: 72px;
  color: var(--success);
  margin-bottom: 16px;
}

/* ============================================================
   今日の状況
   ============================================================ */
.today-status-placeholder {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  color: var(--text-light);
  font-size: 14px;
  padding: 8px 0;
}

.today-status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.today-status-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.today-status-chip.done {
  background: #eafaf1;
  color: var(--success);
}

.today-status-chip.missing {
  background: #fdedec;
  color: var(--danger);
}

.today-status-chip .material-icons {
  font-size: 28px;
}

.today-status-chip .period-row {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 14px;
  font-weight: 700;
}

.today-status-chip .period-row .material-icons {
  font-size: 15px;
}

/* ============================================================
   ページ管理
   ============================================================ */
.page { display: none; }
.page.active { display: block; }

/* ============================================================
   フォーム
   ============================================================ */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text);
  background: white;
  -webkit-appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(192,57,43,0.1);
}

/* ============================================================
   確信度バッジ
   ============================================================ */
.confidence-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.confidence-high   { background: #eafaf1; color: var(--success); }
.confidence-medium { background: #fef9e7; color: var(--warning); }
.confidence-low    { background: #fdedec; color: var(--danger); }

/* ============================================================
   ログイン画面
   ============================================================ */
.login-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background: var(--primary);
}

.login-logo {
  margin-bottom: 8px;
  color: white;
}
.login-logo .material-icons {
  font-size: 64px;
}

.login-title {
  color: white;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.login-subtitle {
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  margin-bottom: 32px;
}

.login-card {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow);
}
