/* =========================================
           🌙 ตั้งค่าโหมดมืด (Dark Mode) 
           ========================================= */
        body.dark-mode {
            background-color: #121212; /* สีพื้นหลังเว็บตอนกลางคืน */
            color: #e0e0e0; /* สีตัวอักษรหลัก */
        }
        
        /* เปลี่ยนสีพื้นหลังของกล่องต่างๆ ให้ออกโทนเทาเข้ม */
        body.dark-mode .mini-card,
        body.dark-mode .log-box,
        body.dark-mode .card,
        body.dark-mode header button {
            background-color: #1e1e1e;
            color: #e0e0e0;
            box-shadow: 0 4px 6px rgba(0,0,0,0.5);
        }
        
        /* ปรับสีตัวหนังสือหัวข้อในโหมดมืดให้สว่างขึ้น */
        body.dark-mode .mini-card h3,
        body.dark-mode .log-box h3,
        body.dark-mode #connection-text {
            color: #ffffff;
            border-bottom-color: #333;
        }

        body.dark-mode .mini-card p {
            color: #b0bec5;
        }
        
        /* ปรับเส้นคั่นประวัติและเส้นใต้ส่วน Header */
        body.dark-mode .log-box li {
            color: #b0bec5;
            border-bottom-color: #333;
        }
        
        body.dark-mode header {
            border-bottom-color: #333 !important;
        }
        
        /* ปรับสีปุ่มตั้งค่า (EN/TH, 🌙) ในโหมดมืด */
        body.dark-mode header button {
            background-color: #333;
            color: #fff;
        }

/* ตั้งค่า Font และพื้นหลัง */
body {
    font-family: 'Kanit', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    margin: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #2d3436;
}

.container {
    width: 90%;
    max-width: 450px;
    text-align: center;
}

/* การ์ดหลัก (Main Card) */
.card {
    background: white;
    padding: 40px 30px;
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.5s ease;
    position: relative;
    overflow: hidden;
}

/* ไอคอนและข้อความ */
.icon-wrapper {
    font-size: 80px;
    margin-bottom: 10px;
    transition: transform 0.3s;
}

h1 {
    font-weight: 600;
    margin: 0 0 10px 0;
}

p {
    font-weight: 300;
    color: #636e72;
}

/* ปุ่มต่างๆ */
button {
    font-family: 'Kanit', sans-serif;
    cursor: pointer;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-size: 16px;
    transition: 0.3s;
    width: 100%;
    margin-top: 10px;
}

#connect-btn {
    background-color: #0984e3;
    color: white;
    box-shadow: 0 4px 15px rgba(9, 132, 227, 0.3);
}

#connect-btn:hover {
    background-color: #74b9ff;
}

#reset-btn {
    background-color: #fff;
    color: #d63031;
    border: 2px solid #d63031;
    font-weight: bold;
    margin-top: 20px;
}

#reset-btn:hover {
    background-color: #d63031;
    color: white;
}

/* Map Button */
.map-btn {
    display: inline-block;
    text-decoration: none;
    background: #dfe6e9;
    color: #2d3436;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 400;
}

.map-btn:hover {
    background: #b2bec3;
}

/* สถานะการเชื่อมต่อ (จุดเขียว/แดง) */
.status-indicator {
    width: 10px;
    height: 10px;
    background-color: #b2bec3;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}

.connected {
    background-color: #00b894;
    box-shadow: 0 0 10px #00b894;
}

/* 🚨 โหมดแจ้งเตือน (FALL) */
.alert-mode {
    background-color: #d63031 !important;
    /* พื้นหลังแดง */
    color: white !important;
    animation: pulse-red 1s infinite;
}

.alert-mode h1,
.alert-mode p,
.alert-mode span {
    color: white !important;
}

.alert-mode .icon-wrapper {
    animation: shake 0.5s infinite;
}

.alert-mode .map-btn {
    color: #d63031;
    background: white;
}

/* Utility Classes */
.hidden {
    display: none;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 5px;
}

/* Animations */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px) rotate(-5deg);
    }

    75% {
        transform: translateX(5px) rotate(5deg);
    }
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(214, 48, 49, 0.7);
    }

    70% {
        box-shadow: 0 0 0 20px rgba(214, 48, 49, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(214, 48, 49, 0);
    }
}