﻿:root {
    --main_color: #2c4578;
    --main_gradient: linear-gradient(to right, var(--main_color), #7686a6);
    --text_color: #130C3A;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    min-width: 430px;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Main container styles with improved background handling */
.main_container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
    position: relative;
    background: linear-gradient(rgba(44, 69, 120, 0.1), rgba(44, 69, 120, 0.1)),
                url('/img/backgroud2.jpg') center center/cover fixed;
}

/* Ensure background covers viewport on iOS */
@supports (-webkit-touch-callout: none) {
    .main_container {
        background-attachment: scroll;
    }
}

/* Login container styles */
.login {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-wrap: nowrap;
    gap: 32px;
    position: relative;
    width: 560px;
    background-color: rgba(255, 255, 255, 0.98);
    padding: 20px 40px;
    border: 10px solid rgba(255, 255, 255, 0.4);
    border-radius: 32px;
    box-sizing: border-box;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.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;
    min-height: 100vh;
    width: 100%;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
    position: relative;
    background: linear-gradient(rgba(44, 69, 120, 0.1), rgba(44, 69, 120, 0.1)),
                url('/img/backgroud2.jpg') center center/cover fixed;
}

/* Ensure background covers viewport on iOS */
@supports (-webkit-touch-callout: none) {
    .main_container {
        background-attachment: scroll;
    }
}

.login {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-wrap: nowrap;
  gap: 32px;
  position: relative;
  width: 560px;
  background-color: rgba(255, 255, 255, 0.98);
  padding: 20px 40px;
  border: 10px solid rgba(255, 255, 255, 0.4);
  border-radius: 32px;
  box-sizing: border-box;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.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: #2b4477;
        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%;
}

/* Enhanced responsive styles */
@media (max-width: 768px) {
    html, body {
        min-width: 320px;
    }

    .main_container {
        padding: 15px;
        height: auto;
        min-height: 100vh;
    }

    .login {
        width: 90%;
        max-width: 500px;
        padding: 20px;
        border-width: 5px;
        margin: 20px 0;
    }
    
    .login_logo {
        flex-direction: column;
        gap: 16px;
    }

    .login_logo span {
        font-size: 18px;
        text-align: center;
    }

    .logo_medical img {
        height: 50px;
    }

    .label_value_24px {
        font-size: 20px;
        height: 28px;
    }

    .label_value_22px {
        font-size: 18px;
        height: 26px;
    }

    .login_btn {
        font-size: 16px;
        padding: 10px 14px;
    }

    .backtohome_btn {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .main_container {
        padding: 10px;
    }

    .login {
        padding: 15px;
        border-width: 3px;
        width: 95%;
    }
    
    .login_logo span {
        font-size: 16px;
    }

    .logo_medical img {
        height: 40px;
    }

    .label_value_24px {
        font-size: 18px;
        height: 26px;
    }

    .label_value_14px {
        font-size: 12px;
        height: 16px;
    }

    .email_placeholder,
    .password_placeholder {
        padding: 10px;
    }

    .login_btn {
        font-size: 14px;
        padding: 8px 12px;
    }

    .backtohome_btn {
        font-size: 13px;
    }

    .checkbox {
        width: 14px;
        height: 14px;
    }
}

/* Handle very tall screens */
@media (min-height: 1024px) {
    .main_container {
        height: 100vh;
    }
}

/* Handle landscape mode */
@media (max-height: 480px) and (orientation: landscape) {
    .main_container {
        min-height: 100vh;
        height: auto;
        padding: 20px 15px;
    }

    .login {
        margin: 15px 0;
        max-height: calc(100vh - 40px);
        overflow-y: auto;
    }
}

/* Fix for devices with notches */
@supports (padding: max(0px)) {
    .main_container {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
        padding-top: max(20px, env(safe-area-inset-top));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}

/* High-resolution screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .main_container {
        background-size: cover;
    }
}

/* Print styles */
@media print {
    .main_container {
        background: none;
        height: auto;
        min-height: 0;
    }

    .login {
        border: 1px solid #000;
        box-shadow: none;
        width: 100%;
        max-width: 100%;
    }
}

/* Error handling styles */
.email_placeholder.is-invalid,
.password_placeholder.is-invalid {
    border-color: #dc3545;
    animation: errorShake 0.5s;
}

.error-message {
    color: #dc3545;
    font-size: 14px;
    margin-top: 5px;
    margin-bottom: 10px;
    text-align: center;
    width: 100%;
    animation: fadeInOut 3s forwards;
}

.invalid-feedback {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
    animation: fadeInOut 3s forwards;
}

form.was-validated input:invalid + .invalid-feedback {
    display: block;
}

/* Animation for error shake */
@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Animation for fading in and out */
@keyframes fadeInOut {
    0% { opacity: 0; }
    10% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; visibility: hidden; }
}

/* Error state with transition */
.email_placeholder:invalid,
.password_placeholder:invalid {
    transition: border-color 0.3s ease-in-out;
}

/* Error message container */
.card_textfiled__email,
.card_textfiled__password {
    position: relative;
}

/* Error state management */
.form-error {
    animation: fadeInOut 3s forwards;
}

/* Override invalid state after animation */
@media (prefers-reduced-motion: no-preference) {
    .email_placeholder.is-invalid,
    .password_placeholder.is-invalid {
        animation: errorShake 0.5s, fadeInOut 3s forwards;
    }
}