/* ======================================================
   CUSTOM STYLES & MOBILE LOCK (HLAKYAW FAST v3.0)
   ====================================================== */

/* ล็อคหน้าจอให้แนบสนิทกับขอบจอมือถือทุกทิศทาง */
html, body {
    height: 100%;
    height: 100dvh;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #020617;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

/* ซ่อน Scrollbar ให้ดูเรียบหรูเหมือน Native App */
::-webkit-scrollbar {
    display: none;
    width: 0px;
    height: 0px;
}
* {
    scrollbar-width: none;
    -ms-overflow-style: none;
    box-sizing: border-box;
}

/* แบ็คกราวด์ภาพวิวภูเขาสุดพรีเมียม เต็มจอ ไร้รอยต่อ */
.app-background {
    background-image: 
        linear-gradient(to bottom, rgba(7, 18, 38, 0.88) 0%, rgba(5, 14, 30, 0.72) 45%, rgba(4, 11, 24, 0.96) 100%), 
        url('https://images.unsplash.com/photo-1506744038136-46273834b3fb?auto=format&fit=crop&w=1000&q=80');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    height: 100%;
    height: 100dvh;
}

/* 1. ส่วนหัว: เว้นระยะใต้กล้องหน้า / Dynamic Island ให้พอดี */
.header-safe-area {
    padding-top: calc(env(safe-area-inset-top, 24px) + 0.65rem);
}

/* 2. สไตล์แถบนำทางด้านบน (Top Segmented Navigation) สไตล์พรีเมียม */
.top-nav-tab {
    color: #94a3b8;
    background: transparent;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.top-nav-tab:hover {
    color: #ffffff;
}
.top-nav-tab.active {
    color: #020617 !important;
    background: linear-gradient(to right, #2dd4bf, #22d3ee, #34d399) !important;
    box-shadow: 0 0 14px rgba(6, 182, 212, 0.45);
}

/* 3. ส่วนเนื้อหาตรงกลาง (ด้านล่างโล่งสบายตา 100% ไร้แถบล่างกวนใจ) */
.content-container {
    padding-bottom: max(env(safe-area-inset-bottom, 20px), 20px) !important;
}

/* 4. จัดการ Tab Content */
.tab-content {
    display: none;
}
.tab-content.active {
    display: flex;
}

/* 5. วงแหวน Progress SVG */
.progress-ring-circle {
    transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

/* ซ่อนหัวมนของเส้นวงกลมตอนยังไม่เริ่ม Fast */
.progress-ring-circle[stroke-dashoffset="722"] {
    opacity: 0;
}

/* 6. จุดเดินเวลา (Progress Dot) ป้องกันการวิ่งข้ามจอ */
#progress-dot {
    display: none;
    transition: transform 0.25s ease-out;
    will-change: transform;
}

/* ดึงการ์ดเวลา เริ่ม-จบ ขึ้นมาชิดขอบล่างของวงเวลาพอดี */
#tab-fast > div[onclick="openEditTimeModal()"] {
    margin-top: -0.65rem !important;
}

/* แสงเรืองแสงสีฟ้า Cyan */
.cyan-glow {
    filter: drop-shadow(0 0 12px rgba(6, 182, 212, 0.65));
}

.box-glow {
    box-shadow: 0 0 25px rgba(6, 182, 212, 0.35);
}

/* สไตล์ปุ่มหลัก */
.btn-primary {
    background: linear-gradient(to right, #2dd4bf, #22d3ee, #34d399);
    color: #020617;
    font-weight: 800;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    cursor: pointer;
}
.btn-primary:active {
    transform: scale(0.97);
    opacity: 0.95;
}

/* สไตล์ Popover เมนูเลือกแผน Fasting */
#plan-dropdown {
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.8), 0 0 15px rgba(6, 182, 212, 0.25);
    border: 1px solid rgba(6, 182, 212, 0.4);
}

/* สไตล์ Input ภายในฟอร์ม */
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    background-color: rgba(30, 41, 59, 0.85);
    border: 1px solid #334155;
    color: #ffffff;
    outline: none;
    text-align: center;
    transition: all 0.2s ease;
}
.form-input:focus {
    border-color: #22d3ee;
    box-shadow: 0 0 0 1px #22d3ee;
}

/* ปรับแต่ง Datetime Picker ให้เป็น Dark Mode เข้ากับธีม */
input[type="datetime-local"] {
    color-scheme: dark;
}

/* ซ่อนลูกศรใน Number Input ให้สะอาดตา */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    margin: 0; 
}
input[type=number] {
    -moz-appearance: textfield;
}

/* ลูกศรคลี่ประวัติแดชบอร์ด */
.open-arrow {
    transform: rotate(180deg);
}

/* Animation เรียบหรู */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}
.animate-fade-in {
    animation: fadeIn 0.2s ease-out forwards;
}
