/* Voice Order — iFruut
   Botón de micrófono en la barra de búsqueda, overlay de escucha y hoja de revisión.
   Paleta cálida iFruut: verdes #6CA50A / #81C408 / #5E9400, texto #1f2a24, muted #7b8a82. */

:root {
  --vo-green: #6CA50A;
  --vo-green-light: #81C408;
  --vo-green-dark: #5E9400;
  --vo-ink: #1f2a24;
  --vo-muted: #7b8a82;
  --vo-line: #eef1ec;
}

/* ---------- Botón de micrófono dentro del buscador ---------- */
.voice-mic-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-right: 11px;   /* separado del borde redondeado del buscador */
  margin-left: 2px;
  border: none;
  border-radius: 50%;
  /* gradiente más brillante = más notable, mismo tamaño */
  background: linear-gradient(135deg, #95DB1F 0%, #6CA50A 55%, #5E9400 100%);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(94, 148, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.45);
  animation: voiceMicGlow 2.4s ease-in-out infinite;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.voice-mic-btn:active {
  transform: scale(0.92);
  animation: none;
  box-shadow: 0 1px 3px rgba(94, 148, 0, 0.4);
}
/* Halo suave que respira para llamar la atención sin agrandar el botón */
@keyframes voiceMicGlow {
  0%, 100% { box-shadow: 0 3px 10px rgba(94, 148, 0, 0.45), 0 0 0 0 rgba(143, 209, 30, 0.45), inset 0 1px 1px rgba(255, 255, 255, 0.45); }
  50%      { box-shadow: 0 3px 12px rgba(94, 148, 0, 0.55), 0 0 0 6px rgba(143, 209, 30, 0), inset 0 1px 1px rgba(255, 255, 255, 0.45); }
}
@media (prefers-reduced-motion: reduce) {
  .voice-mic-btn { animation: none; }
}

/* ---------- Overlay base (escucha + hoja) ---------- */
.voice-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(20, 30, 24, 0);
  opacity: 0;
  transition: opacity 0.25s ease, background 0.25s ease;
  padding: 0;
}
.voice-overlay.active {
  opacity: 1;
  background: rgba(20, 30, 24, 0.45);
}

/* ---------- Tarjeta de escucha (centrada) ---------- */
.voice-overlay #voiceListeningOverlay,
#voiceListeningOverlay.voice-overlay {
  align-items: center;
}
.voice-listening-card {
  width: min(88%, 380px);
  margin: auto;
  background: #fff;
  border-radius: 24px;
  padding: 30px 24px 22px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(20, 30, 24, 0.3);
  transform: translateY(12px) scale(0.98);
  transition: transform 0.25s ease;
}
.voice-overlay.active .voice-listening-card { transform: translateY(0) scale(1); }

.voice-pulse {
  width: 76px;
  height: 76px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 30px;
  background: linear-gradient(135deg, var(--vo-green-light), var(--vo-green-dark));
  box-shadow: 0 0 0 0 rgba(108, 165, 10, 0.55);
  animation: voicePulse 1.6s infinite;
}
@keyframes voicePulse {
  0%   { box-shadow: 0 0 0 0 rgba(108, 165, 10, 0.5); }
  70%  { box-shadow: 0 0 0 22px rgba(108, 165, 10, 0); }
  100% { box-shadow: 0 0 0 0 rgba(108, 165, 10, 0); }
}

.voice-listening-title { font-size: 19px; font-weight: 700; color: var(--vo-ink); margin: 0 0 6px; }
.voice-listening-hint  { font-size: 13px; color: var(--vo-muted); margin: 0 0 14px; line-height: 1.4; }
.voice-live-text {
  min-height: 22px;
  font-size: 15px;
  color: var(--vo-green-dark);
  font-weight: 600;
  margin: 0 0 18px;
  line-height: 1.4;
}
.voice-listening-actions { display: flex; gap: 10px; }

/* ---------- Hoja de revisión (bottom sheet) ---------- */
/* Columna flex: header fijo + lista con scroll propio + footer (total+botones)
   siempre visible. Así la lista no empuja los botones fuera de pantalla. */
.voice-sheet-card {
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 10px 18px calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(20, 30, 24, 0.25);
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.voice-overlay.active .voice-sheet-card { transform: translateY(0); }

.voice-sheet-handle {
  flex: 0 0 auto;
  width: 40px; height: 4px; border-radius: 4px;
  background: #d8ded6; margin: 8px auto 14px;
}
.voice-sheet-head { flex: 0 0 auto; }
.voice-sheet-title { font-size: 20px; font-weight: 800; color: var(--vo-ink); margin: 0 0 4px; }
.voice-sheet-sub   { font-size: 13px; color: var(--vo-muted); margin: 0 0 14px; }

/* Área scrolleable (la lista de productos) */
.voice-sheet-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* sombra interior sutil arriba/abajo para indicar que hay más */
  margin: 0 -4px;
  padding: 4px;
}

/* Footer fijo: total + botones siempre visibles */
.voice-sheet-foot {
  flex: 0 0 auto;
  padding-top: 4px;
}

.voice-item-list { display: flex; flex-direction: column; gap: 12px; }

/* Tarjeta de producto — estilo premium: sombra suave, sin borde duro */
.voice-item-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 14px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(20, 30, 24, 0.06), 0 7px 20px rgba(20, 30, 24, 0.05);
}
.voice-item-img {
  width: 54px; height: 54px;
  border-radius: 14px;
  object-fit: cover;
  flex: 0 0 auto;
  background: #f1f4ee;
  box-shadow: inset 0 0 0 1px rgba(20, 30, 24, 0.05);
}
.voice-item-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 9px; }
.voice-item-name {
  margin: 0;
  font-size: 15px; font-weight: 600; color: var(--vo-ink);
  letter-spacing: -0.01em; text-transform: capitalize;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding-right: 24px; /* espacio para la × en la esquina */
}

/* Línea inferior: unidad a la izquierda, controles a la derecha (mismo renglón).
   flex-wrap evita que el toggle se encime con el stepper en pantallas angostas. */
.voice-item-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px 10px; flex-wrap: wrap; }
.voice-item-unit { display: flex; align-items: center; gap: 8px; min-width: 0; }
.voice-item-price { font-size: 11.5px; color: var(--vo-muted); white-space: nowrap; }

/* Toggle de unidad estilo segmented control de iOS */
.voice-unit-toggle {
  display: inline-flex; padding: 2px; gap: 2px;
  background: #eef1ec; border-radius: 999px;
}
.voice-unit-opt {
  border: none; background: transparent; color: var(--vo-muted);
  font-size: 11px; font-weight: 600; padding: 4px 11px;
  border-radius: 999px; cursor: pointer; text-transform: lowercase;
  white-space: nowrap; flex: 0 0 auto;
  transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.voice-unit-opt.active {
  background: linear-gradient(135deg, var(--vo-green-light), var(--vo-green-dark));
  color: #fff; box-shadow: 0 2px 6px rgba(94, 148, 0, 0.3);
}
.voice-unit-static {
  font-size: 11px; font-weight: 600; color: var(--vo-green-dark);
  background: #eef7dc; padding: 4px 11px; border-radius: 999px; text-transform: lowercase;
  white-space: nowrap;
}

/* Controles: stepper + total en el mismo renglón */
.voice-item-controls { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.voice-stepper {
  display: inline-flex; align-items: center;
  background: #eef1ec; border-radius: 999px; padding: 2px;
}
.voice-stepper button {
  width: 30px; height: 30px; border: none; border-radius: 50%;
  background: #fff; color: var(--vo-green-dark);
  font-size: 18px; font-weight: 600; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(20, 30, 24, 0.14);
  transition: transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.voice-stepper button:active { transform: scale(0.88); }
.voice-stepper span { min-width: 28px; text-align: center; font-size: 15px; font-weight: 700; color: var(--vo-ink); }
.voice-line-total { font-size: 15px; font-weight: 700; color: var(--vo-ink); white-space: nowrap; min-width: 56px; text-align: right; }

/* Quitar (×) — botón sutil en la esquina, estilo iOS */
.voice-remove {
  position: absolute; top: 9px; right: 9px;
  width: 22px; height: 22px; border: none; border-radius: 50%;
  background: rgba(20, 30, 24, 0.06); color: #9aa6a0;
  font-size: 10px; line-height: 1; cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.voice-remove:active { background: rgba(192, 57, 43, 0.14); color: #c0392b; transform: scale(0.88); }

/* No encontré — neutro y suave (sin amarillo), chips tocables para buscar a mano */
.voice-missing {
  margin-top: 16px;
  padding: 14px;
  background: #f5f7f2;
  border-radius: 16px;
}
.voice-missing-head {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 700; color: var(--vo-muted);
  margin-bottom: 11px; letter-spacing: 0.01em;
}
.voice-missing-head i { color: var(--vo-green-dark); font-size: 12px; }
.voice-missing-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.voice-missing-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 13px; border: none; border-radius: 999px;
  background: #fff; color: var(--vo-ink);
  font-size: 13px; font-weight: 600; text-transform: capitalize; cursor: pointer;
  box-shadow: 0 1px 3px rgba(20, 30, 24, 0.08);
  transition: transform 0.12s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.voice-missing-chip i { font-size: 9px; color: var(--vo-green); }
.voice-missing-chip:active { transform: scale(0.96); box-shadow: 0 1px 2px rgba(20, 30, 24, 0.12); }

/* Estado vacío (no entendió nada) — amable y premium */
.voice-sheet-empty { text-align: center; }
.voice-empty-icon {
  width: 66px; height: 66px; margin: 8px auto 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 27px; color: var(--vo-green-dark);
  background: radial-gradient(circle at 50% 38%, #eef7dc, #e3f0c8);
  box-shadow: inset 0 0 0 1px rgba(94, 148, 0, 0.12);
}
.voice-empty-title { font-size: 19px; font-weight: 800; color: var(--vo-ink); margin: 0 0 8px; letter-spacing: -0.01em; }
.voice-empty-sub { font-size: 14px; color: var(--vo-muted); line-height: 1.5; margin: 0; }
.voice-empty-example { display: inline-block; margin-top: 8px; font-weight: 600; color: var(--vo-green-dark); }
.voice-sheet-empty .voice-missing { text-align: left; margin-top: 18px; }
.voice-sheet-empty .voice-sheet-actions { margin-top: 18px; }

.voice-sheet-total {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 16px 2px 14px; padding-top: 14px; border-top: 1px solid var(--vo-line);
}
.voice-sheet-total span { font-size: 14px; color: var(--vo-muted); }
.voice-sheet-total strong { font-size: 20px; color: var(--vo-ink); }

.voice-sheet-actions { display: flex; gap: 10px; }

/* ---------- Botones ---------- */
.voice-btn {
  flex: 1 1 auto;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 48px; border: none; border-radius: 14px;
  font-size: 15px; font-weight: 700; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.voice-btn-primary {
  background: linear-gradient(135deg, var(--vo-green-light), var(--vo-green-dark));
  color: #fff;
  box-shadow: 0 6px 16px rgba(94, 148, 0, 0.32);
}
.voice-btn-primary:active { transform: translateY(1px); }
.voice-btn-ghost {
  background: #f1f4ee; color: var(--vo-ink); flex: 0 0 auto; padding: 0 18px;
}
