/*
 * Notificaciones flash globales.
 *
 * CSS independiente del bundle de Tailwind: se sirve directamente en
 * development y mantiene el mismo comportamiento en páginas completas y SPA.
 */

.iok-toast-region {
  position: fixed;
  top: 88px;
  right: 24px;
  z-index: 140;
  display: grid;
  width: min(480px, calc(100vw - 40px));
  gap: 12px;
  pointer-events: none;
}

body[data-role-simulation-active="1"] .iok-toast-region {
  top: 160px;
}

.iok-toast {
  --iok-toast-color: #0076a8;
  --iok-toast-soft: #e9f6fb;
  --iok-toast-border: #b7deed;
  --iok-toast-ring: rgba(0, 118, 168, 0.13);
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 34px;
  align-items: start;
  gap: 14px;
  min-height: 92px;
  overflow: hidden;
  padding: 18px 15px 18px 20px;
  border: 1px solid #d7e0e7;
  border-radius: 15px;
  color: #101828;
  background: #ffffff;
  box-shadow:
    0 16px 36px rgba(15, 23, 42, 0.15),
    0 3px 10px rgba(15, 23, 42, 0.07);
  pointer-events: auto;
  opacity: 0;
  transform: translate3d(26px, -5px, 0) scale(0.97);
}

.iok-toast[data-toast-ready="true"] {
  animation: iok-toast-enter 260ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.iok-toast[data-toast-leaving="true"] {
  animation: iok-toast-leave 210ms ease-in forwards;
  pointer-events: none;
}

.iok-toast:focus-visible {
  outline: 3px solid var(--iok-toast-ring);
  outline-offset: 3px;
}

.iok-toast--success {
  --iok-toast-color: #16803d;
  --iok-toast-soft: #e7f8ed;
  --iok-toast-border: #b8e8c9;
  --iok-toast-ring: rgba(22, 128, 61, 0.12);
}

.iok-toast--error {
  --iok-toast-color: #c62828;
  --iok-toast-soft: #fff0f0;
  --iok-toast-border: #f4c4c4;
  --iok-toast-ring: rgba(198, 40, 40, 0.12);
}

.iok-toast--warning {
  --iok-toast-color: #496577;
  --iok-toast-soft: #eef3f6;
  --iok-toast-border: #c8d8e1;
  --iok-toast-ring: rgba(73, 101, 119, 0.14);
}

.iok-toast--info {
  --iok-toast-color: #0076a8;
  --iok-toast-soft: #e9f6fb;
  --iok-toast-border: #b7deed;
  --iok-toast-ring: rgba(0, 118, 168, 0.13);
}

.iok-toast__accent {
  display: none;
}

.iok-toast__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--iok-toast-border);
  border-radius: 12px;
  color: var(--iok-toast-color);
  background: var(--iok-toast-soft);
  font-size: 20px;
}

.iok-toast__content {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 1px 0 0;
}

.iok-toast__content strong {
  margin: 0 0 5px;
  color: #101828;
  font-family: "Montserrat", "Open Sans", system-ui, sans-serif;
  font-size: 16px;
  font-weight: 750;
  line-height: 1.4;
  letter-spacing: -0.012em;
}

.iok-toast__content > span {
  overflow-wrap: anywhere;
  color: #475467;
  font-family: "Open Sans", "Montserrat", system-ui, sans-serif;
  font-size: 15px;
  font-weight: 450;
  line-height: 1.58;
}

.iok-toast__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-top: -3px;
  border: 1px solid #e1e7ec;
  border-radius: 10px;
  color: #667085;
  background: #f8fafb;
  font-size: 17px;
  cursor: pointer;
  transition:
    color 150ms ease,
    border-color 150ms ease,
    background-color 150ms ease,
    transform 150ms ease;
}

.iok-toast__close:hover,
.iok-toast__close:focus-visible {
  outline: none;
  border-color: rgba(15, 23, 42, 0.09);
  color: #101828;
  background: #f2f4f7;
  transform: scale(1.04);
}

.iok-toast__progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 4px;
  background: var(--iok-toast-color);
  opacity: 0.72;
  transform: scaleX(1);
  transform-origin: left center;
}

.iok-toast[data-toast-running="true"] .iok-toast__progress {
  animation: iok-toast-progress var(--iok-toast-duration, 6000ms) linear forwards;
}

.iok-toast[data-toast-paused="true"] .iok-toast__progress {
  animation-play-state: paused;
}

@keyframes iok-toast-enter {
  from {
    opacity: 0;
    transform: translate3d(26px, -5px, 0) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes iok-toast-leave {
  from {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    opacity: 0;
    transform: translate3d(22px, -4px, 0) scale(0.97);
  }
}

@keyframes iok-toast-progress {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

@media (max-width: 640px) {
  .iok-toast-region {
    top: calc(4.75rem + env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    left: max(12px, env(safe-area-inset-left));
    z-index: 100300;
    width: auto;
    max-height: calc(
      var(--iok-visual-viewport-height, 100dvh) - 5.75rem -
        env(safe-area-inset-top) - env(safe-area-inset-bottom)
    );
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-width: none;
    gap: 10px;
  }

  .iok-toast-region::-webkit-scrollbar {
    display: none;
  }

  body[data-role-simulation-active="1"] .iok-toast-region {
    top: calc(232px + env(safe-area-inset-top));
    max-height: calc(
      var(--iok-visual-viewport-height, 100dvh) - 248px -
        env(safe-area-inset-top) - env(safe-area-inset-bottom)
    );
  }

  .iok-toast {
    grid-template-columns: 44px minmax(0, 1fr) 34px;
    gap: 12px;
    min-height: 88px;
    padding: 16px 12px 16px 16px;
    border-radius: 14px;
  }

  .iok-toast__icon {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    font-size: 19px;
  }

  .iok-toast__content strong {
    margin-bottom: 4px;
    font-size: 15px;
  }

  .iok-toast__content > span {
    font-size: 14px;
    line-height: 1.55;
  }

  .iok-toast__close {
    width: 34px;
    height: 34px;
    margin-top: -3px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .iok-toast,
  .iok-toast[data-toast-ready="true"],
  .iok-toast[data-toast-leaving="true"] {
    animation-duration: 1ms;
  }

  .iok-toast__progress {
    display: none;
  }
}
