@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@400;500;600;700&display=swap');

/* หน้า loading ก่อนเข้า login — theme เดิม (พื้นหลังรูป + การ์ดกระจกขาว + น้ำเงิน #1a73e8)
   ความยาว animation ผูกกับ --abims-splash-ms ที่ index.php ส่งมา (เท่ากับเวลาก่อน redirect) */

:root {
    --abims-blue: #1a73e8;
    --abims-blue-soft: rgba(26, 115, 232, 0.16);
    --abims-sky: #60a5fa;
    --abims-ink: #0f172a;
    --abims-muted: #64748b;
    --abims-splash-ms: 2500ms;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    font-family: 'Sarabun', sans-serif;
    color: var(--abims-ink);
    background-color: #eef2f7;
    background-image: url('../image/background-login.jpg?v=20260701c');
    background-size: cover;
    background-position: center;
    overflow: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.35);
    z-index: 0;
}

/* แสงฟุ้งสีน้ำเงินลอยช้า ๆ ด้านหลังการ์ด */
.abims-splash-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.55;
    z-index: 0;
    pointer-events: none;
}

.abims-splash-glow--a {
    width: 340px;
    height: 340px;
    top: 12%;
    left: 18%;
    background: rgba(96, 165, 250, 0.55);
    animation: abimsGlowDrift 6s ease-in-out infinite alternate;
}

.abims-splash-glow--b {
    width: 280px;
    height: 280px;
    bottom: 10%;
    right: 16%;
    background: rgba(26, 115, 232, 0.4);
    animation: abimsGlowDrift 7s ease-in-out infinite alternate-reverse;
}

.abims-splash {
    position: relative;
    z-index: 1;
    width: min(100%, 380px);
    padding: 44px 32px 34px;
    text-align: center;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow:
        0 24px 48px rgba(15, 23, 42, 0.12),
        0 0 0 1px rgba(255, 255, 255, 0.6) inset;
    animation: abimsCardIn 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
}

/* โลโก้ + วงแหวนหมุน */
.abims-splash__mark {
    position: relative;
    width: 96px;
    height: 96px;
    margin: 0 auto 18px;
    display: grid;
    place-items: center;
    animation: abimsPop 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.3) 0.1s both;
}

.abims-splash__ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 0deg, var(--abims-sky) 120deg, var(--abims-blue) 220deg, transparent 300deg);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
    animation: abimsSpin 1.4s linear infinite;
}

.abims-splash__ring--outer {
    inset: -10px;
    opacity: 0.35;
    animation-duration: 2.6s;
    animation-direction: reverse;
}

.abims-splash__halo {
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(26, 115, 232, 0.18), rgba(26, 115, 232, 0) 70%);
    animation: abimsPulse 1.6s ease-in-out infinite;
}

.abims-splash__logo {
    position: relative;
    width: 56px;
    height: 56px;
    object-fit: contain;
    filter: drop-shadow(0 6px 14px rgba(26, 115, 232, 0.25));
}

/* ชื่อระบบ ตัวอักษรเด้งขึ้นทีละตัว */
.abims-splash__title {
    margin: 0 0 6px;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    color: var(--abims-blue);
    line-height: 1.2;
}

.abims-splash__title span {
    display: inline-block;
    animation: abimsLetter 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.4) both;
    animation-delay: calc(0.25s + var(--i) * 0.07s);
}

.abims-splash__sub {
    margin: 0 0 26px;
    font-size: 0.88rem;
    color: var(--abims-muted);
    line-height: 1.45;
    animation: abimsFadeUp 0.5s ease-out 0.6s both;
}

/* แถบความคืบหน้า วิ่งเต็มพอดีเวลาก่อน redirect */
.abims-splash__bar {
    position: relative;
    height: 6px;
    margin: 0 8px 16px;
    border-radius: 999px;
    background: var(--abims-blue-soft);
    overflow: hidden;
    animation: abimsFadeUp 0.4s ease-out 0.5s both;
}

.abims-splash__bar-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--abims-sky), var(--abims-blue));
    transform-origin: left center;
    animation: abimsFill calc(var(--abims-splash-ms) - 0.5s) cubic-bezier(0.45, 0.05, 0.25, 1) 0.5s both;
}

.abims-splash__bar-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
    transform: translateX(-100%);
    animation: abimsShimmer 1.1s ease-in-out infinite;
}

.abims-splash__hint {
    margin: 0;
    font-size: 0.8rem;
    color: #94a3b8;
    animation: abimsFadeUp 0.5s ease-out 0.75s both;
}

.abims-splash__dots span {
    display: inline-block;
    animation: abimsDot 1.2s ease-in-out infinite;
}

.abims-splash__dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.abims-splash__dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes abimsCardIn {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes abimsPop {
    from {
        opacity: 0;
        transform: scale(0.6);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes abimsSpin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes abimsPulse {
    0%,
    100% {
        transform: scale(0.9);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.15);
        opacity: 1;
    }
}

@keyframes abimsLetter {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes abimsFadeUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes abimsFill {
    from {
        transform: scaleX(0);
    }
    to {
        transform: scaleX(1);
    }
}

@keyframes abimsShimmer {
    to {
        transform: translateX(100%);
    }
}

@keyframes abimsDot {
    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

@keyframes abimsGlowDrift {
    to {
        transform: translate(40px, -30px) scale(1.12);
    }
}

@media (max-width: 480px) {
    .abims-splash {
        padding: 36px 24px 28px;
        border-radius: 24px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .abims-splash,
    .abims-splash *,
    .abims-splash-glow {
        animation: none !important;
    }

    .abims-splash__ring {
        opacity: 0.5;
    }
}
