/* =========================================================
   EMOTIA · MENSAJES Y CONFIRMACIONES GLOBALES
   v0.40.22 · 2026-08-18
   ========================================================= */

:root {
  --emotia-feedback-ink: #311538;
  --emotia-feedback-wine: #6f335a;
  --emotia-feedback-wine-deep: #512044;
  --emotia-feedback-rose: #fbf4f8;
  --emotia-feedback-line: #ead9e4;
  --emotia-feedback-muted: #786a78;
  --emotia-feedback-shadow: 0 28px 80px rgba(48, 20, 43, .24);
  --emotia-feedback-success: #2f815c;
  --emotia-feedback-warning: #a56d16;
  --emotia-feedback-danger: #a23f51;
}

.emotia-feedback-dialog {
  width: min(520px, calc(100vw - 28px));
  max-width: 520px;
  margin: auto;
  padding: 0;
  border: 1px solid rgba(111, 51, 90, .18);
  border-radius: 22px;
  overflow: hidden;
  color: var(--emotia-feedback-ink);
  background: rgba(255, 253, 254, .995);
  box-shadow: var(--emotia-feedback-shadow);
  font-family: "DM Sans", Arial, sans-serif;
}

.emotia-feedback-dialog::backdrop {
  background: rgba(35, 20, 33, .48);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.emotia-feedback-dialog[open] {
  animation: emotia-feedback-dialog-in .18s ease-out both;
}

@keyframes emotia-feedback-dialog-in {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.emotia-feedback-card {
  display: grid;
  min-width: 0;
}

.emotia-feedback-head {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 38px;
  gap: 12px;
  align-items: center;
  padding: 17px 18px 16px 20px;
  border-bottom: 1px solid var(--emotia-feedback-line);
  background: linear-gradient(90deg, rgba(111, 51, 90, .095), rgba(247, 231, 239, .65) 62%, rgba(255,255,255,.45));
  box-shadow: inset 4px 0 0 rgba(111, 51, 90, .34);
}

.emotia-feedback-symbol {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(111, 51, 90, .09);
  color: var(--emotia-feedback-wine);
  font-size: 1.05rem;
  font-weight: 900;
}

.emotia-feedback-dialog[data-tone="warning"] .emotia-feedback-symbol {
  background: rgba(204, 147, 50, .13);
  color: var(--emotia-feedback-warning);
}
.emotia-feedback-dialog[data-tone="danger"] .emotia-feedback-symbol,
.emotia-feedback-dialog[data-tone="error"] .emotia-feedback-symbol {
  background: rgba(176, 65, 84, .11);
  color: var(--emotia-feedback-danger);
}
.emotia-feedback-dialog[data-tone="success"] .emotia-feedback-symbol {
  background: rgba(48, 139, 94, .11);
  color: var(--emotia-feedback-success);
}

.emotia-feedback-copy { min-width: 0; }
.emotia-feedback-kicker {
  margin: 0 0 3px;
  color: #9b6688;
  font-size: .58rem;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.emotia-feedback-title {
  margin: 0;
  color: #2f1738;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.24rem;
  line-height: 1.15;
  font-weight: 700;
}
.emotia-feedback-close {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(111, 51, 90, .14);
  border-radius: 12px;
  background: rgba(255,255,255,.78);
  color: var(--emotia-feedback-wine);
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.emotia-feedback-close:hover,
.emotia-feedback-close:focus-visible {
  border-color: rgba(111, 51, 90, .38);
  background: #fff;
}

.emotia-feedback-body {
  display: grid;
  gap: 13px;
  padding: 20px 21px 19px;
}
.emotia-feedback-message {
  margin: 0;
  color: #574758;
  font-size: .94rem;
  line-height: 1.58;
  white-space: pre-line;
}
.emotia-feedback-field {
  display: grid;
  gap: 7px;
}
.emotia-feedback-field-label {
  color: #6d586b;
  font-size: .76rem;
  font-weight: 800;
}
.emotia-feedback-input {
  width: 100%;
  min-height: 46px;
  border: 1px solid #dcbfd2;
  border-radius: 13px;
  background: #fff;
  padding: 0 13px;
  color: var(--emotia-feedback-ink);
  font: inherit;
  outline: none;
}
.emotia-feedback-input:focus {
  border-color: rgba(111,51,90,.58);
  box-shadow: 0 0 0 3px rgba(111,51,90,.08);
}
.emotia-feedback-input.is-error {
  border-color: rgba(162,63,81,.62);
}
.emotia-feedback-field-error {
  min-height: 1em;
  color: var(--emotia-feedback-danger);
  font-size: .72rem;
  font-weight: 700;
}

.emotia-feedback-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 20px 18px;
  border-top: 1px solid rgba(234,217,228,.85);
  background: rgba(255,255,255,.82);
}
.emotia-feedback-button {
  min-height: 44px;
  padding: 0 17px;
  border: 1px solid #dfcad7;
  border-radius: 13px;
  font: inherit;
  font-size: .88rem;
  font-weight: 800;
  cursor: pointer;
}
.emotia-feedback-button.secondary {
  background: #fff;
  color: #7b3f67;
}
.emotia-feedback-button.primary {
  border-color: var(--emotia-feedback-wine);
  background: linear-gradient(100deg, var(--emotia-feedback-wine-deep), #7b2c61);
  color: #fff;
  box-shadow: 0 10px 24px rgba(91, 32, 75, .16);
}
.emotia-feedback-dialog[data-tone="danger"] .emotia-feedback-button.primary,
.emotia-feedback-dialog[data-tone="error"] .emotia-feedback-button.primary {
  border-color: #9d3b4e;
  background: linear-gradient(100deg, #873245, #a94458);
}
.emotia-feedback-button:hover { transform: translateY(-1px); }
.emotia-feedback-button:focus-visible,
.emotia-feedback-close:focus-visible {
  outline: 3px solid rgba(111,51,90,.18);
  outline-offset: 2px;
}

/* Toasts. El host usa Popover API cuando está disponible para vivir en top-layer. */
.emotia-feedback-toasts {
  position: fixed;
  z-index: 2147483000;
  top: 18px;
  right: 18px;
  left: auto;
  bottom: auto;
  width: min(390px, calc(100vw - 30px));
  max-width: 390px;
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: none;
  overflow: visible;
}
.emotia-feedback-toasts[popover] {
  inset: 18px 18px auto auto;
}
.emotia-feedback-toasts:popover-open {
  display: grid;
}

.emotia-feedback-toast {
  position: relative;
  display: grid;
  grid-template-columns: 31px minmax(0,1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid rgba(111,51,90,.16);
  border-radius: 15px;
  background: rgba(255,253,254,.985);
  color: var(--emotia-feedback-ink);
  box-shadow: 0 16px 42px rgba(51,22,46,.19), inset 4px 0 0 rgba(111,51,90,.52);
  pointer-events: auto;
  animation: emotia-feedback-toast-in .2s ease-out both;
}
@keyframes emotia-feedback-toast-in {
  from { opacity: 0; transform: translateY(-8px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.emotia-feedback-toast.is-leaving {
  opacity: 0;
  transform: translateY(-6px) scale(.99);
  transition: opacity .18s ease, transform .18s ease;
}
.emotia-feedback-toast[data-tone="success"] { box-shadow: 0 16px 42px rgba(51,22,46,.16), inset 4px 0 0 rgba(47,129,92,.62); }
.emotia-feedback-toast[data-tone="warning"] { box-shadow: 0 16px 42px rgba(51,22,46,.16), inset 4px 0 0 rgba(165,109,22,.68); }
.emotia-feedback-toast[data-tone="error"],
.emotia-feedback-toast[data-tone="danger"] { box-shadow: 0 16px 42px rgba(51,22,46,.16), inset 4px 0 0 rgba(162,63,81,.7); }
.emotia-feedback-toast-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(111,51,90,.08);
  color: var(--emotia-feedback-wine);
  font-size: .88rem;
  font-weight: 900;
}
.emotia-feedback-toast[data-tone="success"] .emotia-feedback-toast-icon { color: var(--emotia-feedback-success); background: rgba(47,129,92,.09); }
.emotia-feedback-toast[data-tone="warning"] .emotia-feedback-toast-icon { color: var(--emotia-feedback-warning); background: rgba(165,109,22,.10); }
.emotia-feedback-toast[data-tone="error"] .emotia-feedback-toast-icon,
.emotia-feedback-toast[data-tone="danger"] .emotia-feedback-toast-icon { color: var(--emotia-feedback-danger); background: rgba(162,63,81,.09); }
.emotia-feedback-toast-text { min-width: 0; }
.emotia-feedback-toast-title {
  display: block;
  margin: 0 0 1px;
  color: #3a213e;
  font-size: .76rem;
  font-weight: 800;
}
.emotia-feedback-toast-message {
  display: block;
  color: #665665;
  font-size: .79rem;
  line-height: 1.38;
  overflow-wrap: anywhere;
}
.emotia-feedback-toast-action,
.emotia-feedback-toast-close {
  border: 0;
  background: transparent;
  color: #7a3d66;
  font: inherit;
  font-size: .74rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.emotia-feedback-toast-action {
  padding: 7px 9px;
  border: 1px solid #e1cfda;
  border-radius: 10px;
  background: #fff;
}
.emotia-feedback-toast-close {
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 1rem;
}

/* Página: mensajes persistentes comparten el mismo idioma visual. */
:is(.alert, .account-alert, .notice)[role="alert"],
:is(.alert, .account-alert, .notice)[role="status"] {
  border-radius: 14px !important;
  border: 1px solid rgba(111,51,90,.15) !important;
  box-shadow: inset 4px 0 0 rgba(111,51,90,.32) !important;
  background: linear-gradient(90deg, rgba(111,51,90,.055), rgba(255,255,255,.82)) !important;
  color: #5d4d5d !important;
}
:is(.alert, .account-alert, .notice).error[role="alert"] {
  border-color: rgba(162,63,81,.18) !important;
  box-shadow: inset 4px 0 0 rgba(162,63,81,.58) !important;
  background: linear-gradient(90deg, rgba(162,63,81,.07), rgba(255,255,255,.9)) !important;
  color: #7e3444 !important;
}

body.emotia-feedback-open { overflow: hidden !important; }

@media (max-width: 620px) {
  .emotia-feedback-dialog {
    width: calc(100vw - 18px);
    border-radius: 18px;
  }
  .emotia-feedback-head {
    grid-template-columns: 40px minmax(0, 1fr) 36px;
    gap: 9px;
    padding: 14px 13px 13px 15px;
  }
  .emotia-feedback-symbol { width: 38px; height: 38px; border-radius: 12px; }
  .emotia-feedback-title { font-size: 1.12rem; }
  .emotia-feedback-body { padding: 17px 16px 16px; }
  .emotia-feedback-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 12px 15px 15px;
  }
  .emotia-feedback-actions .emotia-feedback-button:only-child { grid-column: 1 / -1; }
  .emotia-feedback-toasts,
  .emotia-feedback-toasts[popover] {
    top: 10px;
    right: 10px;
    width: calc(100vw - 20px);
    max-width: none;
    inset: 10px 10px auto auto;
  }
}

/* Cuando existe un modal nativo, el host se monta dentro de ese diálogo para
   participar de su misma top-layer y no depender del z-index de la página. */
.emotia-feedback-toasts.is-in-dialog,
.emotia-feedback-toasts.is-in-dialog[popover] {
  position: absolute;
  top: 12px;
  right: 12px;
  left: auto;
  bottom: auto;
  inset: 12px 12px auto auto;
  width: min(370px, calc(100% - 24px));
  max-width: 370px;
  z-index: 2147483000;
}
@media (max-width: 620px) {
  .emotia-feedback-toasts.is-in-dialog,
  .emotia-feedback-toasts.is-in-dialog[popover] {
    top: 8px;
    right: 8px;
    inset: 8px 8px auto auto;
    width: calc(100% - 16px);
  }
}
