/* ==========================================================
   GLOBAL LOADING OVERLAY - ULTRA GLASSMORPHISM THEME
   ========================================================== */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700;800&family=Prompt:wght@300;400;500;600;700;800&display=swap');

:root {
    --brand: #FF8C00;
    --brand-dark: #4A0C46;
    --brand-gradient: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    --loader-font: 'Kanit', 'Prompt', sans-serif;
}

/* 1. ฉากหลังโปร่งแสงบางเบา มองเห็นเนื้อหาเว็บด้านหลังชัดเจน */
.loading-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.12) !important; /* ลดความมืดลงเหลือเพียง 12% เพื่อความเคลียร์ใส */
    backdrop-filter: blur(5px) saturate(120%) !important; /* ปรับลด Blur ให้ฉากหลังคมชัดขึ้น */
    -webkit-backdrop-filter: blur(5px) saturate(120%) !important;
    z-index: 999999 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: all !important;
    user-select: none;
    font-family: var(--loader-font) !important;
}

.loading-overlay.d-none {
    display: none !important;
}

/* 2. กล่องการ์ดกระจก (ทึบขึ้นชัดเจน + ขอบสะท้อนแสงทองส้มพรีเมียม) */
.loading-center-card {
    position: relative;
    /* เพิ่มความทึบของเนื้อขาวขุ่นเป็น 68% - 50% ให้ตัดกับพื้นหลังชัดเจน ไม่กลืนหาย */
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.68) 0%, rgba(255, 248, 240, 0.50) 100%) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    
    /* เส้นขอบสีขาวผสมเหลือบทองส้ม สะท้อนแสงชัดเจน */
    border: 1.5px solid rgba(255, 255, 255, 0.85) !important;
    border-radius: 26px 8px 26px 8px !important;
    padding: 2rem 2.8rem !important;
    min-width: 245px;
    
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    
    /* มิติแสงสะท้อนทองส้มรอบกรอบ (Golden-Orange Rim Glow) + เงาลอย */
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12),
                0 0 0 1px rgba(255, 165, 0, 0.35),
                0 0 24px rgba(255, 140, 0, 0.22) !important;
    animation: loader-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes loader-pop {
    0% { transform: scale(0.85); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* 3. กล่อง Spinner ควบคุมตำแหน่งไอคอน */
.loading-spinner-wrapper {
    position: relative;
    width: 68px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

/* วงแหวนสีส้ม-ม่วง */
.glass-spinner {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 4px solid rgba(255, 140, 0, 0.15) !important;
    border-top: 4px solid #FF8C00 !important;
    border-right: 4px solid #4A0C46 !important;
    animation: spin-loop 0.85s cubic-bezier(0.5, 0.15, 0.5, 0.85) infinite;
}

@keyframes spin-loop {
    to { transform: rotate(360deg); }
}

/* ไอคอนตรงกลางวงแหวน */
.spinner-center-icon {
    font-size: 1.6rem !important;
    background: linear-gradient(135deg, #FF8C00 0%, #4A0C46 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    animation: icon-pulse 2s ease-in-out infinite;
}

@keyframes icon-pulse {
    0%, 100% { transform: scale(0.96); opacity: 0.9; }
    50% { transform: scale(1.08); opacity: 1; }
}

/* 4. ปรับขนาดและน้ำหนักฟอนต์ชื่อแบรนด์ */
.text-logo-zone {
    text-align: center;
    font-family: var(--loader-font) !important;
}

.logo-main-text {
    font-family: var(--loader-font) !important;
    font-weight: 800 !important;
    font-size: 1.15rem !important;
    letter-spacing: 0.5px;
    background: linear-gradient(90deg, #FF8C00 0%, #4A0C46 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    line-height: 1.2;
}

.logo-sub-text {
    font-family: var(--loader-font) !important;
    font-size: 0.72rem !important;
    color: #888888 !important;
    font-weight: 500 !important;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* 5. ข้อความสถานะด้านล่าง */
.loading-status-text {
    font-family: var(--loader-font) !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    color: #444444 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.2px;
}

.animated-dots::after {
    content: '';
    display: inline-block;
    animation: dots-step 1.5s infinite steps(4, end);
    width: 14px;
    text-align: left;
}

@keyframes dots-step {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}