/* Sign-in pages (Log in, Forgot password, Reset password): IMSolution Pulse,
   liquid glass. Used only by templates/_auth_layout.html. Fonts are served
   from static/fonts/manrope and static/vendor/fonts, nothing external.
   Palette: Pulse #2F6BFF #18B6F2 #5BF0E6, Midnight #070E24, signal dot #7CF4FF. */

.ag-body {
  --a1: #2F6BFF; --a2: #18B6F2; --a3: #5BF0E6;
  --dot: #7CF4FF;
  --tint: rgba(7, 14, 36, .5);
  --solid: #0B1A5C;
  --glow: rgba(24, 196, 245, .5);
  --ring: rgba(124, 244, 255, .5);
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 24px 16px;
  position: relative;
  overflow-x: hidden;
  color: #fff;
  background: linear-gradient(160deg, #0B1A5C, #070E24 60%) fixed;
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
}

/* ---- Behind the glass ---- */
.ag-bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.ag-blob { position: absolute; border-radius: 50%; filter: blur(46px); opacity: .8; will-change: transform; }
.ag-b1 { width: 900px; height: 900px; left: -240px; top: -300px;
  background: radial-gradient(circle at 40% 40%, var(--a1), transparent 66%);
  animation: ag-drift1 26s ease-in-out infinite alternate; }
.ag-b2 { width: 960px; height: 960px; right: -300px; bottom: -380px;
  background: radial-gradient(circle at 50% 50%, var(--a2), transparent 64%);
  animation: ag-drift2 32s ease-in-out infinite alternate; }
.ag-b3 { width: 620px; height: 620px; left: 30%; bottom: -300px; opacity: .55;
  background: radial-gradient(circle at 50% 50%, var(--a3), transparent 66%);
  animation: ag-drift3 22s ease-in-out infinite alternate; }
.ag-lens { position: absolute; left: 33%; top: 15%; width: 420px; height: 420px; border-radius: 50%;
  background: conic-gradient(from 200deg, var(--a3), var(--a1), var(--a2), var(--a3));
  filter: blur(60px); opacity: .55; animation: ag-spin 40s linear infinite; }
@keyframes ag-drift1 { from { transform: translate(0, 0) scale(1); } to { transform: translate(160px, 120px) scale(1.15); } }
@keyframes ag-drift2 { from { transform: translate(0, 0) scale(1.1); } to { transform: translate(-180px, -90px) scale(.95); } }
@keyframes ag-drift3 { from { transform: translate(-120px, 0) scale(1); } to { transform: translate(180px, -60px) scale(1.2); } }
@keyframes ag-spin { to { transform: rotate(360deg); } }

/* Circuit traces: draw themselves, then little signal dots travel along them. */
.ag-traces { position: absolute; inset: 0; width: 100%; height: 100%; }
.ag-traces path { fill: none; stroke: rgba(255, 255, 255, .26); stroke-width: 1.6;
  stroke-dasharray: 100; stroke-dashoffset: 0; animation: ag-draw 3.2s cubic-bezier(.6, 0, .2, 1) both; }
.ag-traces path.p2 { animation-delay: .4s; }
.ag-traces path.p3 { animation-delay: .8s; }
.ag-traces path.p4 { animation-delay: 1.2s; }
.ag-traces .end { fill: rgba(255, 255, 255, .5); animation: ag-fade 1s 2.6s both; }
.ag-traces .sig { fill: var(--dot); filter: drop-shadow(0 0 6px var(--dot)); }
@keyframes ag-draw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes ag-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---- The glass card ---- */
.ag-glass {
  position: relative;
  background: linear-gradient(150deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .05)), var(--tint);
  -webkit-backdrop-filter: blur(26px) saturate(170%);
  backdrop-filter: blur(26px) saturate(170%);
  border-radius: 28px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -1px 0 rgba(255, 255, 255, .08), 0 24px 60px rgba(0, 0, 0, .35);
}
.ag-glass::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, .8), rgba(255, 255, 255, .08) 34%, rgba(255, 255, 255, .05) 66%, rgba(255, 255, 255, .45));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.ag-glass::after {
  content: ""; position: absolute; left: 12%; right: 12%; top: 0; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .9), transparent);
  animation: ag-sheen 9s ease-in-out infinite alternate;
}
@keyframes ag-sheen { from { transform: translateX(-30%); opacity: .4; } to { transform: translateX(30%); opacity: 1; } }
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .ag-glass { background: var(--solid); }
}

.ag-card {
  z-index: 1;
  width: 100%; max-width: 420px; box-sizing: border-box;
  padding: 36px 36px 30px;
  display: flex; flex-direction: column; align-items: stretch; gap: 12px;
  animation: ag-cardin 1s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes ag-cardin { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: none; } }
@media (max-width: 480px) { .ag-card { padding: 28px 20px 24px; border-radius: 24px; } }

/* ---- The mark, wordmark and tagline ---- */
.ag-head { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.ag-mark .dr { stroke-dasharray: 100; stroke-dashoffset: 0; animation: ag-draw 1.8s .3s cubic-bezier(.6, 0, .2, 1) both; }
.ag-mark .dot { transform-box: fill-box; transform-origin: center; animation: ag-pulse 2.4s 2s ease-in-out infinite; }
.ag-mark .ring { transform-box: fill-box; transform-origin: center; fill: none; stroke: var(--dot); stroke-width: 1.5; opacity: 0; animation: ag-ping 2.4s 2s ease-out infinite; }
@keyframes ag-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }
@keyframes ag-ping { from { transform: scale(.6); opacity: .9; } to { transform: scale(2.6); opacity: 0; } }
.ag-wordmark { margin: 4px 0 0; font: 800 38px/1 'Manrope', 'Inter', sans-serif; letter-spacing: -.02em; color: #fff; }
/* "IMS" picks up the circuit mark's gradient (Holly, 10 Nov 2026). */
.ag-wordmark .ims-hl { color: #5BF0E6; background: linear-gradient(90deg, #4A82FF 0%, #18B6F2 55%, #5BF0E6 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.ag-tagline { margin: 0 0 10px; font-size: 14px; color: rgba(255, 255, 255, .84); }
.ag-card h2 { font: 800 18px/1.3 'Manrope', 'Inter', sans-serif; margin: 0; color: #fff; text-align: center; }
.ag-note { font-size: 14px; line-height: 1.5; color: rgba(255, 255, 255, .86); margin: 0; }
.ag-note a { color: var(--dot); }

/* ---- Fields ---- */
.ag-field { display: flex; flex-direction: column; gap: 6px; width: 100%; font: 600 13px 'Inter', sans-serif; color: rgba(255, 255, 255, .92); }
.ag-input {
  height: 48px; box-sizing: border-box; width: 100%;
  border-radius: 14px; border: 1px solid rgba(255, 255, 255, .34);
  background: rgba(255, 255, 255, .09);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .18), inset 0 1px 0 rgba(255, 255, 255, .1);
  color: #fff; font: 400 16px 'Inter', sans-serif; padding: 0 14px; outline: none;
  transition: box-shadow .25s, border-color .25s, background .25s;
}
.ag-input::placeholder { color: rgba(255, 255, 255, .74); }
.ag-input:focus {
  border-color: var(--dot); background: rgba(255, 255, 255, .14);
  box-shadow: 0 0 0 3px var(--ring), 0 0 24px var(--ring), inset 0 2px 6px rgba(0, 0, 0, .12);
}
.ag-input:-webkit-autofill {
  -webkit-text-fill-color: #fff; caret-color: #fff;
  box-shadow: 0 0 0 100px #14235f inset;
}
.ag-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 2px; }
.ag-check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: rgba(255, 255, 255, .92); cursor: pointer; }
.ag-check input { width: 18px; height: 18px; accent-color: #18B6F2; }
.ag-link { font: 600 14px 'Inter', sans-serif; color: var(--dot); text-decoration: underline; text-underline-offset: 3px; }
.ag-link:hover { color: #fff; }

/* ---- Main button: Pulse gradient, Midnight text (never white on cyan) ---- */
.ag-btn {
  position: relative; overflow: hidden; width: 100%; height: 50px; margin-top: 8px;
  border-radius: 14px; border: 1px solid rgba(255, 255, 255, .6);
  background: linear-gradient(135deg, #4A82FF, #18C4F5); color: #070E24;
  font: 700 16px 'Inter', sans-serif; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75), inset 0 -10px 18px rgba(0, 0, 0, .12), 0 10px 28px var(--glow);
  transition: transform .15s, box-shadow .15s, filter .2s;
}
.ag-btn::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 60px; left: -80px;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent); transform: skewX(-20deg);
}
.ag-btn:hover { filter: brightness(1.07); }
.ag-btn:hover::after { left: 110%; transition: left .7s ease; }
.ag-btn:active { transform: translateY(1px) scale(.975); box-shadow: inset 0 2px 8px rgba(0, 0, 0, .25), 0 4px 12px var(--glow); }

/* Keyboard focus: always visible */
.ag-btn:focus-visible, .ag-link:focus-visible, .ag-check input:focus-visible, .ag-card .btn-close:focus-visible {
  outline: 3px solid #fff; outline-offset: 3px;
}

/* ---- Flash messages inside the glass ---- */
.ag-card .alert {
  margin: 0; border-radius: 14px; font-size: 14px; color: #fff;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .34);
}
.ag-card .alert-danger { background: rgba(238, 90, 95, .22); border-color: rgba(255, 140, 144, .7); }
.ag-card .alert-success { background: rgba(23, 168, 107, .24); border-color: rgba(90, 220, 160, .7); }
.ag-card .alert-warning { background: rgba(245, 165, 36, .22); border-color: rgba(255, 200, 100, .7); }
.ag-card .btn-close { filter: invert(1) grayscale(1) brightness(2); }

/* ---- Footer ---- */
.ag-foot { z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: rgba(255, 255, 255, .82); text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .ag-blob, .ag-lens, .ag-glass::after, .ag-card, .ag-mark .dr, .ag-mark .dot, .ag-mark .ring,
  .ag-traces path, .ag-traces .end { animation: none !important; }
  .ag-traces .sig { display: none; }
  .ag-mark .ring { display: none; }
  .ag-btn, .ag-input { transition: none; }
  .ag-btn:hover::after { transition: none; }
}
