/* ==========================================================================
   Pacslink — Login (non-scrollable, centered card overlay)
   ========================================================================== */

:root {
  --auth-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --auth-bg: #3a5fc8;
  --auth-text: #0f172a;
  --auth-muted: #64748b;
  --auth-border: #dbe3ee;
  --auth-brand: #0b84d0;
  --auth-grad: linear-gradient(135deg, #12a3e8 0%, #0b6fc4 55%, #1e40af 100%);
  --auth-ring: 0 0 0 4px rgba(11, 132, 208, .16);
}

*,
*::before,
*::after { box-sizing: border-box; }

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;              /* never scroll */
  overscroll-behavior: none;
}

body.auth {
  font-family: var(--auth-font);
  color: var(--auth-text);
  background: var(--auth-bg);
  -webkit-font-smoothing: antialiased;
}

/* ---- Background: graph.jpg + soft vignette for card contrast ---------- */
.auth-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  background: #3a5fc8;            /* fallback while the image loads */
}
.auth-bg__photo {
  position: absolute;
  inset: 0;
  background: url("../assets/img/logos/graph.jpg") center / cover no-repeat;
  transform: scale(1.02);
  animation: auth-drift 30s ease-in-out infinite alternate;
}
.auth-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 70% at 50% 50%, rgba(10, 24, 64, .10) 0%, rgba(10, 24, 64, .38) 70%, rgba(6, 14, 40, .62) 100%),
    linear-gradient(180deg, rgba(10, 24, 64, .10), rgba(10, 24, 64, .25));
}
@keyframes auth-drift { to { transform: scale(1.07) translate3d(-1%, -1%, 0); } }

/* ---- Centered shell ---------------------------------------------------- */
.auth-shell {
  position: relative;
  z-index: 1;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}

/* ---- Card -------------------------------------------------------------- */
.auth-card {
  position: relative;
  width: min(420px, 100%);
  max-height: 100%;
  padding: clamp(24px, 4.5vh, 40px) clamp(22px, 4vw, 36px);
  border-radius: 24px;
  background: rgba(255, 255, 255, .78);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  backdrop-filter: blur(20px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, .7);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .06),
    0 30px 80px -20px rgba(0, 0, 0, .65),
    0 10px 30px -12px rgba(11, 111, 196, .35),
    inset 0 1px 0 rgba(255, 255, 255, .8);
  animation: auth-in .6s cubic-bezier(.2, .8, .2, 1) both;
}
.auth-card::before {               /* glowing top edge */
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  top: -1px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #12a3e8, #4fa52f, #7a3e8f, transparent);
  opacity: .9;
}
@keyframes auth-in {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

/* Avicenna (top): the logo is a square JPG with its own light backdrop,
   so it is presented as a rounded badge tile rather than a floating mark. */
.auth-brand { display: flex; justify-content: center; margin-bottom: clamp(14px, 2.6vh, 22px); }
.auth-brand__badge {
  display: block;
  width: clamp(76px, 12vh, 104px);
  aspect-ratio: 1;
  padding: 4px;
  border-radius: 22px;
  background: #fff;
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, .06),
    0 14px 30px -14px rgba(15, 23, 42, .45),
    0 4px 10px -6px rgba(190, 30, 45, .25);
}
.auth-brand__badge img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 18px;
}

.auth-heading { text-align: center; margin-bottom: clamp(16px, 3vh, 26px); }
.auth-heading h1 {
  margin: 0;
  font-size: clamp(20px, 2.6vh, 24px);
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--auth-text);
}
.auth-heading p { margin: 6px 0 0; font-size: 13.5px; color: var(--auth-muted); }

/* ---- Fields ------------------------------------------------------------ */
.auth-field { margin-bottom: clamp(12px, 2vh, 16px); }
.auth-field label {
  display: block;
  margin: 0 0 6px 2px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}
.auth-control { position: relative; display: flex; align-items: center; }
.auth-control > .material-symbols-rounded {
  position: absolute;
  left: 13px;
  font-size: 20px;
  color: #94a3b8;
  pointer-events: none;
  transition: color .15s ease;
}
.auth-control input {
  width: 100%;
  height: 48px;
  padding: 0 14px 0 44px;
  font: 500 14.5px var(--auth-font);
  color: var(--auth-text);
  background: #fff;
  border: 1px solid var(--auth-border);
  border-radius: 12px;
  outline: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.auth-control input::placeholder { color: #a3afc0; font-weight: 400; }
.auth-control input:hover { border-color: #c3cede; }
.auth-control input:focus { border-color: var(--auth-brand); box-shadow: var(--auth-ring); }
.auth-control:focus-within > .material-symbols-rounded { color: var(--auth-brand); }
.auth-control--password input { padding-right: 48px; }

.auth-reveal {
  position: absolute;
  right: 6px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.auth-reveal:hover { background: #f1f5f9; color: #334155; }
.auth-reveal:focus-visible { outline: none; box-shadow: var(--auth-ring); }
.auth-reveal .material-symbols-rounded { font-size: 20px; }

.auth-caps {
  display: none;
  align-items: center;
  gap: 5px;
  margin: 6px 0 0 2px;
  font-size: 11.5px;
  font-weight: 500;
  color: #b45309;
}
.auth-caps.is-on { display: flex; }
.auth-caps .material-symbols-rounded { font-size: 15px; }

/* ---- Submit ------------------------------------------------------------ */
.auth-submit {
  position: relative;
  width: 100%;
  height: 50px;
  margin-top: clamp(6px, 1.4vh, 12px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 12px;
  background: var(--auth-grad);
  color: #fff;
  font: 600 15px var(--auth-font);
  letter-spacing: .01em;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 14px 28px -14px rgba(11, 111, 196, .95), inset 0 1px 0 rgba(255, 255, 255, .22);
  transition: transform .15s ease, box-shadow .2s ease, filter .2s ease, opacity .2s ease;
}
.auth-submit::after {             /* sheen */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .25) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform .7s ease;
}
.auth-submit:hover:not(:disabled) { filter: brightness(1.06); box-shadow: 0 18px 34px -14px rgba(11, 111, 196, 1); }
.auth-submit:hover:not(:disabled)::after { transform: translateX(120%); }
.auth-submit:active:not(:disabled) { transform: translateY(1px); }
.auth-submit:focus-visible { outline: none; box-shadow: var(--auth-ring), 0 14px 28px -14px rgba(11, 111, 196, .95); }
.auth-submit:disabled { cursor: not-allowed; opacity: .5; filter: saturate(.7); box-shadow: none; }
.auth-submit .material-symbols-rounded { font-size: 20px; transition: transform .2s ease; }
.auth-submit:hover:not(:disabled) .material-symbols-rounded { transform: translateX(3px); }

.auth-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  animation: auth-spin .7s linear infinite;
}
.auth-submit.is-loading .auth-spinner { display: inline-block; }
.auth-submit.is-loading .auth-arrow { display: none; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* ---- Footer ------------------------------------------------------------ */
/* Pacslink (bottom): "Powered by" strip separated by a hairline */
.auth-foot {
  margin-top: clamp(16px, 2.8vh, 24px);
  padding-top: clamp(12px, 2vh, 18px);
  border-top: 1px solid rgba(148, 163, 184, .28);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(6px, 1.2vh, 10px);
}
.auth-foot__powered {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.auth-foot__label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #94a3b8;
}
.auth-foot__powered img { height: clamp(24px, 3.6vh, 30px); width: auto; display: block; }
.auth-foot__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: #8191a7;
}
.auth-foot__meta .material-symbols-rounded { font-size: 15px; color: #22a06b; }

/* ---- Toastr ------------------------------------------------------------ */
#toast-container > div {
  border-radius: 12px !important;
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .6) !important;
  opacity: .97 !important;
  font-family: var(--auth-font);
  font-size: 13px;
}

/* ---- Responsive: keep the card inside the viewport at any height ----- */
@media (max-height: 700px) {
  .auth-heading p { display: none; }
  .auth-foot__meta { display: none; }
}
@media (max-height: 560px) {
  .auth-card { padding: 18px 22px; border-radius: 18px; }
  .auth-brand { margin-bottom: 12px; }
  .auth-brand__badge { width: 58px; padding: 3px; border-radius: 16px; }
  .auth-brand__badge img { border-radius: 13px; }
  .auth-foot__powered img { height: 22px; }
  .auth-heading { margin-bottom: 12px; }
  .auth-heading h1 { font-size: 17px; }
  .auth-field { margin-bottom: 10px; }
  .auth-field label { margin-bottom: 4px; }
  .auth-control input { height: 42px; }
  .auth-submit { height: 44px; margin-top: 4px; }
  .auth-foot { margin-top: 12px; }
}
@media (max-height: 430px) {
  .auth-heading,
  .auth-foot__label { display: none; }
  .auth-foot { margin-top: 10px; padding-top: 8px; }
  .auth-foot__powered img { height: 18px; }
  .auth-field label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .auth-card { padding: 14px 18px; }
  .auth-brand { margin-bottom: 8px; }
  .auth-brand__badge { width: 44px; padding: 2px; border-radius: 12px; }
  .auth-brand__badge img { border-radius: 10px; }
  .auth-control input { height: 40px; }
  .auth-submit { height: 40px; }
}
@media (max-width: 420px) {
  .auth-card { border-radius: 20px; }
}
@media (min-width: 1800px) and (min-height: 1000px) {
  .auth-card { width: 460px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-bg__photo,
  .auth-card,
  .auth-spinner { animation: none; }
}
