/* ==========================================================================
   Exim Portal - supplemental styles
   Tailwind (CDN in this mockup) handles layout/colour. This file only carries
   things that are awkward as utility classes: keyframes, focus rings on
   composite widgets, print rules, and the QR framing.
   ========================================================================== */

:root {
  --brand-900: #12305f;
  --brand-700: #1d4ed8;
  --brand-500: #3b82f6;
  --ring: 0 0 0 3px rgb(59 130 246 / 0.25);
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Segoe UI", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04";
  text-rendering: optimizeLegibility;
}

/*
  ASP.NET wraps __VIEWSTATE / __VIEWSTATEGENERATOR / __EVENTVALIDATION in
  <div class="aspNetHidden"> and inserts it as the first child of every
  <form runat="server"> - the mockup never had this div, since it was static
  HTML with no postback machinery, so no prior rule ever needed to account
  for it.

  Each <input type="hidden"> collapses to nothing on its own, but the
  whitespace between them still renders as line-height struts, so the
  wrapping div claims real height. In plain block flow that is a few pixels
  nobody notices; as the *first child* of a `<form>` that is itself a Grid or
  Flex container (SignIn.aspx, ChangePassword.aspx), the div becomes a genuine
  grid/flex item and visibly displaces the real content - which is exactly
  the gap this rule exists to close, sitewide, in one place rather than on
  every page's own form individually.
*/
.aspNetHidden {
  display: none;
}

/* ---------- Motion ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@keyframes fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

@keyframes sheen {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.animate-rise { animation: rise .5s cubic-bezier(.22,1,.36,1) both; }
.animate-fade { animation: fade .4s ease both; }
.animate-shake { animation: shake .5s cubic-bezier(.36,.07,.19,.97) both; }

.stagger > * { animation: rise .5s cubic-bezier(.22,1,.36,1) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .06s; }
.stagger > *:nth-child(3) { animation-delay: .10s; }
.stagger > *:nth-child(4) { animation-delay: .14s; }
.stagger > *:nth-child(5) { animation-delay: .18s; }
.stagger > *:nth-child(6) { animation-delay: .22s; }
.stagger > *:nth-child(7) { animation-delay: .26s; }
.stagger > *:nth-child(8) { animation-delay: .30s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ---------- Brand surfaces ---------- */

.brand-mesh {
  background-color: #0b1c3a;
  background-image:
    radial-gradient(at 12% 18%, rgb(43 127 255 / 0.45) 0px, transparent 55%),
    radial-gradient(at 82% 8%,  rgb(14 165 233 / 0.35) 0px, transparent 50%),
    radial-gradient(at 72% 88%, rgb(56 189 248 / 0.22) 0px, transparent 45%),
    radial-gradient(at 20% 92%, rgb(18 48 95 / 0.90) 0px, transparent 55%);
}

/* Faint navigational grid over the brand panel - reads as a chart/manifest. */
.brand-grid {
  background-image:
    linear-gradient(rgb(255 255 255 / 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 0.06) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 78%);
}

.card-hover {
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card-hover:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px -18px rgb(15 42 87 / 0.35);
}

/* ---------- MFA code input ---------- */

.otp-box {
  width: 3rem;
  height: 3.75rem;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
  background: #fff;
  border: 1.5px solid #cbd5e1;
  border-radius: .75rem;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
/* Narrow phones: six 3rem boxes plus gaps exceed the viewport, and because the
   card is a grid item it cannot shrink below its content. Reduce the boxes. */
@media (max-width: 420px) {
  .otp-box {
    width: 2.5rem;
    height: 3.25rem;
    font-size: 1.25rem;
  }
}

@media (max-width: 380px) {
  .otp-box {
    width: 2rem;
    height: 3rem;
    font-size: 1.125rem;
    border-radius: .5rem;
  }
  #otp { gap: .3rem; }
}

.otp-box:focus {
  border-color: var(--brand-500);
  box-shadow: var(--ring);
}
.otp-box[data-filled="true"] {
  border-color: var(--brand-500);
  background: #f5f9ff;
}
.otp-error .otp-box {
  border-color: #f87171;
  background: #fff5f5;
}

/* ---------- QR ---------- */

.qr-frame {
  position: relative;
  padding: 1rem;
  background: #fff;
  border-radius: 1rem;
}
.qr-frame svg,
.qr-frame img {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  shape-rendering: crispEdges;
}
/* Corner brackets, scanner-style. */
.qr-frame::before,
.qr-frame::after {
  content: "";
  position: absolute;
  width: 22px; height: 22px;
  border: 2px solid var(--brand-500);
  border-radius: 4px;
}
.qr-frame::before { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.qr-frame::after  { bottom: 0; right: 0; border-left: 0; border-top: 0; }

/* ---------- Slide-over drawer ---------- */

/* The panel is translated off-canvas while closed rather than removed, so the
   open/close animation runs in both directions. `hidden` still fully removes it
   from the a11y tree between uses. */
.drawer-backdrop {
  opacity: 0;
  transition: opacity .25s ease;
}
.drawer-panel {
  transform: translateX(100%);
  transition: transform .32s cubic-bezier(.32, .72, 0, 1);
}
.drawer.is-open .drawer-backdrop { opacity: 1; }
.drawer.is-open .drawer-panel { transform: none; }

/* Prevents the page behind the drawer from scrolling on touch devices. */
body.drawer-open { overflow: hidden; }

/* Toasts sit bottom-right, which is exactly where the drawer's Save/Cancel
   buttons are. Move them clear while a drawer is open. */
@media (min-width: 640px) {
  body.drawer-open #toast-host { right: auto; left: 1.5rem; }
}

/* ==========================================================================
   Legacy report pane
   Used by admin-audit-log.html: the portal shell and card are the normal
   design system, but the pane inside keeps the plain WebForms/SSRS look of
   the system this screen replaces.

   Tailwind's preflight strips native chrome off form controls, so `all: revert`
   rolls these elements back past every author style to the browser defaults.
   Everything after that rule only sets size, not appearance.

   The input[type="submit"] selectors are the one departure from the mockup's
   copy of this file. The mockup hand-wrote <button class="btn">; <asp:Button>
   renders <input type="submit">, which `button.btn` does not match — without
   them the Audit Log toolbar loses its styling entirely.
   ========================================================================== */

.legacy input[type="text"],
.legacy input[type="search"],
.legacy input[type="submit"],
.legacy input[type="button"],
.legacy select,
.legacy button {
  all: revert;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 13px;
}

.legacy h2 {
  font-size: 24px;
  font-weight: 300;
  color: #333333;
  margin: 0 0 14px 0;
  letter-spacing: .1px;
}

/* Label/field rows, laid out as the original ASP.NET page would have. */
.legacy table.formgrid { border-collapse: separate; border-spacing: 0 4px; }
.legacy table.formgrid td { padding: 0 10px 0 0; vertical-align: middle; }
.legacy table.formgrid td.label {
  color: #333333;
  font-size: 14px;
  white-space: nowrap;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.legacy input.txt { width: 186px; padding: 3px 4px; }
.legacy select.ddl { min-width: 62px; }
.legacy select.ddl.wide { min-width: 150px; }
.legacy button.btn,
.legacy input.btn { padding: 3px 9px; margin-top: 6px; }

/* ---------- Report viewer toolbar + grid ---------- */

.legacy .rv-toolbar,
.legacy .rv-body { box-sizing: border-box; }

.legacy .rv-toolbar {
  border: 1px solid #c4c4c4;
  background: #f1f1f1;
  padding: 3px 6px;
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: #333333;
}
.legacy .rv-toolbar button.pg,
.legacy .rv-toolbar input.pg {
  all: revert;
  font-family: inherit;
  border: 1px solid transparent;
  background: transparent;
  color: #16457e;
  font-size: 12px;
  line-height: 1;
  padding: 3px 5px;
  cursor: pointer;
}
.legacy .rv-toolbar button.pg:hover:not(:disabled),
.legacy .rv-toolbar input.pg:hover:not(:disabled) { border-color: #a9c4e4; background: #dceafa; }
.legacy .rv-toolbar button.pg:disabled,
.legacy .rv-toolbar input.pg:disabled { color: #b0b0b0; cursor: default; }
.legacy .rv-toolbar input.pgnum { width: 34px; font-size: 12px; text-align: center; padding: 2px; }
.legacy .rv-toolbar .sep { width: 1px; height: 18px; background: #c4c4c4; margin: 0 5px; }

.legacy .rv-body {
  border: 1px solid #c4c4c4;
  border-top: 0;
  background: #ffffff;
  padding: 16px 12px;
  overflow-x: auto;
}

.legacy table.rvgrid {
  border-collapse: collapse;
  font-size: 10px;
  color: #000000;
}
.legacy table.rvgrid th,
.legacy table.rvgrid td {
  border: 1px solid #999999;
  padding: 2px 4px;
  vertical-align: top;
  text-align: left;
  font-weight: normal;
}
.legacy table.rvgrid th { font-weight: 600; white-space: nowrap; }
.legacy table.rvgrid td.date { width: 74px; }
.legacy table.rvgrid td.empty {
  text-align: center;
  padding: 10px;
  color: #666666;
  font-style: italic;
}

/* ---------- Summary output ---------- */

.legacy table.sumgrid {
  border-collapse: collapse;
  font-size: 11px;
  color: #000000;
  margin-top: 10px;
}
.legacy table.sumgrid th,
.legacy table.sumgrid td {
  border: 1px solid #999999;
  padding: 3px 10px 3px 6px;
  text-align: left;
  font-weight: normal;
}
.legacy table.sumgrid th { font-weight: 600; }
.legacy table.sumgrid td.num { text-align: right; }

/* ---------- Misc ---------- */

.skeleton {
  background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 37%, #eef2f7 63%);
  background-size: 400% 100%;
  animation: sheen 1.4s ease infinite;
}

.scroll-slim::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll-slim::-webkit-scrollbar-thumb {
  background: #cbd5e1; border-radius: 999px; border: 3px solid transparent; background-clip: content-box;
}
.scroll-slim::-webkit-scrollbar-thumb:hover { background: #94a3b8; background-clip: content-box; }

[hidden] { display: none !important; }

@media print {
  .no-print { display: none !important; }
  body { background: #fff !important; }
}
