/* =========================================================================
   Unified alert / notice system (error · success · warning · info).
   Replaces three conflicting notice styles from cura.css, cura-new.css and
   cura-clean.css. Loaded last, so it wins.

   Source of truth: Figma "Alert1" / "Alert2" (Hi-Fi page) + design-system
   colours:
     bg White-2 #FCFBF9 · border AccentL #FAD3D1 · icon Accent #F28E87
     text Amiko SemiBold, Pr-1 #41637B (16px, 12px for the compact one)
     radius 16 · padding 16 · gap 16 · border 1px
   Success uses Accent/G #A8D8D2; info uses Pr-4 #EBF5FF / Pr-3 #D4E7F4 /
   Pr-2 #73B1DD (the "notes are private" box). Warning is not in the palette
   (amber, derived) — adjust the variables below if the designer adds one.
   ========================================================================= */

:root {
  --cura-al-text: #41637B;

  --cura-al-error-bg: #FCFBF9;
  --cura-al-error-line: #FAD3D1;
  --cura-al-error-icon: #F28E87;

  --cura-al-success-bg: #F1F9F8;
  --cura-al-success-line: #CFE9E5;
  --cura-al-success-icon: #5FB3A7;

  --cura-al-warning-bg: #FFF9EC;
  --cura-al-warning-line: #F5DFAE;
  --cura-al-warning-icon: #D99A2B;

  --cura-al-info-bg: #EBF5FF;
  --cura-al-info-line: #D4E7F4;
  --cura-al-info-icon: #73B1DD;
}

/* Base (defaults to "info") ------------------------------------------- */

.cura-notice,
.cura-mnotice,
.cura-msg-notice,
.cura-compare-message {
  --al-bg: var(--cura-al-info-bg);
  --al-line: var(--cura-al-info-line);
  --al-ic: var(--cura-al-info-icon);
  --al-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cline x1='12' y1='16' x2='12' y2='12'/%3E%3Cline x1='12' y1='8' x2='12.01' y2='8'/%3E%3C/svg%3E");

  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin: 0 0 18px;
  padding: 16px;
  border: 1px solid var(--al-line);
  border-radius: 16px;
  background: var(--al-bg);
  color: var(--cura-al-text);
  font-family: 'Amiko', sans-serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  box-shadow: none;
  box-sizing: border-box;
}

.cura-notice::before,
.cura-mnotice::before,
.cura-msg-notice::before,
.cura-compare-message::before {
  content: '';
  flex: none;
  width: 22px;
  height: 22px;
  background: var(--al-ic);
  -webkit-mask: var(--al-icon) center / contain no-repeat;
  mask: var(--al-icon) center / contain no-repeat;
}

.cura-notice p,
.cura-mnotice p,
.cura-msg-notice p {
  margin: 0;
}

.cura-notice > p:first-of-type {
  flex: 1 1 180px;
}

.cura-notice a:not(.cura-btn) {
  color: inherit;
  text-decoration: underline;
}

/* Variants ------------------------------------------------------------ */

.cura-notice-error,
.cura-mnotice.is-error,
.cura-compare-message-error {
  --al-bg: var(--cura-al-error-bg);
  --al-line: var(--cura-al-error-line);
  --al-ic: var(--cura-al-error-icon);
}

.cura-notice-success,
.cura-mnotice.is-ok,
.cura-msg-notice.is-ok,
.cura-compare-message-success {
  --al-bg: var(--cura-al-success-bg);
  --al-line: var(--cura-al-success-line);
  --al-ic: var(--cura-al-success-icon);
  --al-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpolyline points='8.5 12.5 11 15 15.5 9.5'/%3E%3C/svg%3E");
}

/* error icon = alert-circle (Figma "tabler-icon-alert-circle") */
.cura-notice-error,
.cura-mnotice.is-error,
.cura-compare-message-error {
  --al-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E");
}

/* warning icon = alert-triangle (Figma "Alert2") */
.cura-notice-warning,
.cura-mnotice.is-warn,
.cura-msg-notice.is-warn,
.cura-wrong-role {
  --al-bg: var(--cura-al-warning-bg);
  --al-line: var(--cura-al-warning-line);
  --al-ic: var(--cura-al-warning-icon);
  --al-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M10.363 3.591L2.257 17.125a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636-2.871L13.637 3.591a1.914 1.914 0 0 0-3.274 0z'/%3E%3Cpath d='M12 16h.01'/%3E%3C/svg%3E");
}

/* "You don't have access" empty state: same card, warning tone */
.cura-wrong-role {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--al-line);
  border-radius: 16px;
  background: var(--al-bg);
  color: var(--cura-al-text);
  font-weight: 600;
  line-height: 1.35;
}

.cura-wrong-role::before {
  content: '';
  flex: none;
  width: 22px;
  height: 22px;
  background: var(--al-ic);
  -webkit-mask: var(--al-icon) center / contain no-repeat;
  mask: var(--al-icon) center / contain no-repeat;
}

/* Login page error (dark panel): accent on dark ------------------------ */

.cura-login-error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(242, 142, 135, 0.14);
  border: 1px solid #F28E87;
  border-radius: 16px;
  color: #FAD3D1;
  font-family: 'Amiko', sans-serif;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  padding: 14px 16px;
  margin-bottom: 16px;
  width: 100%;
  box-sizing: border-box;
}

.cura-login-error::before {
  content: '';
  flex: none;
  width: 20px;
  height: 20px;
  background: #F28E87;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* v0.2.484 Login page success (password changed / reset link sent): same box, success colours */
.cura-login-ok {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(95, 179, 167, 0.16);
  border: 1px solid #5FB3A7;
  border-radius: 16px;
  color: #CFE9E5;
  font-family: 'Amiko', sans-serif;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  padding: 14px 16px;
  margin-bottom: 16px;
  width: 100%;
  box-sizing: border-box;
}

/* Field-level validation ---------------------------------------------- */

input.cura-input-error,
select.cura-input-error,
textarea.cura-input-error,
.cura-input-error input,
.cura-input-error select,
.cura-input-error textarea {
  border-color: var(--cura-al-error-icon) !important;
  background-color: #FFF5F4 !important;
  box-shadow: 0 0 0 3px rgba(242, 142, 135, 0.2);
}

.cura-error-message {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-family: 'Amiko', sans-serif;
  font-size: 12px; /* Figma Text5 */
  font-weight: 600;
  line-height: 1.4;
  color: #E0645C; /* Accent darkened for 4.5:1 text contrast on white */
}

.cura-error-message::before {
  content: '';
  flex: none;
  width: 16px;
  height: 16px;
  background: var(--cura-al-error-icon);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M10.363 3.591L2.257 17.125a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636-2.871L13.637 3.591a1.914 1.914 0 0 0-3.274 0z'/%3E%3Cpath d='M12 16h.01'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M10.363 3.591L2.257 17.125a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636-2.871L13.637 3.591a1.914 1.914 0 0 0-3.274 0z'/%3E%3Cpath d='M12 16h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Compact variant (Figma "Alert2"): add .cura-notice-compact ----------- */

.cura-notice-compact {
  padding: 8px 16px;
  font-size: 12px;
}

.cura-notice-compact::before {
  width: 20px;
  height: 20px;
}

/* Mobile ----------------------------------------------------------------- */

@media (max-width: 767px) {
  .cura-notice,
  .cura-mnotice,
  .cura-msg-notice,
  .cura-compare-message,
  .cura-wrong-role {
    gap: 12px;
    padding: 14px;
    font-size: 14px;
    border-radius: 14px;
  }

  .cura-notice .cura-btn {
    margin-top: 6px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .cura-notice,
  .cura-mnotice,
  .cura-msg-notice {
    animation: cura-alert-in 0.28s ease-out both;
  }
}

@keyframes cura-alert-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
