/* =========================================================
   loading.css — หน้าจอระหว่างโหลดครั้งแรก (อยู่ใน index.html)
   โลโก้ → SMART METER → ศูนย์ธุรกิจไลฟ์สไตล์ OASYS → แถบโหลด
   แถบโหลดกว้างเท่ากับบรรทัดที่ยาวที่สุดของชื่อพอดี
   ========================================================= */

.app-loading {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--c-sidebar);
    color: #fff;
}

/* กล่องกว้างเท่าเนื้อหาข้างใน (ไม่เต็มจอ) แถบโหลดจึงยาวเท่าชื่อพอดี */
.app-loading-brand {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    font-family: var(--font-head);
    text-align: center;
}

.app-loading-logo {
    width: 116px;
    height: 92px;
    object-fit: contain;
    margin-bottom: 14px;
}

.app-loading-title {
    font-size: 30px;
    font-weight: 500;
    letter-spacing: .4px;
    line-height: 1.2;
    white-space: nowrap;
}

.app-loading-sub {
    font-size: 16px;
    opacity: .9;
    white-space: nowrap;
}

/* ---------- แถบโหลดแบบเส้น: ช่วงสีวิ่งจากซ้ายไปขวาวนไปเรื่อยๆ ---------- */
.app-loading-bar {
    position: relative;
    align-self: stretch;          /* ยืดให้กว้างเท่าข้อความที่ยาวที่สุด */
    height: 4px;
    margin-top: 18px;
    overflow: hidden;
    border-radius: 2px;
    background: rgba(255, 255, 255, .15);
}

.app-loading-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 40%;
    height: 100%;
    border-radius: 2px;
    background: var(--c-pill);
    box-shadow: 0 0 8px rgba(76, 175, 80, .6);
    animation: app-loading-slide 1.6s ease-in-out infinite;
}

@keyframes app-loading-slide {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(250%); }
}

/* ผู้ใช้ที่ตั้งค่าลดการเคลื่อนไหว: เปลี่ยนเป็นกระพริบช้าๆ แทนการวิ่ง */
@media (prefers-reduced-motion: reduce) {
    .app-loading-bar::after {
        width: 100%;
        animation: app-loading-pulse 2s ease-in-out infinite;
    }

    @keyframes app-loading-pulse {
        0%, 100% { opacity: .35; }
        50%      { opacity: 1; }
    }
}

/* จอเล็ก */
@media (max-width: 700px) {
    .app-loading-logo { width: 88px; height: 70px; }
    .app-loading-title { font-size: 24px; }
    .app-loading-sub { font-size: 14px; }
}
