/* Pack error notifications — FormEngine (BE stylesheets) + Visual Editor (middleware).
 * position:fixed avoids overflow:hidden clipping; JS updates bottom/right so the
 * banner floats with the active editable (one banner for multi-CE). */
:root {
  --ck-notification-bg: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  --ck-notification-border: #dc3545;
  --ck-notification-text: #991b1b;
  --ck-notification-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --ck-notification-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ck.ck-notification,
.ck-notification[data-ck-pack-notification] {
  position: fixed;
  /* Above VE/AI shells (revision-viewer uses ~20100) and CK balloon panels (~10050). */
  z-index: 50000 !important;
  min-width: 320px;
  max-width: min(480px, calc(100vw - 2rem));
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 1.25rem;
  border: 1px solid var(--ck-notification-border);
  border-left: 4px solid var(--ck-notification-border);
  border-radius: 12px;
  background: var(--ck-notification-bg);
  color: var(--ck-notification-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: var(--ck-notification-shadow);
  animation: ck-pack-notification-slide-in 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: right center;
  pointer-events: auto;
  box-sizing: border-box;
  /* JS may refine these to follow the editable; keep sensible defaults. */
  bottom: 20px;
  right: 15px;
  transition: bottom 0.15s ease-out, right 0.15s ease-out;
}

.ck-notification__error::before {
  content: '⚠';
  position: absolute;
  top: 1.25rem;
  left: 1.25rem;
  font-size: 1.4em;
  color: var(--ck-notification-border);
  font-weight: bold;
  z-index: 1;
}

.ck-notification__header {
  font-weight: 700;
  padding: 0 0 0.75rem 0;
  margin: 0 0 0 2rem;
  font-size: 1.125rem;
  line-height: 1.3;
  color: var(--ck-notification-text);
  letter-spacing: -0.01em;
}

.ck-notification__description {
  font-weight: 400;
  color: var(--ck-notification-text);
  padding: 0;
  margin: 0 0 0 2rem;
  font-size: 0.875rem;
  line-height: 1.5;
  opacity: 0.9;
}

.ck-notification__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--ck-notification-text);
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
  transition: var(--ck-notification-transition);
  font-weight: 600;
  z-index: 2;
  line-height: 1;
}

.ck-notification__close:hover {
  background: rgba(153, 27, 27, 0.1);
  color: var(--ck-notification-border);
  transform: scale(1.1);
}

.ck-notification__close:focus {
  outline: 2px solid var(--ck-notification-border);
  outline-offset: 2px;
}

.ck-notification__close:active {
  transform: scale(0.95);
}

.ck-notification.ck-hidden {
  animation: ck-pack-notification-slide-out 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: none;
}

@keyframes ck-pack-notification-slide-in {
  from { transform: translateX(100%) scale(0.95); opacity: 0; }
  to { transform: translateX(0) scale(1); opacity: 1; }
}

@keyframes ck-pack-notification-slide-out {
  from { transform: translateX(0) scale(1); opacity: 1; }
  to { transform: translateX(100%) scale(0.95); opacity: 0; }
}

/* Responsive */
@media (max-width: 480px) {
  .ck.ck-notification,
  .ck-notification[data-ck-pack-notification] {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    min-width: 0;
    max-width: none;
    width: auto;
    padding: 1rem;
    /* Mobile: stay full-bleed; ignore per-editable right offset from JS. */
    transition: none;
  }
  .ck-notification__header,
  .ck-notification__description {
    margin-left: 1.5rem;
  }
  .ck-notification__header { font-size: 1rem; }
  .ck-notification__description { font-size: 0.8rem; }
  .ck-notification__error::before {
    left: 1rem;
    font-size: 1.2em;
  }
}

/* Accessibility */
@media (prefers-contrast: high) {
  .ck-notification { border-width: 2px; box-shadow: 0 0 0 2px currentColor; }
  .ck-notification__close:focus { outline-width: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  .ck-notification,
  .ck-notification.ck-hidden { animation: none; }
  .ck-notification__close { transition: none; }
  .ck.ck-notification,
  .ck-notification[data-ck-pack-notification] { transition: none; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --ck-notification-bg: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    --ck-notification-border: #ef4444;
    --ck-notification-text: #fca5a5;
  }
  .ck-notification__close:hover {
    background: rgba(252, 165, 165, 0.1);
    color: var(--ck-notification-border);
  }
}
