﻿:root {
  --main_color: #4753BF;
  --main_gradient: linear-gradient(to right, #4753BF, #506CD7);
  --text_color: #130C3A;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  min-width: 320px;
  /* Updated for better mobile support */
}

/* This old media query is now replaced by comprehensive responsive design below */
/* @media (max-width: 700px) {
  .login {
    width: 90%;
    padding: 20px;
  }
} */

.be-vietnam-pro-thin {
  font-family: "Be Vietnam Pro", sans-serif;
  font-weight: 100;
  font-style: normal;
}

.be-vietnam-pro-extralight {
  font-family: "Be Vietnam Pro", sans-serif;
  font-weight: 200;
  font-style: normal;
}

.be-vietnam-pro-light {
  font-family: "Be Vietnam Pro", sans-serif;
  font-weight: 300;
  font-style: normal;
}

.be-vietnam-pro-regular {
  font-family: "Be Vietnam Pro", sans-serif;
  font-weight: 400;
  font-style: normal;
}

.be-vietnam-pro-medium {
  font-family: "Be Vietnam Pro", sans-serif;
  font-weight: 500;
  font-style: normal;
}

.be-vietnam-pro-semibold {
  font-family: "Be Vietnam Pro", sans-serif;
  font-weight: 600;
  font-style: normal;
}

.be-vietnam-pro-bold {
  font-family: "Be Vietnam Pro", sans-serif;
  font-weight: 700;
  font-style: normal;
}

.be-vietnam-pro-extrabold {
  font-family: "Be Vietnam Pro", sans-serif;
  font-weight: 800;
  font-style: normal;
}

.be-vietnam-pro-black {
  font-family: "Be Vietnam Pro", sans-serif;
  font-weight: 900;
  font-style: normal;
}

.be-vietnam-pro-thin-italic {
  font-family: "Be Vietnam Pro", sans-serif;
  font-weight: 100;
  font-style: italic;
}

.be-vietnam-pro-extralight-italic {
  font-family: "Be Vietnam Pro", sans-serif;
  font-weight: 200;
  font-style: italic;
}

.be-vietnam-pro-light-italic {
  font-family: "Be Vietnam Pro", sans-serif;
  font-weight: 300;
  font-style: italic;
}

.be-vietnam-pro-regular-italic {
  font-family: "Be Vietnam Pro", sans-serif;
  font-weight: 400;
  font-style: italic;
}

.be-vietnam-pro-medium-italic {
  font-family: "Be Vietnam Pro", sans-serif;
  font-weight: 500;
  font-style: italic;
}

.be-vietnam-pro-semibold-italic {
  font-family: "Be Vietnam Pro", sans-serif;
  font-weight: 600;
  font-style: italic;
}

.be-vietnam-pro-bold-italic {
  font-family: "Be Vietnam Pro", sans-serif;
  font-weight: 700;
  font-style: italic;
}

.be-vietnam-pro-extrabold-italic {
  font-family: "Be Vietnam Pro", sans-serif;
  font-weight: 800;
  font-style: italic;
}

.be-vietnam-pro-black-italic {
  font-family: "Be Vietnam Pro", sans-serif;
  font-weight: 900;
  font-style: italic;
}

.logo_medical img {
  height: 68px;
  width: auto;
  object-fit: contain;
}

.main_container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  margin: 0 auto;
  background-image: url('/img/blank-page-background.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow-x: hidden;
  box-sizing: border-box;
}

.login {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-wrap: nowrap;
  gap: 32px;
  position: relative;
  width: 560px;
  background-color: #ffffff;
  padding: 20px 40px;
  border: 10px solid rgba(255, 255, 255, 0.4);
  border-radius: 20px;
  box-sizing: border-box;
}

.login_logo {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  flex-shrink: 0;
  gap: 24px;
  width: 100%;
  height: 100%;
}

.login_card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  position: relative;
  flex-shrink: 0;
  gap: 24px;
  width: 100%;
  min-width: 0;
}

.card_textfiled {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: center;
  gap: 20px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  position: relative;
  width: 100%;
}

.label_value_14px {
  font-size: 14px;
  height: 18px;
}

.label_value_16px {
  font-size: 16px;
  height: 22px;
}

.label_value_22px {
  font-size: 22px;
  height: 32px;
}

.label_value_24px {
  font-size: 24px;
  height: 34px;
}

.card_textfiled__email {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  align-self: center;
  flex-wrap: nowrap;
  flex-shrink: 0;
  gap: 4px;
  position: relative;
  width: 100%;
}

.email_placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: stretch;
  flex-wrap: nowrap;
  flex-shrink: 0;
  padding: 12px 12px 12px 12px;
  background: #ffffff;
  border: 1px solid #e5e8ec;
  border-radius: 8px;
}

.email_placeholder:focus {
  outline: none;
  border: 1px solid var(--main_color);
}

.email_placeholder::placeholder {
  color: #D0CED8;
  opacity: 1;
}

.card_textfiled__password {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  align-self: center;
  flex-wrap: nowrap;
  flex-shrink: 0;
  gap: 12px;
  position: relative;
  width: 100%;
}

.password_input {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  align-self: center;
  flex-wrap: nowrap;
  flex-shrink: 0;
  gap: 4px;
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

.password_placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: stretch;
  flex-wrap: nowrap;
  flex-shrink: 0;
  padding: 12px 12px 12px 12px;
  background: #ffffff;
  border: 1px solid #e5e8ec;
  border-radius: 8px;
  width: 100%;
  box-sizing: border-box;
}

.password_placeholder:focus {
  outline: none;
  border: 1px solid var(--main_color);
}

.password_placeholder::placeholder {
  color: #D0CED8;
  opacity: 1;
}

.input-wrapper {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  align-self: stretch;
  width: 100%;
}

.icon-toggle {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  cursor: pointer;
  color: #716D89;
  font-size: 20px;
  user-select: none;
  pointer-events: auto;
}

.password_remember {
  display: flex;
  flex-direction: row;
  align-items: center;
  align-self: stretch;
  justify-content: space-between;
  width: 100%;
  flex-wrap: nowrap
}

.password_remember__checkbox {
  display: flex;
  align-items: center;
  align-self: center;
  gap: 4px;
  width: 100%;
}

.btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: center;
  gap: 16px;
  margin: 0;
  width: 100%;
}

.login_btn {
  display: inline-block;
  text-decoration: none;
  background-image: var(--main_gradient);
  border: none;
  outline: none;
  color: #FFFFFF;
  font-size: 18px;
  line-height: 28px;
  width: 100%;
  padding: 12px 16px;
  text-align: center;
  border-radius: 100px;
  box-sizing: border-box;
  transition: all -5.5s ease-in-out;
  cursor: pointer;
}

.login_btn:hover {
  background: #130C3A;
}

.backtohome_btn {
  font-size: 16px;
  line-height: 22px;
  text-decoration: none;
  background-color: transparent;
  border: none;
  outline: none;
  color: var(--main_color)
}

.backtohome_btn:hover {
  color: #130C3A;
}

.checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--main_color);
}

.invalid-feedback {
  color: red;
  font-size: 12px;
  display: none;
}

.invalid-feedback {
  color: red;
  font-size: 12px;
  display: none;
}

/* Chỉ hiển thị lỗi khi form đã được submit và có class was-validated */
form.was-validated input:invalid+.invalid-feedback {
  display: block;
}

/* Viền đỏ cho input lỗi */
form.was-validated input:invalid {
  border-color: red;
}

/* Logo và tiêu đề */
.login_logo {
  text-align: center;
  height: 100%;
}

.login_logo span {
  color: var(--main_color);
  text-align: center;
  height: 100%;
}

/* Tiêu đề Đăng nhập */
.login_card>span {
  width: 100%;
  text-align: center;
  color: var(--text_color);
}

/* Nhãn Email và Mật khẩu */
.card_textfiled__email span,
.card_textfiled__password span {
  color: var(--text_color);
}

/* Lưu mật khẩu */
.password_remember__checkbox span {
  color: var(--text_color);
}

/* Nút "Quên mật khẩu" nếu sử dụng */
.password_remember__checkbox a {
  color: var(--main_color);
  text-decoration: none;
  white-space: nowrap;
}

/* Form */
form.needs-validation {
  width: 100%;
}

/* CAPTCHA Styles */
/* CAPTCHA Styles */
.captcha-container {
  margin-top: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap !important;
  justify-content: flex-start;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.captcha-input {
  text-align: center;
  text-transform: uppercase;
  font-family: "Be Vietnam Pro", sans-serif;
  font-weight: 400;
  flex-shrink: 1;
  /* Allow shrinking on small screens */
}

.captcha-image {
  flex-shrink: 1;
  /* Allow shrinking on small screens */
}

.captcha-image-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.captcha-refresh-btn {
  flex-shrink: 0;
  /* Keep button size fixed */
}

.captcha-feedback {
  width: 100%;
  margin-top: 8px;
  flex-basis: 100%;
}

.captcha-error {
  animation: captcha-blink 0.3s ease-in-out 3;
  border-color: #dc3545 !important;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

@keyframes captcha-blink {

  0%,
  100% {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
  }

  50% {
    border-color: #ff6b6b;
    box-shadow: 0 0 0 0.4rem rgba(255, 107, 107, 0.4);
  }
}

.btn-refresh {
  width: 42px !important;
  height: 42px !important;
  cursor: pointer;
  color: #007bff;
  font-size: 18px;
  border: none;
  background: none;
  display: inline-block;
  vertical-align: middle;
  transition: all 0.2s ease;
  font-family: "Be Vietnam Pro", sans-serif;
  font-weight: 400;
}

.btn-refresh:hover {
  color: #0056b3;
  transform: scale(1.1);
}

.btn-refresh:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Base CAPTCHA sizes for desktop */
#captchaImage {
  width: 300px;
  height: 42px;
  border: 1px solid #ddd;
  border-radius: 4px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 5px;
  max-width: 100%;
  /* Allow responsive scaling */
  flex-shrink: 1;
  object-fit: contain;
  /* Preserve all content without cropping */
  min-width: 180px;
  /* Minimum width to ensure readability */
}

#CaptchaCode {
  width: 150px;
  max-width: 150px;
  min-width: 120px;
  /* Minimum width for readability */
  text-align: center;
  text-transform: uppercase;
  display: inline-block;
  vertical-align: middle;
  margin-right: 5px;
  font-family: "Be Vietnam Pro", sans-serif;
  font-weight: 400;
  flex-shrink: 1;
  box-sizing: border-box;
}

.btn-refresh {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  min-width: 42px;
  box-sizing: border-box;
}

/* ===================== RESPONSIVE DESIGN ===================== */

/* Large Desktop (1200px and up) */
@media (min-width: 1200px) {
  .login {
    width: 600px;
    padding: 20px 30px;
  }

  .login_logo img {
    height: 80px;
  }

  .label_value_22px {
    font-size: 24px;
    height: 36px;
  }

  .label_value_24px {
    font-size: 26px;
    height: 38px;
  }
}

/* Desktop (992px to 1199px) */
@media (max-width: 1199px) and (min-width: 992px) {
  .login {
    width: 560px;
    padding: 30px 40px;
  }

  .main_container {
    padding: 20px;
  }
}

/* Tablet (768px to 991px) */
@media (max-width: 991px) and (min-width: 768px) {
  .main_container {
    padding: 20px;
    height: auto;
    min-height: 100vh;
  }

  .login {
    width: 90%;
    max-width: 500px;
    padding: 25px 30px;
    margin: 20px 0;
  }

  .login_logo {
    gap: 16px;
    margin-bottom: 10px;
  }

  .login_logo img {
    height: 60px;
  }

  .label_value_22px {
    font-size: 20px;
    height: 28px;
    line-height: 1.3;
  }

  .label_value_24px {
    font-size: 22px;
    height: 30px;
  }

  .card_textfiled {
    gap: 16px;
  }

  .login_card {
    gap: 20px;
  }

  /* CAPTCHA adjustments for tablet */
  .captcha-container {
    gap: 6px;
    max-width: 100%;
    flex-wrap: nowrap !important;
  }

  #CaptchaCode {
    width: 130px !important;
    max-width: 130px !important;
    min-width: 100px !important;
  }

  #captchaImage {
    width: 260px !important;
    height: 38px !important;
    max-width: calc(100vw - 200px) !important;
    min-width: 200px !important;
    object-fit: contain !important;
  }

  .btn-refresh {
    width: 38px !important;
    height: 38px !important;
    font-size: 16px;
  }
}

/* Mobile Large (576px to 767px) */
@media (max-width: 767px) and (min-width: 576px) {
  .main_container {
    padding: 15px;
    height: auto;
    min-height: 100vh;
  }

  .login {
    width: 95%;
    max-width: 450px;
    padding: 20px 25px;
    margin: 15px 0;
    border: 5px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
  }

  .login_logo {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .login_logo img {
    height: 50px;
  }

  .label_value_22px {
    font-size: 18px;
    height: 24px;
    line-height: 1.2;
  }

  .label_value_24px {
    font-size: 20px;
    height: 26px;
  }

  .label_value_14px {
    font-size: 13px;
  }

  .card_textfiled {
    gap: 14px;
  }

  .login_card {
    gap: 18px;
  }

  .email_placeholder,
  .password_placeholder {
    padding: 10px;
    font-size: 14px;
  }

  .btn {
    gap: 12px;
  }

  .login_btn {
    font-size: 16px;
    padding: 12px 16px;
  }

  .backtohome_btn {
    font-size: 14px;
  }

  /* CAPTCHA mobile layout - Keep horizontal on larger mobile */
  .captcha-container {
    justify-content: center;
    gap: 4px;
    max-width: 100%;
    overflow: hidden;
    flex-wrap: nowrap !important;
  }

  #CaptchaCode {
    width: 110px !important;
    max-width: 110px !important;
    min-width: 90px !important;
    font-size: 14px;
  }

  #captchaImage {
    width: 220px !important;
    height: 36px !important;
    max-width: calc(100vw - 160px) !important;
    min-width: 180px !important;
    object-fit: contain !important;
  }

  .btn-refresh {
    width: 36px !important;
    height: 36px !important;
    font-size: 14px;
    min-width: 36px !important;
  }

  /* Stack CAPTCHA elements vertically */
  .login_card div[style*="margin-top: 15px"] {
    text-align: center;
  }

  #serverMessage,
  #clientMessage {
    font-size: 14px !important;
    padding: 8px 12px;
  }
}

/* Special range for CAPTCHA responsive issue (540px - 575px) */
@media (max-width: 575px) and (min-width: 540px) {
  .main_container {
    padding: 15px;
    height: auto;
    min-height: 100vh;
  }

  .login {
    width: 95%;
    max-width: 450px;
    padding: 20px 25px;
    margin: 15px 0;
    border: 5px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
  }

  .login_logo {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .login_logo img {
    height: 50px;
  }

  .label_value_22px {
    font-size: 18px;
    height: 24px;
    line-height: 1.2;
  }

  .label_value_24px {
    font-size: 20px;
    height: 26px;
  }

  .label_value_14px {
    font-size: 13px;
  }

  .card_textfiled {
    gap: 14px;
  }

  .login_card {
    gap: 18px;
  }

  .email_placeholder,
  .password_placeholder {
    padding: 10px;
    font-size: 14px;
  }

  .btn {
    gap: 12px;
  }

  .login_btn {
    font-size: 16px;
    padding: 12px 16px;
  }

  .backtohome_btn {
    font-size: 14px;
  }

  .captcha-container {
    flex-wrap: nowrap !important;
    gap: 4px;
    max-width: 100%;
  }

  #CaptchaCode {
    width: 90px !important;
    max-width: 90px !important;
    min-width: 70px !important;
    font-size: 12px;
  }

  #captchaImage {
    width: 180px !important;
    height: 32px !important;
    max-width: calc(100vw - 140px) !important;
    min-width: 160px !important;
    object-fit: contain !important;
  }

  .btn-refresh {
    width: 30px !important;
    height: 30px !important;
    font-size: 11px;
  }

  #serverMessage,
  #clientMessage {
    font-size: 14px !important;
    padding: 8px 12px;
  }
}

/* Mobile Small (up to 539px to avoid conflict with 540px-575px range) */
@media (max-width: 539px) {
  .main_container {
    padding: 10px;
    height: auto;
    min-height: 100vh;
  }

  .login {
    width: 98%;
    max-width: 380px;
    padding: 15px 20px;
    margin: 10px 0;
    border: 3px solid rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    gap: 20px;
  }

  .login_logo {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .login_logo img {
    height: 40px;
  }

  .label_value_22px {
    font-size: 16px;
    height: 20px;
    line-height: 1.1;
  }

  .label_value_24px {
    font-size: 18px;
    height: 22px;
  }

  .label_value_14px {
    font-size: 12px;
    height: 16px;
  }

  .card_textfiled {
    gap: 12px;
  }

  .login_card {
    gap: 16px;
  }

  .email_placeholder,
  .password_placeholder {
    padding: 8px;
    font-size: 13px;
  }

  .btn {
    gap: 10px;
  }

  .login_btn {
    font-size: 14px;
    padding: 10px 14px;
  }

  .backtohome_btn {
    font-size: 13px;
  }

  /* CAPTCHA small mobile - horizontal if space allows, vertical if too cramped */
  .captcha-container {
    flex-wrap: nowrap !important;
    justify-content: center;
    gap: 4px;
    max-width: 100%;
    overflow: hidden;
  }

  #CaptchaCode {
    width: 100px !important;
    max-width: 100px !important;
    min-width: 80px !important;
    font-size: 12px;
    padding: 6px;
  }

  #captchaImage {
    width: 200px !important;
    height: 32px !important;
    max-width: calc(100vw - 140px) !important;
    min-width: 150px !important;
    object-fit: contain !important;
  }

  .btn-refresh {
    width: 32px !important;
    height: 32px !important;
    font-size: 12px;
  }

  .invalid-feedback {
    font-size: 10px;
  }

  #serverMessage,
  #clientMessage {
    font-size: 12px !important;
    padding: 6px 10px;
  }
}

/* Extra Small Mobile (up to 400px) */
@media (max-width: 400px) {
  .login {
    width: 100%;
    max-width: 320px;
    padding: 12px 15px;
    gap: 16px;
  }

  .login_logo img {
    height: 35px;
  }

  .label_value_22px {
    font-size: 14px;
    height: 18px;
  }

  .label_value_24px {
    font-size: 16px;
    height: 20px;
  }

  #CaptchaCode {
    width: 90px !important;
    max-width: 90px !important;
    min-width: 90px !important;
  }

  #captchaImage {
    width: 180px !important;
    height: 30px !important;
    min-width: 150px !important;
    object-fit: contain !important;
  }

  .btn-refresh {
    width: 30px !important;
    height: 30px !important;
    font-size: 11px;
  }
}

/* Special layout for screens under 390px */
@media (max-width: 390px) {
  .captcha-container {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  #CaptchaCode {
    width: 100% !important;
    max-width: 100% !important;
    min-width: auto !important;
    margin: 0 !important;
    order: 1;
  }

  .captcha-image-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    order: 2;
  }

  #captchaImage {
    width: calc(100% - 40px) !important;
    max-width: calc(100% - 40px) !important;
    min-width: 200px !important;
    height: 32px !important;
    margin: 0 !important;
    flex: 1;
  }

  .btn-refresh {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    margin: 0 !important;
    flex-shrink: 0;
  }
}

/* Very cramped screens - stack CAPTCHA vertically */
@media (max-width: 350px) {
  .captcha-container {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  #CaptchaCode {
    width: 100% !important;
    max-width: 100% !important;
    min-width: auto !important;
    margin: 0 !important;
    order: 1;
  }

  .captcha-image-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    order: 2;
  }

  #captchaImage {
    width: calc(100% - 40px) !important;
    max-width: calc(100% - 40px) !important;
    min-width: 160px !important;
    height: 28px !important;
    margin: 0 !important;
    flex: 1;
    object-fit: contain !important;
  }

  .btn-refresh {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    margin: 0 !important;
    flex-shrink: 0;
  }
}

/* Landscape orientation for mobile devices */
@media (max-height: 600px) and (orientation: landscape) and (max-width: 991px) {
  .main_container {
    padding: 5px;
    height: auto;
  }

  .login {
    padding: 10px 20px;
    gap: 12px;
    margin: 5px 0;
  }

  .login_logo {
    flex-direction: row;
    gap: 8px;
  }

  .login_logo img {
    height: 30px;
  }

  .label_value_22px {
    font-size: 12px;
    height: 16px;
    line-height: 1;
  }

  .login_card {
    gap: 8px;
  }

  .card_textfiled {
    gap: 8px;
  }

  .btn {
    gap: 6px;
  }
}

/* High DPI/Retina Display Support */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
  #captchaImage {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }

  .login_logo img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}