/**
 * Trang đăng nhập VA (web + admin). Ảnh: public/assets/images/
 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  margin: 0;
  padding: 0;
  height: 100%;
  background-color: #9a0036;
  scrollbar-color: rgba(255, 255, 255, 0.35) #9a0036;
}

html::-webkit-scrollbar-track {
  background: #9a0036;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  min-height: 100dvh;
  background-color: #9a0036;
  overflow-x: hidden;
}

.login-page {
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: #9a0036;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  justify-content: safe center;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  padding-top: max(clamp(0.75rem, 4vw, 2rem), env(safe-area-inset-top, 0px));
  padding-bottom: max(clamp(0.75rem, 4vw, 2rem), env(safe-area-inset-bottom, 0px));
  padding-left: clamp(0.75rem, 4vw, 1.5rem);
  padding-right: clamp(0.75rem, 4vw, 1.5rem);
  margin: 0;
  box-sizing: border-box;
}

.login-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url('../images/background_login_1.png');
  background-size: 195% 203%;
  background-position: 50% 39%;
  background-repeat: no-repeat;
  opacity: 0.05;
  pointer-events: none;
  z-index: 0;
}

.login-page__wrapper {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 520px;
  gap: clamp(1rem, 3vw, 1.75rem);
  margin-block: auto;
}

.login-page__logo {
  text-align: center;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-page__logo img {
  width: clamp(240px, 70vw, 400px);
  height: auto;
  max-height: min(168px, 28vh);
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.login-box {
  background: #fff;
  border-radius: clamp(12px, 3vw, 20px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.1);
  margin-top: 10px;
  padding: clamp(1.4rem, 5vw, 2.4rem) clamp(1.2rem, 6vw, 2.6rem);
  width: min(450px, 100%);
  max-width: 100%;
  min-height: clamp(210px, 34vh, 300px);
  box-sizing: border-box;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.login-title {
  font-size: clamp(1.6rem, 4.5vw, 2.1rem);
  font-weight: 700;
  color: #111827;
  margin: 0 0 clamp(0.3rem, 1.2vw, 0.5rem);
}

.login-subtitle {
  font-size: clamp(0.85rem, 2.8vw, 1rem);
  color: #666;
  line-height: 1.4;
  margin: 0 0 clamp(1.25rem, 4vw, 2rem);
}

.social-login {
  display: flex;
  justify-content: center;
  padding-bottom: clamp(0.25rem, 2vw, 0.75rem);
}

.login-subtitle-note {
  margin-top: 1rem;
  margin-bottom: 0;
}

.login-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  border-radius: 9px;
  padding: 0.75rem 0.95rem;
  margin-bottom: 1rem;
  font-size: clamp(0.76rem, 2.1vw, 0.85rem);
  text-align: left;
  line-height: 1.5;
}

.login-alert[hidden] {
  display: none !important;
}

.login-alert--error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.login-alert__dismiss {
  margin-left: auto;
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.45;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
}

.btn-google-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(50px, 13vw, 62px);
  height: clamp(50px, 13vw, 62px);
  border-radius: 50%;
  border: 1.5px solid #e5e7eb;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.09);
  cursor: pointer;
  text-decoration: none;
  transition: box-shadow 0.2s, transform 0.2s;
  position: relative;
}

.btn-google-icon img,
.btn-google-icon svg {
  width: clamp(26px, 7vw, 36px);
  height: clamp(26px, 7vw, 36px);
}

.btn-google-icon:hover:not(.disabled) {
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
  transform: translateY(-3px);
}

.btn-google-icon.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-google-icon.loading img,
.btn-google-icon.loading svg {
  opacity: 0;
}

.btn-google-icon.loading::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2.5px solid #f3f4f6;
  border-top-color: #8b1a3a;
  border-radius: 50%;
  animation: login-spin 0.65s linear infinite;
}

@keyframes login-spin {
  to {
    transform: rotate(360deg);
  }
}

.login-footer {
  margin-top: clamp(1rem, 3vw, 1.25rem);
  text-align: center;
  font-size: clamp(0.8rem, 2.2vw, 0.85rem);
}

.login-footer a {
  color: #8b1a3a;
  font-weight: 500;
  text-decoration: none;
}

.login-footer a:hover {
  text-decoration: underline;
}

.login-divider {
  text-align: center;
  color: #6c757d;
  font-size: 0.85rem;
  margin: clamp(1rem, 3vw, 1.25rem) 0;
}

/* Form mật khẩu (khi bật allow_password_login) */
.login-box .auth-field {
  margin-bottom: 16px;
  text-align: left;
}

.login-box .auth-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
}

.login-box .auth-field input[type='email'],
.login-box .auth-field input[type='password'],
.login-box .auth-field input[type='text'] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 1rem;
  box-sizing: border-box;
}

.login-box .auth-field input:focus {
  outline: none;
  border-color: #9a0036;
  box-shadow: 0 0 0 3px rgba(154, 0, 54, 0.15);
}

.login-box .auth-field input.is-invalid {
  border-color: #dc3545;
}

.login-box .auth-error {
  font-size: 0.8rem;
  color: #dc3545;
  margin-top: 4px;
}

.login-box .auth-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 0.875rem;
  text-align: left;
}

.login-box .auth-btn {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}

.login-box .auth-btn-primary {
  background: #9a0036;
  color: #fff;
}

.login-box .auth-btn-primary:hover {
  background: #7a002b;
}

@media (max-width: 480px) {
  .login-page {
    background-attachment: scroll;
    padding: clamp(1rem, 5vw, 1.5rem) 1rem;
  }

  .login-box {
    padding: 1.5rem 1.2rem;
    border-radius: 14px;
  }

  .btn-google-icon {
    width: 58px;
    height: 58px;
  }

  .login-page__wrapper {
    max-width: 100%;
    padding: 0 1rem;
  }
}

@media (min-width: 481px) and (max-width: 1024px) {
  .login-page__wrapper {
    max-width: 480px;
  }

  .login-box {
    padding: 2rem 2.2rem;
  }
}

@media (min-width: 1025px) {
  .login-page__wrapper {
    max-width: 520px;
  }

  .login-box {
    padding: 2.6rem 3rem;
  }

  .btn-google-icon {
    width: 68px;
    height: 68px;
  }

  .btn-google-icon img,
  .btn-google-icon svg {
    width: 40px;
    height: 40px;
  }
}
