@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;500;600;700&display=swap");

:root {
  /* Brand chính */
  --sam-primary: #CA8471;
  --sam-primary-light: #F1C5B4;
  --sam-primary-soft: #F7DED6;

  /* Màu phụ từ palette */
  --blue-deep: #1C2743;
  --blue-main: #213862;
  --purple-blend: #B46382;
  --orange-pop: #FD9564;
  --red-vibe: #E3463F;

  /* Text */
  --text-main: #1f2933;
  --text-sub: #4b5563;
  --text-muted: #9ca3af;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Open Sans", sans-serif;
}

body {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;

  /* Nền tím rose-gold TRẦM */
  background:
    radial-gradient(circle at top left, #5E2C54 0, transparent 55%),
    radial-gradient(circle at bottom right, #314066 0, transparent 60%),
    linear-gradient(135deg, #1A0F1F 0%, #241329 40%, #2B1933 100%);
  background-blend-mode: normal;

  overflow: hidden;
  position: relative;
  color: var(--text-main);
}

/* Canvas nền động */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

/* Chọn text */
::selection {
  background: rgba(202, 132, 113, 0.2);
  color: #111827;
}

/* HỘP LOGIN */
.wrapper {
  width: 100%;
  max-width: 400px;
  border-radius: 20px;
  padding: 30px 24px 26px;
  text-align: center;

  background:
    linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.96),
      rgba(248, 249, 255, 0.95)
    );
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);

  border: 1px solid rgba(202, 132, 113, 0.35);
  box-shadow:
    0 22px 55px rgba(15, 23, 42, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.7);
}

/* FORM */
form {
  display: flex;
  flex-direction: column;
}

/* TIÊU ĐỀ */
h2 {
  font-size: 1.6rem;
  margin-bottom: 25px;
  color: var(--sam-primary);
  letter-spacing: 0.08em;
}

h2 + p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* INPUT */
.input-field {
  position: relative;
  border-bottom: 1.4px solid rgba(148, 163, 184, 0.7);
  margin: 18px 0;
  padding-bottom: 2px;
  padding-right: 34px;
}

.input-field label {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  color: var(--text-sub);
  font-size: 0.95rem;
  pointer-events: none;
  transition: 0.18s ease;
  opacity: 0.9;
}

.input-field input {
  width: 100%;
  height: 44px;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.98rem;
  color: var(--blue-deep);
}

/* Label thu nhỏ khi focus / có value */
.input-field input:focus ~ label,
.input-field input:valid ~ label {
  font-size: 0.75rem;
  top: 0;
  transform: translateY(-120%);
  color: var(--sam-primary);
}

/* Gạch highlight */
.input-field::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 0;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--sam-primary),
    var(--orange-pop)
  );
  transition: 0.25s ease;
}

.input-field:focus-within::after {
  width: 100%;
}

/* THÔNG BÁO LỖI INLINE (dưới mật khẩu, không làm nhảy bố cục nhiều) */
.login-error-inline {
  margin-top: 4px;
  font-size: 0.78rem;      /* nhỏ hơn chút */
  color: #ef4444;          /* đỏ nhẹ */
  text-align: left;
  min-height: 16px;        /* luôn giữ khoảng trống -> hạn chế nhảy layout */
  line-height: 1.2;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.login-error-inline.is-hidden {
  opacity: 0;
}

/* REMEMBER + FORGOT */
.forget {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0 28px;
  color: var(--text-sub);
  font-size: 0.9rem;
  gap: 10px;
}

#remember {
  accent-color: var(--sam-primary);
}

.forget label {
  display: flex;
  align-items: center;
}

.forget label p {
  margin-left: 8px;
}

/* LINK */
.wrapper a {
  color: var(--sam-primary);
  text-decoration: none;
  font-weight: 500;
}

.wrapper a:hover {
  text-decoration: underline;
}

/* BUTTON */
button {
  background: linear-gradient(
    135deg,
    var(--sam-primary),
    var(--sam-primary-light)
  );
  color: #1f2933;
  font-weight: 700;
  border: none;
  padding: 12px 20px;
  cursor: pointer;
  border-radius: 999px;
  font-size: 0.98rem;
  border: 1px solid rgba(250, 250, 250, 0.8);
  transition: 0.25s ease;
  letter-spacing: 0.03em;
  box-shadow:
    0 12px 28px rgba(202, 132, 113, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.6);
}

button:hover {
  color: #fef3eb;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.4), transparent 55%),
    linear-gradient(135deg, #b86a59, #fd9564);
  box-shadow:
    0 16px 34px rgba(202, 132, 113, 0.75),
    0 0 0 1px rgba(202, 132, 113, 0.7);
}

/* REGISTER */
.register {
  text-align: center;
  margin-top: 24px;
  color: var(--text-sub);
  font-size: 0.9rem;
}

.register a {
  color: var(--sam-primary);
}

.contact-admin {
  color: var(--sam-primary);
  font-weight: 600;
  margin-top: 3px;
}

/* MOBILE */
@media (max-width: 480px) {
  /* Khóa chiều cao & chặn scroll cho mobile */
  html,
  body {
    height: 100%;
    max-height: 100%;
    overflow: hidden;
  }

  body {
    padding: 0; /* bỏ padding 20px để không bị dư chiều cao */
  }

  .wrapper {
    max-width: 340px;
    width: 100%;
    padding: 22px 16px 20px;
    border-radius: 18px;
    margin: 0 auto; /* căn giữa ngang */
  }

  .input-field label {
    font-size: 0.85rem;
  }

  h2 {
    font-size: 1.35rem;
    margin-bottom: 18px;
  }

  .input-field input {
    height: 40px;
  }

  .forget {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
  }

  button {
    padding: 10px 14px;
    font-size: 0.93rem;
  }
}


/* DESKTOP */
@media (min-width: 1024px) {
  .wrapper {
    padding: 34px 30px 30px;
    box-shadow:
      0 26px 70px rgba(15, 23, 42, 0.18),
      0 0 0 1px rgba(255, 255, 255, 0.85);
  }
}

/* ---------------- ICON INPUT (user + eye) ---------------- */

.field-icon {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
}

/* ÉP MÀU #CA8471 */
.field-icon,
.field-icon * ,
.field-icon i,
.field-icon svg {
  color: var(--sam-primary) !important;
  fill: var(--sam-primary) !important;
}

.static-icon {
  pointer-events: none;
  opacity: 0.9;
}

.toggle-password {
  cursor: pointer;
}

/* ---------------- FOOTER ---------------- */

.login-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.78);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.login-footer p {
  pointer-events: auto;
}

.footer-logo {
  width: 180px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45));
}
