/* ==== App CSS — SnapiCal ==== */
/* SnapiCal-specific styles: photo upload area, meal result card, macro bars,
   daily log, entry cards, settings form. Built on design.css tokens. */

.snap-area { display: grid; gap: var(--space-3); }
.upload-pick {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3);
}
.upload-pick .btn { min-height: 88px; }
.camera-preview {
  width: 100%; aspect-ratio: 4/3; border: 2px dashed var(--border);
  border-radius: var(--radius-m); background: var(--surface-2);
  display: grid; place-items: center; color: var(--muted); overflow: hidden;
}
.camera-preview img { width: 100%; height: 100%; object-fit: cover; display: none; }
.camera-preview .empty-text { display: block; font-size: 13px; }

.meal-card { margin-top: var(--space-4); }
.meal-thumb {
  width: 100%; height: 180px; border-radius: var(--radius-m); object-fit: cover;
  background: var(--surface-2); border: 1px solid var(--border);
}
.item-row {
  display: flex; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-2) 0; border-bottom: 1px solid var(--surface-2);
}
.item-row:last-child { border-bottom: 0; }
.item-name { font-weight: 600; min-width: 110px; }
.item-meta { text-align: right; font-size: 13px; color: var(--text-2); }
.item-kcal { font-weight: 700; color: var(--text); }
.note-input { margin-top: var(--space-2); width: 100%; }

.meal-actions { display: grid; grid-template-columns: 1fr; gap: var(--space-2); margin-top: var(--space-3); }

/* Daily summary */
.summary-card { margin-top: var(--space-4); }
.goal-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); margin-bottom: var(--space-2); }
.goal-value { font-size: 28px; font-weight: 800; }
.goal-label { font-size: 13px; color: var(--muted); }
.progress-track {
  width: 100%; height: 10px; background: var(--surface-2); border-radius: 999px;
  overflow: hidden; border: 1px solid var(--border);
}
.progress-fill { height: 100%; background: var(--accent); border-radius: 999px; width: 0%; transition: width .3s ease; }
.macro-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-2); margin-top: var(--space-3); }
.macro-item { text-align: center; }
.macro-item .value { font-size: 14px; font-weight: 700; display: block; }
.macro-item .label { font-size: 11px; color: var(--muted); display: block; margin-top: var(--space-1); }

/* Log list */
.log-group { margin-bottom: var(--space-6); }
.log-group-title { font-size: 14px; font-weight: 700; color: var(--text-2); margin: 0 0 var(--space-2) var(--space-4); padding-bottom: var(--space-1); border-bottom: 2px solid var(--border); display: inline-block; }
.entry-card {
  display: flex; gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--border);
  border-radius: var(--radius-m); background: var(--surface); margin-bottom: var(--space-2); align-items: center;
}
.entry-thumb { width: 72px; height: 72px; border-radius: var(--radius-s); object-fit: cover; background: var(--surface-2); border: 1px solid var(--border); flex-shrink: 0; }
.entry-info { flex: 1; min-width: 0; }
.entry-title { font-weight: 700; font-size: 15px; }
.entry-meta { font-size: 12px; color: var(--muted); margin-top: var(--space-1); }
.entry-kcal { font-weight: 800; font-size: 17px; margin-left: auto; white-space: nowrap; }
.entry-note { font-size: 12px; color: var(--text-2); margin-top: var(--space-1); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-actions { display: flex; gap: var(--space-1); margin-top: var(--space-2); }
.entry-actions .btn { width: auto; padding: 0 var(--space-3); font-size: 12px; min-height: 36px; }

.empty-state.log { padding: var(--space-8) var(--space-4); }

/* Settings */
.settings-form { display: grid; gap: var(--space-3); margin-top: var(--space-2); }
.goal-input-row { display: flex; gap: var(--space-2); align-items: center; }
.goal-input-row .input { flex: 1; max-width: 140px; }

/* Undo banner shown inline near top of log */
.undo-banner {
  position: fixed; top: calc(56px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-m); z-index: 60;
  box-shadow: var(--shadow-1); display: none; gap: var(--space-3); align-items: center;
}
.undo-banner.show { display: flex; }

/* RTL adjustments for log */
[dir="rtl"] .entry-kcal { margin-left: 0; margin-right: auto; }
[dir="rtl"] .entry-actions { direction: ltr; }
