/* ============================================================
   CafeDaily — shared interaction runtime styles
   Toast, bottom-sheet, confirm, ripple, form controls.
   Reuses Brew Lab tokens; scoped inside the .device frame.
   ============================================================ */

/* ---- Toast ---- */
.cui-toasts {
  position: absolute;
  left: 0; right: 0; bottom: 74px;
  z-index: 60;
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  pointer-events: none;
  padding: 0 1rem;
}
.cui-toast {
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: 0.55rem;
  max-width: 100%;
  background: var(--ink); color: var(--bg);
  border-radius: 12px; padding: 0.62rem 0.9rem;
  font-size: 0.85rem; font-weight: 500;
  box-shadow: var(--shadow-lift);
  transform: translateY(12px); opacity: 0;
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.cui-toast.in { transform: none; opacity: 1; }
.cui-toast .ic { flex: none; line-height: 0; }
.cui-toast.ok .ic { color: var(--sage); }
.cui-toast.warn .ic { color: var(--crema); }
.cui-toast.err .ic { color: var(--garnet); }

/* ---- Bottom sheet ---- */
.cui-scrim {
  position: absolute; inset: 0; z-index: 70;
  background: rgba(10, 7, 4, 0.45);
  opacity: 0; transition: opacity 0.28s var(--ease);
  backdrop-filter: blur(2px);
}
.cui-scrim.in { opacity: 1; }
.cui-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 71;
  background: var(--bg);
  border-radius: 22px 22px 0 0;
  border-top: 1px solid var(--line);
  box-shadow: 0 -12px 40px -12px rgba(0,0,0,0.4);
  max-height: 86%; display: flex; flex-direction: column;
  transform: translateY(102%);
  transition: transform 0.34s var(--ease);
}
.cui-sheet.in { transform: none; }
.cui-sheet .grip {
  width: 38px; height: 4px; border-radius: 999px; background: var(--line-strong);
  margin: 0.6rem auto 0.2rem; flex: none;
}
.cui-sheet .sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 1.1rem 0.7rem; border-bottom: 1px solid var(--line); flex: none;
}
.cui-sheet .sheet-head .ttl { font-family: var(--sc-head, var(--body)); font-weight: 700; font-size: 1.05rem; }
.cui-sheet .sheet-body { overflow-y: auto; padding: 1rem 1.1rem 1.4rem; }
@media (prefers-reduced-motion: reduce) {
  .cui-toast, .cui-scrim, .cui-sheet { transition: none; }
}

/* ---- Form controls (used inside sheets) ---- */
.cui-field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.9rem; }
.cui-field label { font-size: 0.72rem; font-weight: 600; color: var(--ink-2); }
.cui-field input, .cui-field select, .cui-field textarea {
  width: 100%; font: inherit; font-size: 0.9rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 0.6rem 0.75rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.cui-field input:focus, .cui-field select:focus, .cui-field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 18%, transparent);
}
.cui-field textarea { resize: vertical; min-height: 64px; }
.cui-seg-in { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.cui-seg-in button {
  border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 0.4rem 0.8rem; font-size: 0.82rem; color: var(--ink-2);
  transition: all 0.18s var(--ease);
}
.cui-seg-in button[aria-pressed="true"] {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
}

/* live toggle switch (interactive) */
.cui-switch {
  --w: 42px; --h: 24px; position: relative; width: var(--w); height: var(--h);
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--ring-track);
  flex: none; transition: background-color 0.24s var(--ease), border-color 0.24s;
}
.cui-switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: calc(var(--h) - 6px); height: calc(var(--h) - 6px);
  border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: transform 0.24s var(--ease);
}
.cui-switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.cui-switch[aria-checked="true"]::after { transform: translateX(calc(var(--w) - var(--h))); background: var(--accent-ink); }

/* ripple on press */
.cui-ripple { position: relative; overflow: hidden; }
.cui-ripple > .rip {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: currentColor; opacity: 0.18; transform: scale(0);
  animation: cui-rip 0.5s var(--ease);
}
@keyframes cui-rip { to { transform: scale(2.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cui-ripple > .rip { display: none; } }

/* count-up number flash on data change */
.cui-flash { animation: cui-flash 0.5s var(--ease); }
@keyframes cui-flash { 0% { color: var(--accent); } 100% {} }
