/* The sign-in screens ("Employee Portal"): a light enterprise look with a warm inspection lamp, soft red light
   trails, ISO blocks, and an illuminated sign-in button. Markup: views/partials/auth-top.ejs, auth-bottom.ejs.
   Colours follow the site's primary colour (--app-red / --bs-primary-rgb). Everything decorative is aria-hidden and
   switched off for people who ask their system for reduced motion. */

.portal {
  display: block;
  padding: 0;
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  color: #212529;
  color-scheme: light;
  background:
    radial-gradient(1100px 640px at 16% 6%, #ffffff 0%, rgba(255, 255, 255, 0) 62%),
    linear-gradient(135deg, #fbf7f2 0%, #f3eadf 55%, #ecdfd1 100%);
}

/* ---- the scene (decoration) ---- */
.portal-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  direction: ltr;
}
.portal-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(520px 420px at 30% 18%, rgba(255, 224, 168, 0.55), rgba(255, 224, 168, 0) 70%),
    radial-gradient(
      640px 520px at 72% 60%,
      rgba(var(--bs-primary-rgb), 0.1),
      rgba(var(--bs-primary-rgb), 0) 70%
    );
}
/* the beam of the lamp, falling towards the card */
.portal-glow::before {
  content: '';
  position: absolute;
  top: 150px;
  left: calc(24vw + 40px);
  width: 460px;
  height: 80vh;
  background: linear-gradient(180deg, rgba(255, 233, 190, 0.6), rgba(255, 233, 190, 0));
  clip-path: polygon(40% 0, 60% 0, 100% 100%, 0 100%);
  filter: blur(16px);
  transform-origin: 50% 0;
  transform: rotate(-22deg);
}
.portal-lamp {
  position: absolute;
  top: 0;
  left: 24vw;
  width: 340px;
  max-width: 40vw;
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.18));
}
.portal-trails {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.85;
}
.portal-trails .trail {
  stroke-dasharray: 220 980;
  stroke-linecap: round;
  animation: portal-flow 11s linear infinite;
}
.portal-trails .t2 {
  animation-duration: 14s;
  animation-delay: -4s;
}
.portal-trails .t3 {
  animation-duration: 17s;
  animation-delay: -9s;
}
@keyframes portal-flow {
  to {
    stroke-dashoffset: -1200;
  }
}
.portal-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(var(--bs-primary-rgb), 0.28);
}
.portal-ring.r1 {
  width: 560px;
  height: 560px;
  left: 4vw;
  top: 24vh;
  border-style: dashed;
  animation: portal-spin 120s linear infinite;
}
.portal-ring.r2 {
  width: 400px;
  height: 400px;
  left: 10vw;
  top: 31vh;
  opacity: 0.55;
  animation: portal-spin 80s linear infinite reverse;
}
@keyframes portal-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- the page: the hero on the left, the card on the right (in both languages) ---- */
.portal-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 460px);
  gap: clamp(24px, 5vw, 90px);
  align-items: center;
  padding: clamp(20px, 4vw, 56px) clamp(20px, 6vw, 110px);
  direction: ltr;
}
html[dir='rtl'] .portal-hero,
html[dir='rtl'] .portal-card-wrap {
  direction: rtl;
}
html[dir='ltr'] .portal-hero,
html[dir='ltr'] .portal-card-wrap {
  direction: ltr;
}

.portal-hero {
  padding-block: 1rem;
}
.portal-brandline {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: clamp(1.5rem, 5vh, 3.5rem);
}
.portal-hero-logo {
  max-height: 60px;
  max-width: 220px;
  object-fit: contain;
}
.portal-hero-name {
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: 0.03em;
}
.portal-slogan {
  font-size: 0.7rem;
  letter-spacing: 0.34em;
  color: #6c6c6c;
  border-inline-start: 1px solid #b9b0a6;
  padding-inline-start: 1rem;
  direction: ltr;
}
.portal-hero-title {
  font-size: clamp(2.1rem, 4.4vw, 3.6rem);
  font-weight: 800;
  line-height: 1.15;
  color: #14110f;
  margin: 0 0 0.4rem;
}
.portal-hero-accent {
  font-size: clamp(1.25rem, 2.5vw, 2rem);
  font-weight: 800;
  line-height: 1.3;
  color: var(--app-red);
  margin: 0 0 0.9rem;
}
.portal-hero-text {
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  color: #4d4640;
  max-width: 34rem;
  margin: 0 0 1.6rem;
}
.portal-features {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 0 0 2rem;
  padding: 0;
}
.portal-features li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-width: 108px;
  max-width: 150px;
  padding: 0.2rem 1rem;
  text-align: center;
  font-size: 0.82rem;
  color: #3b352f;
  border-inline-start: 1px solid rgba(0, 0, 0, 0.1);
}
.portal-features li:first-child {
  border-inline-start: 0;
}
.portal-features .bi {
  font-size: 1.9rem;
  color: var(--app-red);
}
.portal-iso {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}
.portal-iso-block {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.1rem;
  border-radius: 0.55rem;
  background: linear-gradient(180deg, #ecd9b8, #d3b48a);
  color: #2b2118;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 10px 18px rgba(80, 55, 20, 0.22);
  direction: ltr;
}
.portal-iso-block .bi {
  font-size: 1.5rem;
}
.portal-iso-block strong {
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

/* when the admin chose a picture panel for the sign-in page (Identity > sign-in page) */
.portal.auth-split {
  display: block;
  padding: 0;
  justify-content: initial;
  padding-inline-end: 0;
}
.portal.auth-split::after {
  inset-inline-start: auto;
  left: 0;
  width: 55%;
}
.portal-hero-on-image {
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
}
.portal-hero-on-image .portal-hero-title,
.portal-hero-on-image .portal-hero-text,
.portal-hero-on-image .portal-features li,
.portal-hero-on-image .portal-slogan {
  color: #fff;
}
.portal-hero-on-image .portal-hero-accent {
  color: #ffd4d8;
}

/* ---- the card ---- */
.portal .portal-card {
  --bs-body-color: #212529;
  --bs-body-bg: #fff;
  --bs-border-color: #dee2e6;
  --bs-secondary-color: rgba(33, 37, 41, 0.7);
  width: 100%;
  max-width: 460px;
  margin-inline: auto;
  border: 1px solid rgba(var(--bs-primary-rgb), 0.35);
  border-radius: 1.4rem;
  color: #212529;
  background: rgba(255, 255, 255, 0.88);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.75) inset,
    0 30px 80px rgba(var(--bs-primary-rgb), 0.18),
    0 0 70px rgba(var(--bs-primary-rgb), 0.14);
}
.portal-card-body {
  padding: 1.6rem 2rem 2rem;
}
.portal-name {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
}
.portal-welcome {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0.2rem 0 0.35rem;
}
.portal-subtitle {
  font-size: 0.9rem;
  color: #5d554d;
}
.portal .lang-switch .btn {
  border-radius: 0.6rem;
  background: #fff;
}
.portal-card .form-label {
  font-weight: 600;
  font-size: 0.88rem;
}
.portal-field {
  position: relative;
}
.portal-field > .bi:first-child {
  position: absolute;
  inset-inline-start: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  color: #7d746b;
  pointer-events: none;
  z-index: 2;
}
.portal-field .form-control {
  padding: 0.78rem 2.8rem;
  border-radius: 0.85rem;
  border-color: #d9d1c8;
  background: rgba(255, 255, 255, 0.95);
  color: #212529;
}
html[dir='rtl'] .portal-field .form-control {
  text-align: right;
}
.portal-field .form-control:focus {
  border-color: var(--app-red);
  box-shadow: 0 0 0 0.22rem rgba(var(--bs-primary-rgb), 0.18);
}
.portal-eye {
  position: absolute;
  inset-inline-end: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #7d746b;
  padding: 0.35rem 0.5rem;
  border-radius: 0.5rem;
  z-index: 2;
}
.portal-eye:hover,
.portal-eye:focus-visible {
  color: var(--app-red);
}
.portal-forgot {
  color: var(--app-red);
}
.portal-alert {
  border: 1px solid rgba(var(--bs-primary-rgb), 0.35);
  background: #fff1f2;
  color: #8f1626;
  border-radius: 0.7rem;
  padding: 0.55rem 0.85rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

/* ---- the illuminated button ---- */
.portal-submit {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 0.95rem 1.2rem;
  border: 0;
  border-radius: 0.95rem;
  overflow: hidden;
  color: #fff;
  font-weight: 700;
  font-size: 1.08rem;
  cursor: pointer;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--app-red) 82%, #fff) 0%,
    var(--app-red) 48%,
    var(--app-red-dark) 100%
  );
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.4) inset,
    0 12px 30px rgba(var(--bs-primary-rgb), 0.4),
    0 0 0 0 rgba(var(--bs-primary-rgb), 0.5);
  animation: portal-pulse 3.4s ease-out infinite;
  transition:
    transform 0.15s ease,
    filter 0.2s ease;
}
.portal-submit:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}
.portal-submit:active {
  transform: translateY(1px) scale(0.992);
}
.portal-submit:focus-visible {
  outline: 3px solid rgba(var(--bs-primary-rgb), 0.45);
  outline-offset: 3px;
}
.portal-submit-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  background: radial-gradient(
    130px 70px at var(--rx, 50%) var(--ry, 50%),
    rgba(255, 255, 255, 0.5),
    rgba(255, 255, 255, 0) 70%
  );
}
.portal-submit:hover .portal-submit-glow {
  opacity: 1;
}
.portal-submit-icon {
  transition: transform 0.2s ease;
}
.portal-submit:hover .portal-submit-icon {
  transform: translateX(4px);
}
html[dir='rtl'] .portal-submit:hover .portal-submit-icon {
  transform: translateX(-4px);
}
.portal-ripple {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.55);
  transform: scale(0);
  animation: portal-ripple 0.7s ease-out forwards;
}
@keyframes portal-ripple {
  to {
    transform: scale(1);
    opacity: 0;
  }
}
@keyframes portal-pulse {
  0% {
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.4) inset,
      0 12px 30px rgba(var(--bs-primary-rgb), 0.4),
      0 0 0 0 rgba(var(--bs-primary-rgb), 0.45);
  }
  70%,
  100% {
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.4) inset,
      0 12px 30px rgba(var(--bs-primary-rgb), 0.4),
      0 0 0 18px rgba(var(--bs-primary-rgb), 0);
  }
}
.portal-spinner {
  display: none;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  animation: portal-spin 0.8s linear infinite;
}
.portal-submit.is-loading {
  animation: none;
  pointer-events: none;
  filter: saturate(0.85);
}
.portal-submit.is-loading .portal-spinner {
  display: inline-block;
}
.portal-submit.is-loading .portal-submit-icon {
  display: none;
}

.portal-footer {
  text-align: center;
  margin: 1rem 0 0;
  font-size: 0.78rem;
  color: #6c635a;
}

/* ---- small screens: the card alone, centred ---- */
@media (max-width: 991.98px) {
  .portal-shell {
    grid-template-columns: minmax(0, 1fr);
    padding: 20px 16px 28px;
  }
  .portal-hero {
    display: none;
  }
  .portal-lamp {
    opacity: 0.55;
    left: 4vw;
  }
  .portal-ring {
    display: none;
  }
  .portal-glow::before {
    left: 20vw;
  }
  .portal-card-body {
    padding: 1.3rem 1.2rem 1.6rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .portal-trails .trail,
  .portal-ring,
  .portal-submit {
    animation: none;
  }
  .portal-submit,
  .portal-submit-icon {
    transition: none;
  }
}

@media print {
  .portal-scene {
    display: none;
  }
}

/* ---- the photo of the day (Admin > Sign-in page) ---- */
.portal-has-photo .portal-shell {
  align-items: stretch;
}
.portal-hero-photo {
  position: relative;
  min-height: calc(100vh - 2 * clamp(20px, 4vw, 56px));
  border-radius: 28px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(22px, 3.5vw, 44px);
  color: #fff;
  isolation: isolate;
  box-shadow:
    0 30px 80px rgba(20, 10, 5, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.4) inset;
}
.portal-photo {
  position: absolute;
  inset: 0;
  z-index: -1;
}
.portal-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  will-change: transform;
  animation: portal-zoom 30s ease-out 1 forwards;
}
.portal-photo::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.25) 0%,
      rgba(0, 0, 0, 0) 28%,
      rgba(12, 6, 6, 0.82) 100%
    ),
    radial-gradient(
      700px 400px at 85% 100%,
      rgba(var(--bs-primary-rgb), 0.35),
      rgba(0, 0, 0, 0) 70%
    );
}
@keyframes portal-zoom {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.08);
  }
}
.portal-brandline-chip {
  align-self: flex-start;
  margin-bottom: 0;
  padding: 0.55rem 0.9rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  color: #211b16;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.portal-brandline-chip .portal-hero-logo {
  max-height: 42px;
}
.portal-photo-text .portal-hero-title {
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
}
.portal-photo-text .portal-hero-accent {
  color: #ffd0d5;
}
.portal-photo-text .portal-hero-text {
  color: rgba(255, 255, 255, 0.9);
}
.portal-features-glass {
  gap: 0.5rem;
  margin-bottom: 0;
}
.portal-features-glass li {
  flex-direction: row;
  max-width: none;
  min-width: 0;
  padding: 0.45rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.portal-features-glass li:first-child {
  border-inline-start: 1px solid rgba(255, 255, 255, 0.35);
}
.portal-features-glass .bi {
  font-size: 1.05rem;
  color: #fff;
}

/* ---- "welcome back" on a remembered device ---- */
.portal-back {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1rem;
  padding: 0.55rem 0.8rem;
  border-radius: 0.9rem;
  background: rgba(var(--bs-primary-rgb), 0.07);
  border: 1px solid rgba(var(--bs-primary-rgb), 0.2);
  font-weight: 600;
}
.portal-back.d-none {
  display: none !important;
}
.avatar-md {
  width: 44px;
  height: 44px;
  font-size: 1.15rem;
}

/* ---- the light / dark switch ---- */
.portal-theme {
  border: 1px solid #d9d1c8;
  border-radius: 0.6rem;
  background: #fff;
  color: #4d4640;
}
.portal-theme .portal-sun,
html[data-bs-theme='dark'] .portal-theme .portal-moon {
  display: none;
}
html[data-bs-theme='dark'] .portal-theme .portal-sun {
  display: inline-block;
}

/* ---- dark mode ---- */
html[data-bs-theme='dark'] .portal {
  color: #ece6df;
  color-scheme: dark;
  background:
    radial-gradient(1100px 640px at 16% 6%, rgba(255, 196, 128, 0.1) 0%, rgba(0, 0, 0, 0) 62%),
    linear-gradient(135deg, #141010 0%, #1b1513 55%, #231917 100%);
}
html[data-bs-theme='dark'] .portal-glow {
  background:
    radial-gradient(520px 420px at 30% 18%, rgba(255, 210, 150, 0.16), rgba(255, 210, 150, 0) 70%),
    radial-gradient(
      640px 520px at 72% 60%,
      rgba(var(--bs-primary-rgb), 0.16),
      rgba(var(--bs-primary-rgb), 0) 70%
    );
}
html[data-bs-theme='dark'] .portal-glow::before {
  opacity: 0.35;
}
html[data-bs-theme='dark'] .portal-lamp {
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.6)) brightness(1.4);
}
html[data-bs-theme='dark'] .portal-hero-title {
  color: #f6f1eb;
}
html[data-bs-theme='dark'] .portal-hero-text,
html[data-bs-theme='dark'] .portal-features li {
  color: #c9c0b7;
}
html[data-bs-theme='dark'] .portal-features li {
  border-inline-start-color: rgba(255, 255, 255, 0.12);
}
html[data-bs-theme='dark'] .portal-slogan {
  color: #a39a91;
  border-inline-start-color: #4a423c;
}
html[data-bs-theme='dark'] .portal-iso-block {
  background: linear-gradient(180deg, #8e714b, #6b5132);
  color: #fff7ec;
}
html[data-bs-theme='dark'] .portal .portal-card {
  --bs-body-color: #ece6df;
  --bs-body-bg: #1f1a18;
  --bs-border-color: #3a322d;
  --bs-secondary-color: rgba(236, 230, 223, 0.7);
  color: #ece6df;
  background: rgba(30, 25, 23, 0.86);
  border-color: rgba(var(--bs-primary-rgb), 0.5);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 30px 80px rgba(0, 0, 0, 0.55),
    0 0 70px rgba(var(--bs-primary-rgb), 0.2);
}
html[data-bs-theme='dark'] .portal-subtitle,
html[data-bs-theme='dark'] .portal-footer {
  color: #a8a097;
}
html[data-bs-theme='dark'] .portal-field .form-control {
  background: #171311;
  border-color: #3a322d;
  color: #f2ede8;
}
html[data-bs-theme='dark'] .portal-field .form-control::placeholder {
  color: #857b72;
}
html[data-bs-theme='dark'] .portal-field > .bi:first-child,
html[data-bs-theme='dark'] .portal-eye {
  color: #a59c93;
}
html[data-bs-theme='dark'] .portal-alert {
  background: #3a1d20;
  color: #f5b8bf;
}
html[data-bs-theme='dark'] .portal .lang-switch .btn,
html[data-bs-theme='dark'] .portal-theme {
  background: #262019;
  border-color: #4a423c;
  color: #e3dcd4;
}
html[data-bs-theme='dark'] .portal-forgot {
  color: #ff8a96;
}

@media (max-width: 991.98px) {
  .portal-has-photo .portal-hero-photo {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .portal-photo img {
    animation: none;
  }
}
