/* shared/css/app-modal.css
   Estilos del componente AppModal (alert/confirm/prompt/toast reutilizable).

   Usa los tokens de tokens.css cuando están cargados y cae en un valor
   equivalente cuando la página todavía no los incluye. No declara :root:
   el único :root del sitio vive en tokens.css. */

.app-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(36, 33, 30, 0.55);
  padding: 16px;
  font-family: var(--font-sans, "DM Sans", system-ui, -apple-system, sans-serif);
}

.app-modal-overlay.is-open {
  display: flex;
}

.app-modal {
  width: 100%;
  max-width: 420px;
  background: var(--surface, #ffffff);
  border-radius: var(--r-lg, 12px);
  box-shadow: 0 20px 45px rgba(36, 33, 30, 0.25);
  overflow: hidden;
  animation: app-modal-pop 0.15s ease-out;
}

@keyframes app-modal-pop {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.app-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 4px;
}

.app-modal-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink, #24211E);
}

.app-modal-close {
  border: none;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-3, #5A554F);
  padding: 4px 6px;
  border-radius: 6px;
}

.app-modal-close:hover {
  background: var(--page, #F6F4F2);
}

.app-modal-body {
  padding: 8px 20px 18px;
  color: var(--ink-3, #5A554F);
  font-size: 14.5px;
  line-height: 1.5;
  white-space: pre-line;
}

.app-modal-input {
  width: 100%;
  box-sizing: border-box;
  margin-top: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong, #E4DFDA);
  border-radius: var(--r-sm, 8px);
  font-size: 14.5px;
  font-family: inherit;
}

.app-modal-input:focus {
  outline: none;
  border-color: var(--brand, #E2001A);
  box-shadow: var(--focus-ring, 0 0 0 3px rgba(226, 0, 26, 0.12));
}

.app-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px 20px;
}

.app-modal-btn {
  border: none;
  border-radius: var(--r-sm, 8px);
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.app-modal-btn-secondary {
  background: var(--surface-3, #F1EDE9);
  color: var(--ink, #24211E);
}

.app-modal-btn-secondary:hover {
  background: var(--line-strong, #E4DFDA);
}

.app-modal-btn-primary {
  background: var(--brand, #E2001A);
  color: #fff;
}

.app-modal-btn-primary:hover {
  background: var(--brand-dark, #8C0011);
}

.app-modal-btn-primary.is-danger {
  background: var(--danger, #E2001A);
}

.app-modal-btn-primary.is-danger:hover {
  background: var(--brand-dark, #8C0011);
}

.app-modal-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Toasts */
.app-toast-region {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 20050;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 340px;
}

.app-toast {
  background: var(--ink, #24211E);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--r-sm, 8px);
  font-family: var(--font-sans, "DM Sans", system-ui, -apple-system, sans-serif);
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 10px 25px rgba(36, 33, 30, 0.25);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: app-toast-in 0.18s ease-out;
}

@keyframes app-toast-in {
  from { transform: translateY(-8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.app-toast.is-leaving {
  animation: app-toast-out 0.15s ease-in forwards;
}

@keyframes app-toast-out {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(-8px); opacity: 0; }
}

.app-toast-icon {
  font-size: 16px;
  flex: none;
}

.app-toast-success { background: var(--ok, #0B8A5B); }
.app-toast-error { background: var(--brand-dark, #8C0011); }
.app-toast-info { background: var(--accent-dark, #00688C); }

@media (max-width: 480px) {
  .app-toast-region {
    left: 12px;
    right: 12px;
    max-width: none;
  }
}
