/* ==========================================================================
   whatsapp-widget.css — Formulario chico "¿Necesitas ayuda personalizada?"
   Se abre anclado al botón flotante de WhatsApp (.float-wa)
   ========================================================================== */

.wa-widget {
  position: fixed;
  right: 26px;
  bottom: 26px;
  z-index: 1250;
  width: min(360px, calc(100vw - 24px));
  display: none;
  opacity: 0;
  transform: translateY(14px) scale(.97);
  transition: opacity .2s ease, transform .2s ease;
}

.wa-widget.open {
  display: block;
  opacity: 1;
  transform: none;
}

.wa-widget .wa-card {
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, .45);
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
}

.wa-widget .wa-head {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 44px 20px 18px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  flex: none;
}

.wa-widget .wa-head-avatar {
  position: relative;
  flex: none;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  display: flex;
  align-items: center;
  justify-content: center;
}

.wa-widget .wa-head-avatar img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.wa-widget .wa-head-avatar svg {
  width: 28px;
  height: 28px;
  color: #fff;
}

.wa-widget .wa-online-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  z-index: 2;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #2bd66f;
  border: 2px solid var(--brand);
}

.wa-widget .wa-head-title {
  font-weight: var(--fw-emphasis);
  font-size: .98rem;
  line-height: 1.3;
  margin-bottom: 4px;
}

.wa-widget .wa-head-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  color: rgba(255, 255, 255, .78);
  line-height: 1.3;
}

.wa-widget .wa-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font-size: .78rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}

.wa-widget .wa-close:hover {
  background: rgba(255, 255, 255, .3);
}

.wa-widget .wa-body {
  padding: 18px;
  overflow-y: auto;
}

.wa-widget .wa-note {
  font-size: .78rem;
  line-height: 1.45;
  color: var(--ink-mid);
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.wa-widget .wa-note b {
  color: var(--err);
}

.wa-widget .wa-req-hint {
  color: var(--ink-soft);
  font-size: .72rem;
}

.wa-widget .wa-error {
  display: none;
  color: var(--err);
  font-size: .8rem;
  margin-bottom: 12px;
  padding: 9px 11px;
  background: #fdf3f2;
  border-radius: 8px;
  border: 1px solid rgba(179, 38, 30, .2);
}

.wa-widget .wa-error.show {
  display: block;
}

.wa-widget .wa-captcha {
  margin-bottom: 14px;
}

.wa-widget .wa-captcha-error {
  display: none;
  color: var(--err);
  font-size: .78rem;
  margin: 8px 0 0;
}

.wa-widget .wa-captcha-error.show {
  display: block;
}

.wa-widget .wa-field {
  margin-bottom: 13px;
}

.wa-widget .wa-field label {
  display: block;
  font-size: .76rem;
  font-weight: var(--fw-emphasis);
  color: var(--ink-mid);
  margin-bottom: 5px;
}

.wa-widget .req-mark {
  font-weight: var(--fw-emphasis);
  color: var(--err);
}

.wa-widget input {
  width: 100%;
  font-family: inherit;
  font-size: .92rem;
  font-weight: var(--fw-body);
  color: var(--ink);
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px 13px;
  transition: border-color .2s, background .2s, box-shadow .2s;
}

.wa-widget input::placeholder {
  color: #aaa;
}

.wa-widget input:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(96, 102, 70, .16);
}

.wa-widget .wa-field.error input,
.wa-widget .wa-field.error .wa-phone-wrap {
  border-color: var(--err);
  background: #fdf3f2;
}

.wa-widget .wa-msg {
  display: none;
  color: var(--err);
  font-size: .72rem;
  margin-top: 4px;
}

.wa-widget .wa-field.error .wa-msg {
  display: block;
}

.wa-widget .wa-phone-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 9px;
  transition: border-color .2s, background .2s, box-shadow .2s;
}

.wa-widget .wa-phone-wrap:focus-within {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(96, 102, 70, .16);
}

.wa-widget .wa-phone-cc {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  padding: 0 10px 0 11px;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
  border-radius: 9px 0 0 9px;
}

.wa-widget .wa-phone-cc:hover {
  background: rgba(0, 0, 0, .03);
}

.wa-widget .wa-phone-cc-flag {
  display: block;
  width: 20px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .08);
}

.wa-widget .wa-phone-cc-dial {
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
}

.wa-widget .wa-phone-cc-chev {
  font-size: .6rem;
  color: #888;
}

.wa-widget .wa-phone-wrap input {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 9px 9px 0;
  min-width: 0;
  flex: 1;
}

.wa-widget .wa-phone-cc-list {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 20;
  width: min(100%, 240px);
  max-height: 200px;
  overflow: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 16px 40px -18px rgba(0, 0, 0, .35);
}

.wa-widget .wa-phone-cc-list[hidden] {
  display: none;
}

.wa-widget .wa-phone-cc-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 7px;
  font-size: .84rem;
  cursor: pointer;
  color: var(--ink);
}

.wa-widget .wa-phone-cc-list li:hover,
.wa-widget .wa-phone-cc-list li[aria-selected="true"] {
  background: var(--surface2);
}

.wa-widget .wa-phone-cc-list li img {
  width: 20px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
}

.wa-widget .wa-phone-cc-list li span {
  margin-left: auto;
  color: var(--ink-mid);
  font-weight: 600;
  font-size: .8rem;
}

.wa-widget .wa-hp {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  overflow: hidden;
}

.wa-widget .wa-submit {
  width: 100%;
  background: var(--brand);
  color: #fff;
  font-family: inherit;
  font-weight: var(--fw-emphasis);
  font-size: .92rem;
  border: 0;
  border-radius: 9px;
  padding: 13px;
  cursor: pointer;
  transition: .25s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 2px;
}

.wa-widget .wa-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.wa-widget .wa-submit:disabled {
  opacity: .65;
  cursor: wait;
}

.wa-widget .wa-submit i {
  font-size: 1rem;
}

.wa-widget .wa-success {
  display: none;
  text-align: center;
  padding: 22px 6px 6px;
}

.wa-widget .wa-success.show {
  display: block;
}

.wa-widget .wa-check {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin: 0 auto 12px;
}

.wa-widget .wa-success p {
  color: var(--ink-soft);
  font-size: .88rem;
  line-height: 1.5;
}

@media (max-width: 480px) {
  .wa-widget {
    right: 12px;
    left: 12px;
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    width: auto;
  }
}
