/* =========================================
   login.css - อัปเดตดีไซน์ใหม่สไตล์ IoT
   ========================================= */
body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Kanit', sans-serif;
    background: linear-gradient(135deg, #ff7e00, #ff4500); /* พื้นหลังสีส้มไล่ระดับ */
    /* ถ้ามีรูปลายจุดพื้นหลัง สามารถใส่เป็น background-image ได้ที่นี่ */
}

/* ตัวคลุมเพื่อให้ทุกอย่างอยู่ตรงกลางจอ */
.login-page-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}

/* กล่องหลักของหน้า Login */
.login-container {
    display: flex;
    flex-direction: row;
    width: 100%;
    max-width: 850px;
    background: transparent;
    border-radius: 25px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3); /* เงาฟุ้งๆ */
    overflow: hidden; /* ไม่ให้เนื้อหาทะลุขอบโค้ง */
}

/* --- ฝั่งซ้าย (สีส้มเข้ม โลโก้) --- */
.login-logo-section {
    flex: 1;
    background: #ce5a13; /* สีส้มเข้ม/น้ำตาล ตามภาพ */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 50px;
    position: relative;
    box-shadow: 5px 0 15px rgba(0,0,0,0.1); /* สร้างมิติทับฝั่งขวานิดๆ */
    z-index: 2;
}

.kmitl-logo {
    max-width: 250px;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 5px 10px rgba(0,0,0,0.2)); /* เพิ่มเงาให้โลโก้เด่น */
}

/* --- ฝั่งขวา (ฟอร์มสีส้มสว่าง) --- */
.login-form-section {
    flex: 1.2;
    background: linear-gradient(to bottom right, #ff9f43, #ff7b15);
    padding: 60px 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    position: relative;
    z-index: 1;
}

.login-form-section h2 {
    color: #ffffff;
    font-size: 1.6rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 40px;
    line-height: 1.4;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ข้อความแจ้งเตือน Error */
.error-msg {
    background: rgba(255, 255, 255, 0.2);
    color: #ffeaea;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    border: 1px solid rgba(255,0,0,0.3);
}

/* --- ช่องกรอกข้อมูล (Input) พร้อมลูกเล่น Floating Label --- */
.input-group {
    position: relative;
    margin-bottom: 20px;
    width: 100%;
    text-align: left; /* ให้ตัวหนังสือชิดซ้าย */
}

.login-form-section input[type="text"],
.login-form-section input[type="password"] {
    width: 100%;
    /* ปรับ padding ให้ด้านบนกว้างขึ้น เพื่อเผื่อที่ให้ label ลอยขึ้นไป */
    padding: 24px 25px 8px 25px; 
    border: none;
    border-radius: 50px; /* ทรงแคปซูล */
    background: rgba(255, 255, 255, 0.45); 
    color: #333;
    font-size: 1.05rem;
    font-family: 'Kanit', sans-serif;
    box-sizing: border-box;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
}

.login-form-section input:focus {
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* 🔴 สไตล์ของตัวหนังสือที่วางซ้อนทับ (Label) */
.input-group label {
    position: absolute;
    top: 50%;
    left: 25px; /* ให้ตรงกับ padding ของ input */
    transform: translateY(-50%);
    color: rgba(0, 0, 0, 0.5);
    font-weight: 500;
    font-size: 1.05rem;
    pointer-events: none; /* เพื่อให้คลิกทะลุตัวหนังสือไปโดนช่องกรอกได้เลย */
    transition: all 0.3s ease;
    font-family: 'Kanit', sans-serif;
}

/* 🔴 แอนิเมชันตอนคลิก (focus) หรือตอนพิมพ์เสร็จแล้ว (valid) ให้ตัวหนังสือลอยขึ้นและเล็กลง */
.login-form-section input:focus ~ label,
.login-form-section input:valid ~ label {
    top: 15px; /* เลื่อนขึ้นไปอยู่ขอบบน */
    font-size: 0.8rem; /* หดตัวหนังสือให้เล็กลง */
    color: #c82333; /* เปลี่ยนสีนิดหน่อยให้ดูรู้ว่ากำลังพิมพ์ */
    font-weight: 600;
}

/* --- ปุ่มกด (Button) --- */
.btn-login {
    width: 100%;
    padding: 16px;
    margin-top: 10px;
    border: none;
    border-radius: 50px; /* ทรงแคปซูล */
    background: #dc3545; /* สีแดงเข้มแบบในภาพ */
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'Kanit', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 15px rgba(220, 53, 69, 0.4);
}

.btn-login:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(220, 53, 69, 0.5);
}

/* --- ส่วน Gallery Auto-Slider ใหม่ (เลือนวนไปมา) --- */
.gallery-slider-container {
    width: 100%;
    height: 450px; /* ปรับความสูงได้ตามใจชอบ */
    position: relative;
    margin-top: 40px;
    border-radius: 25px; /* คุมธีมขอบมนเหมือนส่วนอื่น */
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.gallery-slider {
    width: 100%;
    height: 100%;
    position: relative;
}

.gallery-slide {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0; /* ซ่อนรูปไว้ก่อน */
    transition: opacity 1.5s ease-in-out; /* ความเนียนตอนเลือนวน */
    z-index: 1;
}

.gallery-slide.active {
    opacity: 1; /* แสดงรูปที่กำลัง Active */
    z-index: 2;
}

.gallery-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* บังคับรูปเต็มกรอบแบบไม่เสียสัดส่วน */
}

/* ปุ่มแก้ไขสำหรับ Admin ในโหมด Gallery */
.edit-overlay-gallery {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 111, 0, 0.8);
    color: #fff;
    padding: 8px 15px;
    border-radius: 8px;
    text-decoration: none;
    z-index: 10;
    font-size: 14px;
}

/* =========================================
   รองรับมือถือ (Mobile Responsive)
   ========================================= */
@media (max-width: 768px) {
    .login-container {
        flex-direction: column; /* เปลี่ยนจากเรียงซ้ายขวา เป็นเรียงบนลงล่าง */
        max-width: 400px;
    }
    
    .login-logo-section {
        padding: 40px 20px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    }
    
    .kmitl-logo {
        max-width: 180px;
    }
    
    .login-form-section {
        padding: 40px 30px;
    }
    
    .login-form-section h2 {
        font-size: 1.3rem;
        margin-bottom: 30px;
    }
}