/* Modern Split-Screen Login Page Styles */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&display=swap');

:root {
  --primary-color: #00a8ff;
  --secondary-color: #9c88ff;
  --background-color: #101820;
  --surface-color: #1a2634;
  --text-color: #f2f5f8;
  --muted-text-color: #8a9eb2;
  --error-color: #ff6b6b;
  --success-color: #51cf66;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body.modern-login-page {
  font-family: 'Kanit', sans-serif;
  background-color: transparent; /* ให้เห็น body โปร่งใสทะลุไปถึง fixed bg */
  color: var(--text-color);
  overflow: hidden;
  margin: 0;
  height: 100vh; /* เพื่อให้ 100vh มีผลชัดเจนขึ้น */
}

/* พื้นหลังหลักที่ครอบคลุมทั้งหน้า */
.split-container-bg {
    position: fixed; /* ใช้ fixed ให้อยู่กับที่ */
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -2; /* ไว้ด้านหลังสุด */
}

/* overlay แบบสีเดียวโปร่งใสให้เห็นภาพด้านหลังทั่วทั้งหน้า */
.full-overlay {
    position: fixed; /* เปลี่ยนจาก absolute เป็น fixed เพื่อให้คลุมทั้งจอ */
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(16, 24, 32, 0.4); /* ความทึบ 40% ให้ภาพดูมีมิติและตัวอักษรอ่านง่าย */
    z-index: -1; /* อยู่เหนือภาพพื้นหลัง แต่อยู่ใต้เนื้อหาทั้งหมด */
}

.split-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
  z-index: 1; /* ให้อยู่เหนือพื้นหลังและ overlay ทั้งหมด */
}

/* ปรับความกว้างของฝั่งซ้ายและขวาตรงนี้ */
.split-pane {
  height: 100%;
  display: flex;
  flex-direction: column; /* เปลี่ยนเป็น column เพื่อให้ของเรียงจากบนลงล่าง */
  justify-content: center;
  align-items: center;
  position: relative;
}

/* Left Pane (Branding/Image) */
.left-pane {
  width: 30%; /* ปรับขนาดความกว้างลดลงอีก จาก 35% เป็น 30% */
  text-align: center;
  color: white;
  padding: 40px;
}

.pane-content {
  z-index: 2;
  width: 100%;
  max-width: 600px;
}

.logo-img-pane {
  z-index: 2;
  width: 100%;
  height: auto;
  border-radius: 16px;
  margin-bottom: 25px; /* เว้นระยะห่างด้านล่างให้ข้อความ */
  object-fit: cover;
  max-height: 400px;
}

/* Right Pane (Login Form) */
.right-pane {
  width: 70%; /* ต้องบวกกับ left-pane ให้ได้ 100% (30 + 70 = 100) */
  /* ทำให้ฝั่งขวาโปร่งใส เพื่อให้เห็นพื้นหลังได้เต็มที่ */
  background-color: rgba(16, 24, 32, 0.2);
  backdrop-filter: blur(8px); /* เบลอน้อยลง เพื่อให้พื้นหลังชัดขึ้น */
  -webkit-backdrop-filter: blur(8px);
  padding: 40px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: -10px 0 30px rgba(0,0,0,0.2);
  z-index: 2;
  flex-direction: column; /* ทำให้แน่ใจว่าเป็น column */
}

.login-form-wrapper {
  width: 100%;
  max-width: 400px;
  /* ทำให้ตัวกล่องแบบฟอร์มโปร่งใสกำลังดี และมีเบลอแบบ Glassmorphism */
  background: rgba(16, 24, 32, 0.5); /* ปรับความทึบลงเล็กน้อย */
  backdrop-filter: blur(10px); /* ลดความเบลอลงเพื่อให้เห็นพื้นหลังชัดขึ้น */
  -webkit-backdrop-filter: blur(10px);
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 15px 35px rgba(0,0,0,0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.login-header {
  text-align: left;
  margin-bottom: 30px;
}

.login-header h2 {
  font-size: 2.2rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: #fff;
  text-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.login-header p {
  color: #e2e8f0;
  font-size: 1rem;
}

.alert-message {
  display: flex;
  align-items: center;
  background-color: rgba(255, 107, 107, 0.2);
  color: #ff8787;
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: 8px;
  padding: 12px 15px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.alert-message i {
  margin-right: 10px;
}

.login-form .form-group {
  margin-bottom: 20px;
}

.login-form label {
  display: block;
  font-size: 0.9rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  margin-bottom: 8px;
  font-weight: 500;
}

.login-form input {
  width: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 14px 16px;
  color: #fff;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.login-form input:focus {
  outline: none;
  border-color: var(--primary-color);
  background-color: rgba(0, 0, 0, 0.6);
  box-shadow: 0 0 0 3px rgba(0, 168, 255, 0.3);
}

.form-options {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 25px;
}

.forgot-password {
  color: #e2e8f0;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s ease;
}

.forgot-password:hover {
  color: var(--primary-color);
}

.login-button {
  width: 100%;
  padding: 15px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  border: none;
  border-radius: 10px;
  color: white;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.login-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0, 168, 255, 0.3);
}

.login-button:active {
  transform: translateY(-1px);
}

.login-button.success {
    background: var(--success-color);
    box-shadow: 0 10px 20px rgba(81, 207, 102, 0.2);
}

.register-link {
  text-align: center;
  font-size: 0.95rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  margin-top: 30px;
}

.register-link a {
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.3s ease;
}

.register-link a:hover {
  text-decoration: underline;
}

.login-form-wrapper.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

/* Responsive Design */
@media (max-width: 768px) {
  .split-container {
    flex-direction: column;
  }
  .left-pane, .right-pane {
    width: 100%;
  }
  .left-pane {
    height: 40vh;
    min-height: 250px;
  }
  .right-pane {
    height: 60vh;
    justify-content: flex-start;
    padding-top: 40px;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
  }
  .logo-img-pane {
    max-height: 200px;
  }
}

@media (max-width: 480px) {
    .right-pane {
        padding: 20px;
    }
    .login-form-wrapper {
        max-width: 100%;
    }
}
