/*
 * voucher.css — the "Have a voucher?" widget.
 * Sits inside .engine-actions on /properties/ and inside any
 * [data-voucher-mount] anchor on other pages. Blends with the
 * existing pill-row aesthetic (rounded, quiet, cream).
 */

.mps-voucher {
  position: relative;
  display: inline-flex;
  align-items: center;
  z-index: 1100; /* Same tier as the currency toggle, above the consent banner. */
}

/* HTML5 hidden attribute is easily overridden by our display:inline-flex
   below. Enforce it so setChip/setIdle/setForm actually hide their targets. */
.mps-voucher [hidden] { display: none !important; }

/* Toggle: subtle secondary link, matches the "All filters" pill weight. */
.mps-voucher-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  background: transparent;
  border: 1px dashed rgba(19, 27, 45, 0.22);
  color: var(--mps-ink, #131b2d);
  font-family: -apple-system, "Inter", sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}
.mps-voucher-toggle:hover {
  background: #fbf8f1;
  border-color: #c7b08f;
  color: #354766;
}
.mps-voucher-toggle-icon { font-size: 0.95rem; opacity: 0.85; }

/* The expanded form. Stays inline on desktop; wraps beneath on narrow screens. */
.mps-voucher-form {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: 0.5rem;
  padding: 0.25rem 0.35rem 0.25rem 0.5rem;
  background: #fff;
  border: 1px solid #d9c9a3;
  border-radius: 999px;
  box-shadow: 0 4px 10px rgba(53, 71, 102, 0.08);
}
.mps-voucher-input {
  border: 0;
  padding: 0.35rem 0.6rem;
  background: transparent;
  font-family: -apple-system, "Inter", sans-serif;
  font-size: 0.85rem;
  color: var(--mps-ink, #131b2d);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  min-width: 12rem;
}
.mps-voucher-input:focus { outline: none; }
.mps-voucher-input::placeholder { color: #a09380; letter-spacing: 0.01em; }

.mps-voucher-apply {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 0;
  background: #354766;
  color: #fff;
  font-family: -apple-system, "Inter", sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease;
}
.mps-voucher-apply:hover { background: #263453; }

.mps-voucher-cancel {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: #999;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.mps-voucher-cancel:hover { background: #f0e7d3; color: #354766; }

.mps-voucher-msg {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-family: -apple-system, "Inter", sans-serif;
  background: #fff8e6;
  color: #6b5810;
  border: 1px solid #f2dfa8;
}
.mps-voucher-msg.is-err {
  background: #fbeaea;
  color: #7b2a2a;
  border-color: #f0c4c4;
}
.mps-voucher-msg.is-info {
  background: #eaf3fb;
  color: #24547e;
  border-color: #c4dbef;
}

/* Applied chip. Green success tone, dismiss with × on the right. */
.mps-voucher-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.4rem 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(30, 190, 91, 0.10);
  border: 1px solid rgba(30, 190, 91, 0.4);
  color: #275b3b;
  font-family: -apple-system, "Inter", sans-serif;
  font-size: 0.85rem;
}
.mps-voucher-chip-tick {
  display: inline-grid;
  place-items: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #1ebe5b;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}
.mps-voucher-chip-body {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
}
.mps-voucher-chip-code {
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #1a4128;
}
.mps-voucher-chip-label {
  color: #2b5a3e;
  opacity: 0.85;
}
.mps-voucher-chip-remove {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.6);
  color: #2b5a3e;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.mps-voucher-chip-remove:hover { background: #fff; color: #7b2a2a; }

/* Compact on narrow screens: full-width row under the search bar. */
@media (max-width: 720px) {
  .mps-voucher { width: 100%; justify-content: center; }
  .mps-voucher-form { margin-left: 0; width: 100%; }
  .mps-voucher-input { flex: 1 1 auto; min-width: 0; }
}
