/* style.css */
* {
  box-sizing: border-box;
  font-family: "Kanit", sans-serif;
}

body {
  margin: 0;
  background: linear-gradient(135deg, #fdf3f3, #ffb3b3);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  color: #333;
  padding: 20px;
}

.login-wrapper {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(179, 58, 58, 0.2);
  width: 100%;
  max-width: 440px;
  padding: 40px 30px;
  text-align: center;
  position: relative;
}

.logo {
  margin-bottom: 25px;
  max-width: 350px;
  margin-left: auto;
  margin-right: auto;
}

.logo img {
  width: 100%;
  max-width: 350px;
  height: auto;
  display: block;
  margin: 0 auto 30px;
}

h2 {
  margin-bottom: 30px;
  font-weight: 600;
  color: #b33a3a;
  letter-spacing: 1.2px;
  font-size: 1.8rem;
}

label {
  display: block;
  text-align: left;
  margin-bottom: 8px;
  font-weight: 600;
  color: #444;
  font-size: 0.95rem;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 14px 15px;
  border-radius: 10px;
  border: 2px solid #ddd;
  font-size: 1rem;
  transition: border-color 0.3s ease;
  color: #333;
  margin-bottom: 25px;
  box-shadow: inset 0 2px 5px #f0f0f0;
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: #b33a3a;
  outline: none;
  box-shadow: 0 0 8px #b33a3aaa;
}

button {
  width: 100%;
  padding: 15px 0;
  background-color: #b33a3a;
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  box-shadow: 0 5px 15px rgba(179, 58, 58, 0.6);
}

button:hover {
  background-color: #8a2c2c;
  box-shadow: 0 7px 20px rgba(138, 44, 44, 0.8);
}

.message {
  margin-top: 15px;
  font-weight: 600;
  min-height: 1.2rem;
  color: #b33a3a;
}

.message.success {
  color: #007700;
}

.footer-text {
  margin-top: 35px;
  font-size: 0.8rem;
  color: #999;
}
/* container กำหนด position relative */
.password-wrapper {
  position: relative;
  width: 100%;
}

/* input password ต้องมี padding-right มากพอ เพื่อเว้นที่ให้ไอคอน */
.password-wrapper input[type="password"],
.password-wrapper input[type="text"] {
  width: 100%;
  padding-right: 40px; /* เว้นพื้นที่ขวาให้ไอคอน */
  box-sizing: border-box;
}

/* ไอคอนตาอยู่ขวาและกึ่งกลาง */
.password-wrapper .toggle-password {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  cursor: pointer;
  font-size: 18px;
  color: #b33a3a;
  user-select: none; /* ไม่ให้ไอคอนถูกเลือกข้อความ */
}


/* ✅ ปรับให้เหมาะกับมือถือ */
@media (max-width: 768px) {
  h2 {
    font-size: 1.6rem;
  }

  .login-wrapper {
    padding: 35px 25px;
  }

  input[type="text"],
  input[type="password"] {
    font-size: 1rem;
  }

  button {
    font-size: 1.05rem;
  }

  .logo img {
    max-width: 150px;
  }
}

@media (max-width: 480px) {
  h2 {
    font-size: 1.5rem;
  }

  input[type="text"],
  input[type="password"] {
    padding: 12px 14px;
    font-size: 0.95rem;
  }

  button {
    padding: 13px 0;
    font-size: 1rem;
  }

  .login-wrapper .logo {
    max-width: 150px;
    margin: 0 auto 30px;
  }

  .login-wrapper .logo img {
    width: 100%;
    height: auto;
    display: block;
  }
}

@media (max-width: 360px) {
  h2 {
    font-size: 1.3rem;
  }

  .logo img {
    max-width: 150px; /* แก้จาก 150x เป็น 150px */
  }

  .login-wrapper {
    padding: 25px 15px;
  }

  input[type="text"],
  input[type="password"],
  button {
    font-size: 0.9rem;
    padding: 12px;
  }
}

/* Spinner */
#message {
  margin-top: 10px;
  font-weight: bold;
}

#message.success {
  color: green;
}

.spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid #3498db;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  animation: spin 1s linear infinite;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}
