/* การตั้งค่าพื้นฐาน */
body { 
    background-color: #f8f9fa; /* เปลี่ยนเป็นสีเทาอ่อนเพื่อให้ Card สีขาวดูเด่นขึ้น */
    min-height: 100vh; 
    display: flex; 
    flex-direction: column; 
    overflow-x: hidden;
}

.navbar { 
    background-color: #fff; 
    border-bottom: 1px solid #eee; 
    padding: 10px 30px; 
    z-index: 1050; /* ให้อยู่เหนือ sidebar */
}

/* ตั้งค่า Sidebar */
.sidebar {
    width: 280px; /* ขยายความกว้างอีกนิดเพื่อให้ดูไม่อึดอัด */
    height: calc(100vh - 65px); /* ความสูงหักจาก Navbar */
    background-color: #fff;
    position: sticky;
    top: 65px;
    border-right: 1px solid #e0e0e0;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.03);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* ให้ Smooth ขึ้น */
    overflow: hidden;
    flex-shrink: 0; /* ป้องกัน Sidebar โดนบีบ */
}

/* สถานะเมื่อถูกปิด (Collapsed) */
.sidebar.collapsed {
    width: 0;
    padding: 0 !important;
    margin: 0 !important;
    border-right: none;
}

/* ตกแต่ง Link ในเมนู */
.sidebar .nav-link {
    color: #707070;
    border-radius: 10px;
    transition: all 0.2s ease;
    font-weight: 500;
    margin: 2px 0;
}

.sidebar .nav-link:hover {
    background-color: #f6f6f6;
    color: #333;
    transform: translateX(5px);
}

/* เมนูที่กำลังใช้งาน (Active) */
.sidebar .nav-link.active {
    background-color: #695CFE;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(105, 92, 254, 0.3);
}

/* ปุ่มออกจากระบบ */
.sidebar .nav-link.logout-btn {
    color: #dc3545 !important;
    font-weight: 600;
}

.sidebar .nav-link.logout-btn:hover {
    background-color: #fff5f5 !important;
    color: #c82333 !important;
}

/* ปรับส่วนเนื้อหาหลัก (Main Content) */
.flex-grow-1 {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 0; /* สำคัญ: เพื่อให้เนื้อหาภายในไม่ดันความกว้างจอ */
    background-color: #f8f9fa;
}

/* ปุ่ม Toggle ใน Navbar */
#toggle-btn {
    border: none;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 8px;
    margin-right: 15px;
    color: #695CFE;
    transition: 0.2s;
}

#toggle-btn:hover {
    background: #eee;
}

/* จัดการความกว้างของรูปโปรไฟล์ */
.sidebar img {
    transition: 0.3s;
}

/* รองรับหน้าจอมือถือ */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        height: 100%;
    }
    .sidebar.collapsed {
        transform: translateX(-100%);
    }
}

.btn-toggle-3d {
    /* สีน้ำเงินหลัก */
    background-color: #0d6efd !important; 
    color: white !important;
    
    border: none;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 1.6rem;
    cursor: pointer;
    transition: all 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* เงา 3D: ชั้นล่างสุดคือส่วนนูน (Darker Blue) และตามด้วยเงาฟุ้ง (Shadow) */
    box-shadow: 0 4px 12px rgba(105, 92, 254, 0.3);
    position: relative;
    top: -4px; /* ดึงขึ้นเพื่อให้เห็นส่วนนูนด้านล่าง */
}

.btn-toggle-3d:hover {
    background-color: #1a75ff !important;
    top: -5px;
    box-shadow: 0 6px 0 #0046b3, 0 10px 20px rgba(0, 0, 0, 0.25);
}

.btn-toggle-3d:active {
    top: 1px; /* ยุบลงเมื่อกดจริง */
    box-shadow: 0 1px 0 #0046b3, 0 2px 5px rgba(0, 0, 0, 0.1);
}

.card-form { background: #fff; border-radius: 15px; border: none; box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075); }
.form-section-title { color: #0d6efd; font-weight: bold; font-size: 1.1rem; margin-bottom: 5px; }
.form-section-icon { font-size: 1.2rem; margin-right: 8px; color: #0d6efd; }
.section-divider { border-bottom: 1px solid #eef2f7; margin: 2.5rem 0; }
.form-label { font-weight: 600; font-size: 0.85rem; color: #495057; margin-bottom: 0.5rem; }
.form-control, .form-select { border: 1px solid #dee2e6; padding: 0.6rem 0.75rem; border-radius: 8px; font-size: 0.9rem; }
.form-control:focus { border-color: #0d6efd; box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.1); }
.bg-light-input { background-color: #f8f9fa !important; }
.input-group-text { background-color: #f8f9fa; border-right: none; color: #6c757d; }
.input-group > .form-control { border-left: none; }

.readonly-display { background-color: #f8fafc; border: 1px solid #e2e8f0; padding: 0.6rem 0.75rem; border-radius: 8px; font-size: 0.9rem; color: #475569; min-height: 42px; display: flex; align-items: center; }
    .age-display { font-size: 0.85rem; color: #0d6efd; font-weight: 600; margin-top: 5px; display: block; }

.step-wrapper {
        display: flex;
        justify-content: space-between;
        position: relative;
        margin-bottom: 3rem;
    }
    .step-item {
        text-align: center;
        flex: 1;
        position: relative;
        z-index: 1;
    }
    .step-item::before {
        content: "";
        position: absolute;
        top: 20px;
        left: -50%;
        width: 100%;
        height: 2px;
        background: #e0e0e0;
        z-index: -1;
    }
    .step-item:first-child::before { content: none; }
    
    .step-icon {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: #fff;
        border: 2px solid #e0e0e0;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0 auto 10px;
        font-weight: bold;
        color: #9e9e9e;
        transition: all 0.3s ease;
    }
    
    /* Active & Completed State */
    .step-item.active .step-icon {
        background: #0d6efd;
        border-color: #0d6efd;
        color: #fff;
        box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.2);
    }
    .step-item.active .step-text { color: #0d6efd; font-weight: bold; }
    
    .step-item.completed .step-icon {
        background: #198754;
        border-color: #198754;
        color: #fff;
    }
    .step-item.completed .step-text { color: #198754; }
    .step-item.completed::before { background: #198754; }
    
    .step-text { font-size: 0.85rem; color: #6c757d; }

    /* Timeline Custom Style */
        .timeline-container { position: relative; padding-left: 20px; }
        
        .timeline-item {
            position: relative;
            padding-bottom: 30px;
            display: flex;
            align-items: flex-start;
        }

        /* เส้นเชื่อมแนวตั้ง */
        .timeline-item::before {
            content: "";
            position: absolute;
            left: 16px;
            top: 35px;
            bottom: 0;
            width: 2px;
            background-color: #e9ecef;
            z-index: 1;
        }
        .timeline-item:last-child::before { display: none; }

        /* วงกลมตัวเลข */
        .timeline-number {
            width: 34px;
            height: 34px;
            background-color: #fff;
            border: 2px solid;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            font-size: 14px;
            z-index: 2;
            flex-shrink: 0;
            transition: all 0.3s ease;
        }

        /* สถานะที่ดำเนินการแล้ว (สีฟ้า) */
        .status-completed .timeline-number {
            background-color: #0d6efd;
            color: #fff;
        }

        /* เนื้อหา */
        .timeline-content {
            margin-left: 20px;
            width: 100%;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .step-title { font-size: 1rem; font-weight: 600; color: #333; margin-bottom: 2px; }
        .step-status { font-size: 0.85rem; color: #6c757d; }
        .step-date { font-size: 0.9rem; font-weight: 600; color: #495057; }
        
        /* จัดการเรื่องสถานะตัวอักษรสีฟ้า */
        

        /* สถานะที่ยังไม่เริ่ม (สีเทา) */
        .status-locked .timeline-number {
            background-color: #f8f9fa;
            border: 2px solid #dee2e6;
            color: #adb5bd;
        }
        .status-locked .step-title { color: #adb5bd; }
        .status-locked .timeline-item::before { background-color: #f1f3f5; }

        /* สถานะกำลังดำเนินการ (นาฬิกาทราย - สีส้มหรือสีเหลือง) */
        .status-pending .timeline-number {
            background-color: #fff3cd;
            border: 2px solid #ffc107;
            color: #856404;
        }
        .status-pending .timeline-number i {
            animation: rotate-hourglass 2s infinite;
        }

        /* สถานะดำเนินการแล้ว (สีเขียว/ฟ้า ตามที่คุณชอบ - ในที่นี้ขอปรับเป็นสีเขียวเพื่อให้ดูสำเร็จ) */
        .status-completed .timeline-number {
            background-color: #198754; /* เปลี่ยนเป็นสีเขียว success */
            border: 2px solid #198754;
            color: #fff;
        }
        .status-completed .timeline-item::before { background-color: #198754; }

        /* Animation สำหรับนาฬิกาทราย */
        @keyframes rotate-hourglass {
            0% { transform: rotate(0deg); }
            50% { transform: rotate(180deg); }
            100% { transform: rotate(180deg); }
        }

        /* ปรับระยะห่างไอคอนเล็กน้อย */
        .timeline-number i {
            font-size: 1.1rem;
            line-height: 0;
        }