/* ===============================
   Login Page
   =============================== */

html, body {
    height: 100%;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    font-family: 'Segoe UI', Tahoma, sans-serif;
}

/* Center box */
.login-box {
    width: 380px;
    margin: 7% auto;
}

/* ===== Logo ===== */
.login-logo {
    text-align: center;
    margin-bottom: 25px;
    opacity: 0;
    animation: logoFade 0.8s ease forwards;
}

/* ❌ ไม่ animate logo ถ้ามี error */
.has-error .login-logo {
    animation: none;
    opacity: 1;
}

.logo-img {
    max-width: 140px;
    height: auto;
    filter: drop-shadow(0 6px 14px rgba(0,0,0,.25));
}

/* Logo fade animation */
@keyframes logoFade {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card */
.card {
    border-radius: 14px;
    border: none;
    box-shadow: 0 20px 40px rgba(0,0,0,.25);
    animation: fadeSlide 0.6s ease;
}

.has-error .card {
    animation: none;
}

@keyframes fadeSlide {
    from {
        opacity: 0;
        transform: translateY(25px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card body */
.login-card-body {
    padding: 30px 25px;
    border-radius: 14px;
}

.login-box-msg {
    color: #555;
    font-size: 15px;
    margin-bottom: 25px;
}

/* Inputs */
.form-control {
    border-radius: 8px;
    height: 45px;
    border: 1px solid #ddd;
    transition: all .2s ease;
}

.form-control:focus {
    border-color: #2a5298;
    box-shadow: 0 0 0 0.15rem rgba(42,82,152,.25);
}

/* Input group icon */
.input-group-text {
    background: #f4f6f9;
    border-radius: 0 8px 8px 0;
    border: 1px solid #ddd;
    color: #666;
}

/* Remember me */
.icheck-primary label {
    font-size: 14px;
    color: #555;
}

/* Login button */
#login-btn {
    border-radius: 8px;
    font-weight: 600;
    height: 45px;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    border: none;
    transition: all .25s ease;
}

#login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(42,82,152,.4);
}

#login-btn:disabled {
    opacity: 0.8;
    cursor: not-allowed;
}

/* Spinner */
#btn-spinner {
    margin-left: 5px;
}

/* Error alert */
.alert {
    border-radius: 8px;
    font-size: 14px;
}

/* Back button */
.text-center a.btn {
    border-radius: 20px;
    padding: 6px 18px;
}

/* Responsive */
@media (max-width: 480px) {
    .login-box {
        width: 90%;
        margin-top: 20%;
    }
}

.shake {
    animation: shake 0.4s;
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-4px); }
    100% { transform: translateX(0); }
}

.toggle-password {
    background: #f4f6f9;
    transition: transform 0.35s ease, color 0.25s ease;
}

.toggle-password:hover {
    background: #e9ecef;
}

.toggle-password.rotate i {
    transform: rotate(180deg) scale(1.05);
}

.toggle-password i.fa-eye-slash {
    color: #2a5298;
}

/* Soft shake animation */
.shake-soft {
    animation: shakeSoft 0.35s ease-in-out;
}

@keyframes shakeSoft {
    0%   { transform: translateX(0); }
    20%  { transform: translateX(-4px); }
    40%  { transform: translateX(4px); }
    60%  { transform: translateX(-3px); }
    80%  { transform: translateX(3px); }
    100% { transform: translateX(0); }
}

/* ===== Bubble background ===== */
.bubble-bg {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: 0;
}

.bubble-bg span {
    position: absolute;
    bottom: -120px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    animation: bubbleFloat 18s linear infinite;
    filter: blur(1px);
}

/* Random size & position */
.bubble-bg span:nth-child(1) {
    width: 40px; height: 40px;
    left: 10%;
    animation-duration: 16s;
}
.bubble-bg span:nth-child(2) {
    width: 65px; height: 65px;
    left: 20%;
    animation-duration: 22s;
}
.bubble-bg span:nth-child(3) {
    width: 25px; height: 25px;
    left: 35%;
    animation-duration: 14s;
}
.bubble-bg span:nth-child(4) {
    width: 80px; height: 80px;
    left: 50%;
    animation-duration: 26s;
}
.bubble-bg span:nth-child(5) {
    width: 30px; height: 30px;
    left: 65%;
    animation-duration: 18s;
}
.bubble-bg span:nth-child(6) {
    width: 55px; height: 55px;
    left: 75%;
    animation-duration: 24s;
}
.bubble-bg span:nth-child(7) {
    width: 20px; height: 20px;
    left: 85%;
    animation-duration: 13s;
}
.bubble-bg span:nth-child(8) {
    width: 70px; height: 70px;
    left: 90%;
    animation-duration: 28s;
}
.bubble-bg span:nth-child(9) {
    width: 35px; height: 35px;
    left: 45%;
    animation-duration: 17s;
}
.bubble-bg span:nth-child(10) {
    width: 50px; height: 50px;
    left: 5%;
    animation-duration: 20s;
}

/* Floating animation */
@keyframes bubbleFloat {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-110vh) translateX(20px);
        opacity: 0;
    }
}

.login-wrapper {
    position: relative;
    z-index: 1;
}
