/* ECH - 20261030 - CR2345 - Error.aspx redesign (500 page + "Contacter l'administrateur" modal).
   Adapted from a user-supplied mockup. Reuses tokens.css's own palette/radius/shadow/ease vars wherever
   a close-enough match already exists (--danger, --green, --r-pill, --shadow-lg/-md, --ease-out) instead
   of declaring a parallel set - only the two true one-off accent colors for the digit gradient (yellow,
   green already covered by tokens) are new, scoped to .error-page only, not tokens.css.
   ECH - 20261030 follow-up - user-requested: the mockup's own Montserrat/JetBrains Mono fonts, not Inter
   - self-hosted the same way Inter itself is (Content/fonts/montserrat, Content/fonts/jetbrains-mono),
   not a Google Fonts CDN link, per this project's established pattern.
   No GSAP: the intro/blob-drift motion below is pure CSS (@keyframes + animation-delay stagger); the
   mockup's pointer-tilt-on-mousemove is a pointer/JS-only "nice to have", dropped rather than adding a
   JS dependency on an error page specifically. The title "scramble into place" effect is REMOVED per
   user request (2026-10-30 follow-up) - the heading now just renders its real text immediately, no
   .sizer/.scr split or JS reveal. */

.error-page {
  --accent-yellow: #f5b400;
  --font-heading: 'Montserrat', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-family: var(--font-heading);
  position: relative;
  min-height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 22px 16px 28px 16px;
  overflow: hidden;
}

/* Aurora mesh background */
.error-page .mesh {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.error-page .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .5;
}
.error-page .b1 { width: 560px; height: 560px; background: #9cc0ff; top: -200px; left: -120px; animation: error-page-drift-1 16s ease-in-out infinite alternate; }
.error-page .b2 { width: 520px; height: 520px; background: #cdbfff; top: -160px; right: -140px; animation: error-page-drift-2 19s ease-in-out infinite alternate; }
.error-page .b3 { width: 480px; height: 480px; background: #ffc9c0; bottom: -220px; left: 34%; animation: error-page-drift-3 17s ease-in-out infinite alternate; }

.error-page .main {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  max-width: 720px;
  padding: 30px 0;
}

/* ECH - 20261030 - CR2345 - user-reported: the "500" was getting cropped at top/bottom - Montserrat's
   own glyph metrics (taller than the font this was tuned against) exceeded the tight overflow:hidden
   mask built for the digit's entrance-slide animation. overflow:visible guarantees the resting glyph is
   never cropped; the entrance animation still reads fine without the hard clip edge. The mockup's own
   bottom fade-out on the whole digit block (dropped when this was first adapted) is restored below. */
.error-page .code-wrap {
  margin-bottom: 8px;
  -webkit-mask-image: linear-gradient(to bottom, #000 38%, rgba(0,0,0,0) 100%);
  mask-image: linear-gradient(to bottom, #000 38%, rgba(0,0,0,0) 100%);
}
.error-page .code { display: flex; justify-content: center; }
.error-page .mask { overflow: visible; padding: 0.04em 0.04em 0.12em 0.04em; }
.error-page .digit {
  display: inline-block;
  font-weight: 800;
  font-size: clamp(90px, 18vw, 190px);
  line-height: 0.95;
  background: linear-gradient(105deg, var(--blue-700) 0%, var(--blue-500) 30%, var(--green) 52%, var(--accent-yellow) 74%, var(--danger) 100%);
  background-size: 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: error-page-flow 9s ease-in-out infinite alternate, error-page-digit-in 1s var(--ease-out) both;
}
.error-page .mask:nth-child(1) .digit { animation-delay: 0s, 0.1s; }
.error-page .mask:nth-child(2) .digit { animation-delay: -1.2s, 0.2s; }
.error-page .mask:nth-child(3) .digit { animation-delay: -2.4s, 0.3s; }

.error-page h1 {
  margin: 6px 0 12px 0;
  font-size: clamp(22px, 3.2vw, 30px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text-primary);
  animation: error-page-fade-up var(--t-slow) var(--ease-out) 0.4s both;
}

/* AKH - 20261031 - CR2345 - user-requested: bottom margin tightened 28px -> 10px (title/lead/actions
   read too spread out). */
.error-page .lead {
  margin: 0 auto 10px auto;
  max-width: 440px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  animation: error-page-fade-up var(--t-slow) var(--ease-out) 0.5s both;
}

/* AKH - 20261031 - CR2345 - user-requested: explicit margin-top added (the lead's own reduced bottom
   margin above no longer supplies enough of a gap on its own). .ref (the reference-code pill on the
   500 page / the "Ou écrivez à <email>" line on the access-denied page) is unaffected - it's a
   separate, later sibling of .actions in both pages' markup, already rendering below this button
   regardless of either element's own margin.
   AKH - 20261031 - CR2345 follow-up - margin-bottom tightened 28px -> 10px, same reasoning as the
   .lead margin a few lines up (the gap down to .ref read too wide). */
.error-page .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  margin-bottom: 10px;
  animation: error-page-fade-up var(--t-slow) var(--ease-out) 0.58s both;
}
.error-page .btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 20px;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none; /* ECH - 20261030 - CR2345 - user-reported: this is an <a> (mailto), not a
                            <button>, so the browser's default link underline showed under the label */
  border: 1px solid transparent;
  background: none;
  transition: transform var(--t-base) var(--ease-out), box-shadow var(--t-base) var(--ease-out);
}
.error-page .btn:hover { text-decoration: none; }
.error-page .btn-primary {
  /* ECH - 20261030 - CR2345 - user-reported: button background didn't match the design - custom.css's
     own global, unscoped `button { background: transparent !important; }` (already fought once before
     in this app's other redesign work, e.g. record-detail.css's own comment on this exact rule) was
     winning over this one's plain `background`. !important here is what actually wins against it. */
  background: var(--text-primary) !important;
  color: #fff;
  padding-right: 8px;
  box-shadow: var(--shadow-lg);
}
/* ECH - 20261030 - CR2345 - user-requested: a smooth hover effect on the button itself (not just the
   arrow badge) - lifts slightly and deepens its own shadow together, both on the same transition the
   button already declares above, so they animate in lockstep rather than one snapping. */
.error-page .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(12,13,27,0.32);
}
/* ECH - 20261030 - CR2345 - sized up, circle shape confirmed fixed by box-sizing:border-box !important
   (this page has no universal box-sizing reset, so the previous pass's border was adding onto the
   declared 36x36 size instead of staying within it - root-caused via DevTools). Background reverted to
   plain opaque white per user request, back to the original mockup's intent (a light badge against the
   dark button) rather than the gradient tried in between. aspect-ratio stays as a second, independent
   shape guarantee; overflow:hidden still ensures the child SVG can never visually square off a corner. */
.error-page .btn-primary .arr {
  width: 36px;
  height: 36px;
  aspect-ratio: 1;
  padding: 0 !important;
  box-sizing: border-box !important;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 50%;
  background-image: none;
  background-color: #fff;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out);
}
.error-page .btn-primary:hover .arr { transform: translateX(3px); background-color: #e5e7eb; }
.error-page .btn-primary .arr svg { display: block; margin: 0; }

.error-page .ref {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 14px;
  border-radius: var(--r-pill);
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.9);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 12px;
  color: var(--text-muted);
  animation: error-page-fade-up var(--t-slow) var(--ease-out) 0.66s both;
}
.error-page .ref code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}
.error-page .ref button {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--r-pill);
  padding: 5px 11px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--blue-700);
  cursor: pointer;
}
.error-page .ref button:hover { background: var(--bg-hover); }

/* AKH - 20261031 - CR2345 - user-requested: ErrorPartial.ascx's access-error card now reuses this
   whole .error-page component instead of its own separate .empty-state-card treatment (see that file's
   own comment for the full reasoning). Two true additions follow, since that case has no digit code to
   show and its copy control keeps an icon instead of the .ref button's own text ("Copier"/"Copié"). */

/* Sits where .code-wrap/.digit sits for the 500 page - same "hero visual before the title" slot, just a
   tinted icon badge instead of a gradient digit (there's no numeric code for "access denied" to show).
   --status-pending-bg/-text (amber): kept per the user's own explicit choice in an earlier round (not
   --danger, which already means "destructive/delete" elsewhere in this app - Color Theory). */
.error-page.access-denied .access-denied-icon {
  width: 88px;
  height: 88px;
  margin: 0 auto 8px;
  border-radius: 50%;
  background: var(--status-pending-bg);
  color: var(--status-pending-text);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: error-page-digit-in 1s var(--ease-out) both;
}
/* AKH - 20261031 - CR2345 - user-requested: the "Ou écrivez à <email>" line should read as plain text,
   not a card - background/border/shadow/blur removed. Scoped to .access-denied specifically so the 500
   page's own reference-code pill (.error-page .ref, still card-styled) is untouched - same class,
   different page, deliberately different treatment now. The copy icon button (.ref-icon-btn, below)
   keeps its own border - it's a clickable control, still needs a visible edge to read as one. */
.error-page.access-denied .ref {
  background: none;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
/* Bootstrap's own default `code` styling (#f9f2f4 background, no override anywhere else in this file)
   was still showing through on the email address itself - same "plain text" intent as .ref above. */
.error-page.access-denied .ref code {
  background: none;
}
/* .ref's own copy button assumes TEXT content ("Copier") - this variant keeps the icon-based control
   from this card's own earlier iteration (several explicit rounds: add an icon, size it up, give it the
   app's own dark tooltip) rather than reverting it to match the 500 page's text swap literally. Same
   border/radius/hover-background language as .ref button, just shaped for an icon instead of a label. */
.error-page .ref .ref-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 50%;
  color: var(--blue-700);
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.error-page .ref .ref-icon-btn:hover {
  background: var(--bg-hover);
}
.error-page .ref .ref-icon-btn.is-copied {
  color: var(--green);
  border-color: var(--green);
}

@keyframes error-page-fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes error-page-digit-in {
  from { opacity: 0; transform: translateY(26px) rotate(4deg); }
  to { opacity: 1; transform: translateY(0) rotate(0); }
}
@keyframes error-page-flow {
  from { background-position: 0% 50%; }
  to { background-position: 100% 50%; }
}
@keyframes error-page-drift-1 { from { transform: translate(0,0); } to { transform: translate(60px,40px); } }
@keyframes error-page-drift-2 { from { transform: translate(0,0); } to { transform: translate(-50px,50px); } }
@keyframes error-page-drift-3 { from { transform: translate(0,0); } to { transform: translate(40px,-40px); } }

@media (prefers-reduced-motion: reduce) {
  .error-page .digit,
  .error-page .blob,
  .error-page h1,
  .error-page .lead,
  .error-page .actions,
  .error-page .ref {
    animation: none !important;
  }
}

@media (max-width: 600px) {
  .error-page .digit { font-size: clamp(64px, 24vw, 130px); }
  .error-page .btn { width: 100%; justify-content: center; }
  .error-page .actions { flex-direction: column; width: 100%; max-width: 320px; margin-inline: auto; }
  /* AKH - 20261031 - CR2345 - user-requested full responsiveness pass: .ref (reference code + Copier
     button) is display:inline-flex, shrink-to-fit by default - on a narrow phone width the reference
     code's own text could push the row wider than the viewport. flex-wrap lets it drop to two lines
     instead of overflowing; word-break guards the code itself in case a future reference format is
     ever longer than this one's fixed 13 chars. */
  .error-page .ref {
    flex-wrap: wrap;
    justify-content: center;
    max-width: 100%;
  }
  .error-page .ref code {
    word-break: break-all;
  }
  .error-page.access-denied .access-denied-icon {
    width: 72px;
    height: 72px;
  }
}

/* AKH - 20261031 - CR2345 - embedded mode: Error.aspx / Index.aspx now render this inside Site.Master's
   normal .col-lg-12.clearfix.main-page-setup > .content wrapper (sidebar/topbar stay visible) instead of
   their own full-bleed page. The aurora mesh background and 100vh-based min-height above were built for
   a page that owns the whole viewport - scoped off here so the embedded version just fills its content
   card instead of painting a full-viewport color wash behind the rest of the app shell.
   IndexNoSession.aspx (the no-session fallback) is not inside .main-page-setup, so it keeps the
   original full-bleed look untouched.
   AKH - 20261031 - CR2345 follow-up - .record-error-panel added alongside .main-page-setup: the
   access-error card (ErrorPartial.ascx) reuses this same .error-page component now, but its own
   wrapper carries .record-error-panel, not .main-page-setup (that class belongs to Views/Shared/
   Error.aspx's/Views/Error/Index.aspx's own wrapper specifically) - same embedded treatment needed
   either way.
   AKH - 20261031 - CR2345 follow-up #2, user-requested: padding narrowed from 40px 16px 48px 16px to a
   uniform 20px, same "one value on every side" change just made to .inner-edit-record (record-detail
   .css) - both pages, consistent reasoning. */
.main-page-setup .error-page,
.record-error-panel .error-page {
  min-height: auto;
  padding: 20px;
}
.main-page-setup .error-page .mesh,
.record-error-panel .error-page .mesh {
  display: none;
}
