/* pantry-vision frontend styling (docs/project-plan.md Phase 17). Touch targets are
 * deliberately large — this is a kitchen-counter finger interface. */

* {
  box-sizing: border-box;
}

/* Several elements below are flex/grid containers that the JS shows and hides with
 * the `hidden` attribute. A `display:` rule in a stylesheet outranks the user agent's
 * own `[hidden] { display: none }`, so without this every one of them would be
 * permanently visible — the camera included. */
[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  height: 100%;
  background: #101014;
  color: #e8e8ec;
  font-family: sans-serif;
  overflow: hidden;
}

#tabs {
  display: flex;
  height: 84px;
  background: rgba(16, 16, 20, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: transparent;
  border: none;
  color: #9a9aa6;
  font-size: 26px;
}

.tab span {
  font-size: 13px;
  font-weight: 500;
}

.tab.active {
  color: #e8e8ec;
  background: rgba(110, 168, 254, 0.16);
}

main {
  height: calc(100% - 84px);
  overflow-y: auto;
}

.panel {
  display: none;
  padding: 16px;
}

.panel.active {
  display: block;
}

/* --- Home: the four stock movements ------------------------------------------ */
.action-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 140px;
  padding: 12px;
  border: none;
  border-radius: 16px;
  background: rgba(110, 168, 254, 0.16);
  color: #e8e8ec;
  font-size: 34px;
}

.action-btn span {
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

.action-btn:active {
  background: rgba(110, 168, 254, 0.3);
}

/* --- Flow screens ------------------------------------------------------------ */
.flow-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.flow-head h1 {
  flex: 1;
  margin: 0;
  font-size: 20px;
}

.back-btn, .flow-action {
  min-height: 44px;
  padding: 0 14px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  color: #e8e8ec;
  font-size: 15px;
}

.flow-badge {
  font-size: 14px;
  color: #9a9aa6;
}

/* --- Scan ------------------------------------------------------------------- */
#scanner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

#camera-preview {
  width: 100%;
  max-width: 640px;
  max-height: 38vh;
  object-fit: cover;
  border-radius: 12px;
  background: #000;
}

.lead {
  width: 100%;
  max-width: 640px;
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.total-line {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #6ea8fe;
}

.field-row {
  display: flex;
  gap: 12px;
}

.field-row label {
  flex: 1;
}

.quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.quick-btn {
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: #1a1a20;
  color: #e8e8ec;
  font-size: 16px;
}

#consume-result, #consume-amount {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#consume-amount label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  color: #9a9aa6;
}

#consume-amount input {
  min-height: 48px;
  font-size: 16px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #1a1a20;
  color: #e8e8ec;
}

/* --- Edit inventory ---------------------------------------------------------- */
.group {
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.group > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 16px;
  cursor: pointer;
}

.edit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.step-btn {
  min-width: 52px;
  min-height: 48px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  color: #e8e8ec;
  font-size: 22px;
}

.amount-input {
  width: 84px;
  min-height: 48px;
  text-align: center;
  font-size: 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #1a1a20;
  color: #e8e8ec;
}

.where-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 10px;
}

.where-row .hint {
  flex: 1;
  min-width: 180px;
}

.where-move {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #9a9aa6;
}

.where-select {
  min-height: 44px;
  font-size: 15px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #1a1a20;
  color: #e8e8ec;
}

.row-btn {
  min-height: 48px;
  padding: 0 14px;
  border: none;
  border-radius: 10px;
  background: #6ea8fe;
  color: #101014;
  font-size: 15px;
  font-weight: 600;
}

.card.choice {
  width: 100%;
  border: none;
  text-align: left;
  color: #e8e8ec;
}

/* --- Toast ------------------------------------------------------------------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  margin: 0;
  padding: 14px 22px;
  border-radius: 12px;
  background: rgba(20, 20, 26, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 16px;
  max-width: 90vw;
}

.big-btn {
  min-height: 64px;
  min-width: 200px;
  font-size: 18px;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  color: #101014;
  background: #6ea8fe;
}

.big-btn.secondary {
  background: rgba(255, 255, 255, 0.14);
  color: #e8e8ec;
}

.big-btn.primary {
  background: #6ea8fe;
}

#confirm-form {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#confirm-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  color: #9a9aa6;
}

#confirm-form input, #confirm-form select {
  min-height: 48px;
  font-size: 16px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #1a1a20;
  color: #e8e8ec;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.hint {
  color: #9a9aa6;
  font-size: 14px;
}

.error {
  color: #ff8080;
  font-size: 14px;
}

/* --- Cards (inventory + recipes) --------------------------------------------- */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 16px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.card-name {
  flex: 1;
  font-size: 16px;
  font-weight: 500;
}

.card-amount {
  color: #9a9aa6;
  font-size: 14px;
}

.card-due {
  font-size: 14px;
  color: #9a9aa6;
  min-width: 110px;
  text-align: right;
}

.urgent-week {
  background: rgba(255, 200, 80, 0.10);
}
.urgent-week .card-due {
  color: #ffc850;
}

.urgent-soon {
  background: rgba(255, 140, 80, 0.14);
}
.urgent-soon .card-due {
  color: #ff8c50;
}

.urgent-expired {
  background: rgba(255, 90, 90, 0.16);
}
.urgent-expired .card-due {
  color: #ff5a5a;
}
