/* ============================================================================
   CAS Forms — error modal. Visual + animation parity with success-modal.css
   but tinted error-red instead of brand-blue. Selectors namespaced under
   .cas-form-error-modal so they don't leak.

   Token: --cas-error: #ff5260 (matches the cas.ai dark-theme error red).
   Shimmer + radial accent reuse the same animation primitives as the
   success modal so the two share a recognizable visual rhythm.
   ============================================================================ */

.cas-form-error-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 18, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10001; /* one above success modal in case both are wired up */
}

.cas-form-error-modal[hidden] { display: none !important; }

.cas-form-error-modal p { margin: 0.5rem 0; }

.cas-form-error-modal.is-closing {
  animation: casFormModalOverlayOut 0.35s cubic-bezier(0.4, 0, 1, 1) both;
}

.cas-form-error-modal.is-closing .modal {
  animation: casFormModalSlideDown 0.35s cubic-bezier(0.4, 0, 1, 1) both;
}

@keyframes casFormModalOverlayOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes casFormModalSlideDown {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(16px) scale(0.97); }
}

.cas-form-error-modal .modal {
  font-family: 'Raleway', sans-serif;

  position: relative;
  background: #1f2430;
  border: 1px solid rgba(255, 82, 96, 0.18);
  border-radius: 20px;
  max-width: min(560px, 100%);
  width: 100%;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  animation: casFormErrorSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
  box-shadow:
    0 0 0 1px rgba(255, 82, 96, 0.08),
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 4px 16px rgba(0, 0, 0, 0.28);
}

@keyframes casFormErrorSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.cas-form-error-modal .modal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    #ff5260 25%,
    #ff8a93 50%,
    #ff5260 75%,
    transparent 100%
  );
  background-size: 250% 100%;
  border-radius: 20px 20px 0 0;
  animation: casFormErrorShimmer 3s 0.6s ease-in-out infinite;
}

@keyframes casFormErrorShimmer {
  0%   { background-position: -100% 0; }
  100% { background-position: 200% 0; }
}

.cas-form-error-modal .modal::after {
  content: '';
  position: absolute;
  top: -50px; right: -50px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(255, 82, 96, 0.10) 0%, transparent 65%);
  pointer-events: none;
}

.cas-form-error-modal .modal-header {
  padding: 44px 44px 0;
  position: relative;
  z-index: 1;
}

.cas-form-error-modal .error-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 82, 96, 0.12);
  border: 1px solid rgba(255, 82, 96, 0.28);
  border-radius: 100px;
  padding: 5px 13px 5px 10px;
  margin-bottom: 18px;
  animation: casFormErrorFadeUp 0.4s 0.25s both;
}

@keyframes casFormErrorFadeUp {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cas-form-error-modal .badge-icon {
  width: 20px; height: 20px;
  background: #ff5260;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(255, 82, 96, 0.16);
  animation: casFormErrorPulse 2.4s 0.5s ease-in-out infinite;
}

.cas-form-error-modal .badge-icon svg { display: block; }

@keyframes casFormErrorPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(255, 82, 96, 0.16); }
  50%      { box-shadow: 0 0 0 7px rgba(255, 82, 96, 0.04); }
}

.cas-form-error-modal .badge-text {
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #ff8a93;
}

.cas-form-error-modal .modal-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 25px;
  font-weight: 700;
  color: #eceef6;
  line-height: 1.3;
  margin: 0;
  padding: 0;
  text-wrap: balance;
  animation: casFormErrorFadeUp 0.4s 0.35s both;
}

.cas-form-error-modal .modal-subtitle {
  margin: 12px 0 0;
  font-size: 16px;
  color: #c0c8d8;
  line-height: 1.65;
  animation: casFormErrorFadeUp 0.4s 0.45s both;
}

.cas-form-error-modal .modal-body {
  padding: 22px 44px 0;
  position: relative;
  z-index: 1;
}

.cas-form-error-modal .error-hint {
  margin: 0 0 14px;
  padding: 14px 16px;
  background: #252b38;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-left: 3px solid #ff5260;
  border-radius: 12px;
  font-size: 14px;
  color: #a8b2c8;
  line-height: 1.55;
  animation: casFormErrorFadeUp 0.4s 0.55s both;
}

.cas-form-error-modal .error-support {
  margin: 0;
  font-size: 14px;
  color: #7282a0;
  line-height: 1.55;
  animation: casFormErrorFadeUp 0.4s 0.65s both;
}

.cas-form-error-modal .error-support-email {
  color: #4fa3ff;
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid rgba(79, 163, 255, 0.35);
  transition: color 0.15s, border-color 0.15s;
}

.cas-form-error-modal .error-support-email:hover {
  color: #82bcff;
  border-bottom-color: rgba(130, 188, 255, 0.6);
}

.cas-form-error-modal .modal-footer {
  padding: 24px 44px 38px;
  position: relative;
  z-index: 1;
  animation: casFormErrorFadeUp 0.4s 0.75s both;
}

.cas-form-error-modal .btn-modal {
  display: block;
  width: 100%;
  padding: 15px 28px;
  background: #ff5260;
  border: none;
  border-radius: 12px;
  font-family: 'Montserrat', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: background 0.18s, transform 0.15s, box-shadow 0.18s;
  box-shadow: 0 2px 16px rgba(255, 82, 96, 0.35);
}

.cas-form-error-modal .btn-modal:hover {
  background: #e84450;
  transform: translateY(-1px);
  box-shadow: 0 4px 24px rgba(255, 82, 96, 0.5);
}

.cas-form-error-modal .btn-modal:active { transform: translateY(0); }

.cas-form-error-modal .close-btn {
  position: absolute;
  top: 16px; right: 16px;
  width: 34px; height: 34px;
  background: #252b38;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  color: #7282a0;
}

.cas-form-error-modal .close-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.1);
  color: #a8b2c8;
}

@media (max-height: 640px) {
  .cas-form-error-modal {
    align-items: flex-start;
    padding-top: 12px;
  }
}

@media (max-width: 600px) {
  .cas-form-error-modal { padding: 16px; }
  .cas-form-error-modal .modal { border-radius: 20px; }
  .cas-form-error-modal .modal-header { padding: 28px 24px 0; }
  .cas-form-error-modal .error-badge { margin-bottom: 14px; }
  .cas-form-error-modal .modal-title { font-size: 20px; }
  .cas-form-error-modal .modal-subtitle {
    font-size: 14px;
    line-height: 1.55;
    margin-top: 10px;
  }
  .cas-form-error-modal .modal-body { padding: 18px 24px 0; }
  .cas-form-error-modal .error-hint {
    padding: 12px 14px;
    font-size: 13px;
  }
  .cas-form-error-modal .error-support { font-size: 13px; }
  .cas-form-error-modal .modal-footer { padding: 20px 24px 26px; }
  .cas-form-error-modal .btn-modal {
    padding: 13px 24px;
    font-size: 14px;
  }
}

@media (max-width: 375px) {
  .cas-form-error-modal { padding: 12px; }
  .cas-form-error-modal .modal-header { padding: 22px 20px 0; }
  .cas-form-error-modal .modal-title { font-size: 18px; }
  .cas-form-error-modal .modal-subtitle { font-size: 13px; }
  .cas-form-error-modal .modal-body { padding: 14px 20px 0; }
  .cas-form-error-modal .error-hint { padding: 10px 12px; font-size: 12px; }
  .cas-form-error-modal .error-support { font-size: 12px; }
  .cas-form-error-modal .modal-footer { padding: 16px 20px 22px; }
}
