/* =========================================
   1. Sidebar Layout & Colors (Technical Blue)
   ========================================= */
.sidebar {
    /* --- Layout: คงเดิม --- */
    width: 250px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;

    /* --- Design: Technical Blue Theme --- */
    /* สีกรมท่าเข้ม (Deep Navy) ให้ความรู้สึก Engineering */
    background-color: #0e2a47 !important;

    /* ถ้าชอบแบบไล่สีเหมือนเหล็ก (Metallic Blue) ให้เปิดบรรทัดนี้: */
    /* background: linear-gradient(180deg, #153e6a 0%, #0e2a47 100%) !important; */

    color: #ffffff;
    padding: 15px;
    border-right: 1px solid #1c3b5e;
    /* เพิ่มเส้นขอบบางๆ ให้ดูมีมิติ */
}

/* ลิงก์เมนูใน Sidebar */
.sidebar a {
    color: #cfd8dc;
    /* สีเทาฟ้าอ่อน (อ่านง่ายบนพื้นน้ำเงิน) */
    text-decoration: none;
    display: block;
    padding: 10px 15px;
    margin-bottom: 5px;
    border-radius: 4px;
    /* มุมมนน้อยลง ให้ดูแข็งแรงแบบ Engineer */
    transition: all 0.2s ease-in-out;
    border-left: 3px solid transparent;
    /* เตรียมเส้นขอบซ้ายไว้สำหรับ Hover */
}

/* Hover Effect */
.sidebar a:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border-left: 3px solid #60a5fa;
    /* มีแถบสีฟ้าขึ้นด้านซ้ายตอนชี้ */
}

/* Active State (เมนูที่เลือกอยู่) */
.sidebar a.active {
    background-color: #1565c0;
    /* สีน้ำเงินสด (Engineer Blue) */
    color: #ffffff;
    font-weight: 600;
    border-left: 3px solid #60a5fa;
    /* แถบซ้ายสว่างขึ้น */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

/* =========================================
   2. Main Content Area
   ========================================= */
.content {
    margin-left: 250px;
    padding: 20px;
    width: calc(100% - 250px);
    min-height: 100vh;
    background-color: #f4f6f9;
    /* พื้นหลังเนื้อหาเป็นสีเทาอ่อนจางๆ (สบายตา) */
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .content {
        margin-left: 0;
        width: 100%;
    }
}

/* =========================================
   3. Sidebar Dropdown Styles (Technical Blue)
   ========================================= */
.sidebar .dropdown-menu {
    position: static !important;
    float: none !important;
    transform: none !important;

    /* พื้นหลัง Dropdown: สีน้ำเงินที่เข้มจนเกือบดำ (Midnight Blue) */
    background-color: #081a2f;
    margin-top: 5px;
    margin-bottom: 5px;
    border: none;
    border-radius: 4px;
    padding: 5px 0;
}

/* รายการใน Dropdown */
.sidebar .dropdown-item {
    color: #90a4ae;
    /* สีเทาอมฟ้า */
    padding-left: 30px;
    /* ย่อหน้า */
    font-size: 0.95em;
}

.sidebar .dropdown-item:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar .dropdown-item.active {
    color: #ffffff;
    background-color: transparent;
    /* ไม่ถมสีพื้นหลังใน Dropdown */
    color: #60a5fa;
    /* เปลี่ยนแค่สีตัวอักษรเป็นฟ้าสว่าง */
    font-weight: bold;
}

/* ปรับปุ่ม Index (Dropdown Toggle) */
.sidebar .dropdown-toggle {
    width: 100%;
    text-align: left;
    padding: 10px 15px;
    color: #cfd8dc;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar .dropdown-toggle:hover,
.sidebar .dropdown-toggle.active {
    background-color: #1565c0;
    color: #fff;
}

.sidebar .dropdown-toggle::after {
    display: none;
}

/* =========================================
   4. Sticky Table Header (Matching Blue)
   ========================================= */
.table-sticky {
    border-collapse: separate;
    border-spacing: 0;
}

.table-sticky thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    /* เปลี่ยนหัวตารางให้เป็นสีเดียวกับ Sidebar เพื่อความคุมโทน */
    background-color: #0e2a47;
    color: #fff;
    border-bottom: 2px solid #60a5fa;
    /* เส้นใต้หัวตารางสีฟ้าสว่าง */
}

.table-sticky tfoot th,
.table-sticky tfoot td {
    position: sticky;
    bottom: 0;
    z-index: 9;
    background-color: #e9ecef;
    font-weight: bold;
    border-top: 2px solid #dee2e6;
}

/* =========================================
   5. Excel-Style Form (Specsheet)
   ========================================= */
.excel-sheet {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
    font-size: 14px;
    /* ขนาดตัวอักษรพอดีๆ */
}

/* เส้นขอบตาราง */
.excel-sheet td,
.excel-sheet th {
    border: 1px solid #c0c0c0;
    /* สีเส้นขอบเทาแบบ Excel */
    padding: 0;
    /* ลบ padding เพื่อให้ input เต็มช่อง */
    vertical-align: middle;
}

/* ช่องหัวข้อ (Label) */
.excel-sheet .label-cell {
    background-color: #e9ecef;
    /* สีเทาอ่อน */
    font-weight: 600;
    color: #333;
    padding: 6px 10px;
    /* มีระยะห่างนิดหน่อย */
    width: 20%;
    /* ความกว้างมาตรฐานของ label */
    white-space: nowrap;
}

/* ช่องหัวข้อ Section ใหญ่ (เช่น Process Conditions) */
.excel-sheet .section-header {
    background-color: #0e2a47;
    /* สีธีม Technical Blue */
    color: #fff;
    font-weight: bold;
    padding: 8px 15px;
    text-transform: uppercase;
    font-size: 15px;
}

/* ช่องกรอกข้อมูล (Input) ให้เหมือน Cell ใน Excel */
.excel-input {
    width: 100%;
    border: none;
    padding: 6px 10px;
    outline: none;
    /* เอาเส้นขอบสีฟ้าออกตอนคลิก */
    background-color: transparent;
    font-family: inherit;
    color: #000;
}

/* ตอนคลิกพิมพ์ ให้มีไฮไลท์นิดหน่อย */
.excel-input:focus {
    background-color: #e8f0fe;
    /* สีฟ้าจางๆ */
    box-shadow: inset 0 0 0 2px #3b82f6;
    /* ขอบในสีฟ้า */
}

/* ช่อง Unit (หน่วย) */
.unit-label {
    color: #666;
    font-size: 0.85em;
    padding-right: 5px;
    text-align: right;
    background-color: #f8f9fa;
}