@import url('https://fonts.googleapis.com/css2?family=K2D:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800&family=Mitr:wght@200;300;400;500;600;700&family=Nunito:ital,wght@0,200..1000;1,200..1000&display=swap');

body {
    margin: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    font-family: "K2D", sans-serif;
    background: #000;
}

/* Gradient เคลื่อนไหวพื้นหลัง */
.bg-gradient {
    position: absolute;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, #3b19ff, #230f99, #007bff, #1e00ff);
    background-size: 400% 400%;
    z-index: -1;
    animation: moveGradient 12s ease infinite;
}

@keyframes moveGradient {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Capsule + Box รวมกัน */
.capsule-container {
    position: relative;
    width: 290px;
    transition: all 1s ease;
    transform: scale(1);
}

.capsule {
    width: 100%;
    height: 70px;
    background: linear-gradient(90deg, #3b19ff, #230f99);
    border-radius: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 22px;
    letter-spacing: 1px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.25);
    transition: border-radius 0.8s ease, transform 0.8s ease;
}

/* ฟอร์มที่ยื่นออกมาจาก capsule */
.login-box {
    background: white;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    overflow: hidden;
    height: 0;
    transition: all 1s ease;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.login-box.open {
    height: 200px;
    padding: 20px;
}

.login-box input {
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    border-radius: 10px;
    border: 1.5px solid #ccc;
    outline: none;
    font-size: 15px;
}

.login-box button {
    margin-top: 20px;
    width: 100%;
    background: linear-gradient(45deg, #3b19ff, #230f99);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: 0.3s;
}

.login-box button:hover {
    transform: scale(1.05);
}

.login-box h2 {
    font-family: "K2D", sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: #000053;
    border-radius: 12px;
    width: 65%;
    margin-bottom: 0;
    margin-top: 4px;
}

.login-box h3 {
    font-family: "Mitr", sans-serif;
    font-weight: 300;
    font-size: 12px;
    margin-top: 0;
    margin-bottom: 25px;
}

.login-box span {
    font-weight: 500;
}
/* เอฟเฟกต์ตอน capsule เปิด */
.capsule.open {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    transform: translateY(-10px);
}

.login-box input {
    width: 91%;
}
.login-box #otp {
    width: 91%;
    margin-top: 0;
}



#errOTP {
    color: red;
    font-size: 10px;
    margin: 3px !important;
    padding: 0 !important;
}

.verification {
    height: 400px;
}

/* --- CSS สำหรับแอนิเมชันจดหมายที่เพิ่มเข้ามา --- */

.sending-animation-container {
    position: relative;
    width: 100%;
    height: 60px; /* ความสูงพื้นที่ของแอนิเมชัน */
    display: flex;
    justify-content: center;
    align-items: flex-end;
    margin-top: 15px; /* ระยะห่างจากข้อความ h3 */
    overflow: hidden; /* ซ่อนส่วนที่ลอยออกไปนอกกรอบ */
}

.mail-icon-wrapper {
    position: relative;
    width: 40px;
    height: 40px;
    /* แอนิเมชันหลัก: ลอยขึ้นแล้วหายไป วนซ้ำ */
    animation: mailFlyUp 2.5s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

.modern-mail-icon {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 6px rgba(59, 25, 255, 0.3)); /* เงาสีน้ำเงินฟุ้งๆ */
}

/* เส้นเอฟเฟกต์พุ่งขึ้นด้านหลัง */
.mail-trail {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 0;
    background: linear-gradient(to top, transparent, #3b19ff);
    opacity: 0;
    /* แอนิเมชันเส้นพุ่ง: ทำงานพร้อมกับการลอยขึ้น */
    animation: trailEffect 2.5s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}


/* Keyframes สำหรับการเคลื่อนไหว */

@keyframes mailFlyUp {
    0% {
        transform: translateY(20px) scale(0.8);
        opacity: 0;
    }
    20% {
        /* ปรากฏขึ้นที่จุดเริ่มต้น */
        transform: translateY(0px) scale(1);
        opacity: 1;
    }
    40% {
        /* ค้างไว้สักครู่ ขยับขึ้นเล็กน้อย */
        transform: translateY(-5px) scale(1);
        opacity: 1;
    }
    100% {
        /* พุ่งขึ้นไปด้านบน ขยายเล็กน้อย แล้วจางหาย */
        transform: translateY(-80px) scale(1.1);
        opacity: 0;
    }
}

@keyframes trailEffect {
    0%, 30% {
        height: 0;
        opacity: 0;
    }
    50% {
        /* เส้นปรากฏตอนเริ่มพุ่ง */
        height: 30px;
        opacity: 0.8;
        bottom: -10px;
    }
    100% {
        /* เส้นยาวขึ้นตามจดหมายแล้วจางไป */
        height: 60px;
        opacity: 0;
        bottom: 10px;
    }
}