* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background:
    linear-gradient(rgba(30, 144, 255, 0.45), rgba(0, 0, 0, 0.35)),
    url("../img/login_Cover.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
}

#loginForm {
  width: 100%;
  max-width: 420px;
  min-width: 0;
  margin: 0;
}

.login-box {
  width: 100%;
  padding: 35px;
  border-radius: 25px;
  background: rgba(241, 250, 238, 0.96);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
}

.dole-logo {
  width: 90px;
  height: 90px;
  object-fit: contain;
  display: block;
  margin: 0 auto 15px;
}

#heading {
  margin: 15px 0 5px;
  color: #1d3557;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  overflow-wrap: anywhere;
}

.subtitle-login {
  color: #457b9d;
  text-align: center;
  line-height: 1.5;
  margin: 12px 0 20px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Consistent field sizes without the former global input padding rules. */
.field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 22px;
  background: #e8f2f3;
  box-shadow: inset 2px 4px 8px rgba(0, 0, 0, 0.08);
  margin-bottom: 12px;
}

.field:focus-within {
  border-color: #457b9d;
  box-shadow: 0 0 0 3px rgba(69, 123, 157, 0.2);
}

.input-icon {
  width: 18px;
  height: 18px;
  fill: #457b9d;
  flex-shrink: 0;
}

.input-field {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 50px;
  margin: 0;
  padding: 12px 0;
  border: 0;
  outline: none;
  background: transparent;
  color: #1d3557;
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
  scroll-margin-block: 24px;
}

.input-field::placeholder {
  color: #457b9d;
  opacity: 1;
}

.show-password-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: 0 0 12px;
}

.show-password-wrapper input[type="checkbox"] {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin: 0;
  padding: 0;
  accent-color: #457b9d;
  cursor: pointer;
}

.show-password-wrapper label {
  display: flex;
  flex: 1;
  align-items: center;
  min-height: 44px;
  margin: 0;
  color: #1d3557;
  font-size: 16px;
  line-height: 1.5;
  cursor: pointer;
}

.login-btn {
  width: 100%;
  min-height: 55px;
  padding: 12px;
  border: 0;
  border-radius: 10px;
  background: #457b9d;
  color: white;
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.5;
  cursor: pointer;
  transition: background-color .2s, color .2s;
}

.account-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 4px 12px;
  margin-top: 12px;
}

.link-btn {
  display: inline-flex;
  flex: 1 1 140px;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 8px 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #007bff;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  cursor: pointer;
}

.login-btn:focus-visible,
.link-btn:focus-visible,
.error-ok-btn:focus-visible,
#showPassword:focus-visible {
  outline: 3px solid #1d3557;
  outline-offset: 3px;
}

#loadingOverlay {
  position: fixed;
  inset: 0;
  padding: 16px;
  background: rgba(255, 255, 255, .88);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 99999;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}

.loading-content p {
  margin: 0;
  color: #1d3557;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.5;
}

.loader-container {
  width: 70px;
  height: 70px;
  transform-origin: center;
  animation: rotateLoader 2s linear infinite;
}

.loader-circle {
  fill: none;
  stroke: #106ee8;
  stroke-width: 6;
  stroke-dasharray: 2, 200;
  stroke-dashoffset: 0;
  stroke-linecap: round;
  animation: dashLoader 1.5s ease-in-out infinite;
}

.error-modal {
  position: fixed;
  inset: 0;
  padding: 16px;
  background: rgba(0, 0, 0, .45);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100000;
}

.error-card {
  width: 100%;
  max-width: 360px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fff;
  border-radius: 20px;
  padding: 30px;
  text-align: center;
  box-shadow: 0 15px 35px rgba(0, 0, 0, .25);
}

.error-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  width: 70px;
  height: 70px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: #e63946;
  color: #fff;
}

.error-card h2 {
  margin: 0 0 12px;
  color: #1d3557;
  font-size: 24px;
  line-height: 1.3;
}

.error-card p {
  color: #555;
  font-size: 16px;
  line-height: 1.5;
  margin: 0 0 25px;
  overflow-wrap: anywhere;
}

.error-ok-btn {
  width: 100%;
  min-height: 48px;
  padding: 12px;
  border: 0;
  border-radius: 12px;
  background: #457b9d;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background-color .2s;
}

@media (hover: hover) and (pointer: fine) {
  .login-btn:hover {
    background: #a8dadc;
    color: #1d3557;
  }

  .link-btn:hover {
    text-decoration: underline;
  }

  .error-ok-btn:hover {
    background: #1d3557;
  }
}

@media (max-width: 768px), (hover: none), (pointer: coarse) {
  body {
    background-attachment: scroll;
  }

  .login-box,
  #loadingOverlay {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (max-width: 600px) {
  .login-box {
    padding: 24px;
  }
}

@media (max-width: 400px) {
  .login-box {
    padding: 20px;
  }

  #heading {
    font-size: 22px;
  }
}

@media (max-height: 480px) {
  .login-box {
    padding: 20px;
  }

  .dole-logo {
    width: 72px;
    height: 72px;
    margin-bottom: 12px;
  }

  #heading {
    font-size: 22px;
  }

  .error-card {
    padding: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-btn,
  .error-ok-btn {
    transition: none;
  }

  .loader-container,
  .loader-circle {
    animation: none;
  }

  .loader-circle {
    stroke-dasharray: 90, 200;
  }
}
