/* ============================================================
   Global DataTable & Toolbar Styles
   ============================================================ */

/* Toolbar หลัก (left/right sections) */
.data-table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.toolbar-left-section,
.toolbar-right-section {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}
.toolbar-left-section {
    justify-content: flex-start;
}
.toolbar-right-section {
    justify-content: flex-end;
}

/* Length menu & Search box */
.dataTables_length,
.dataTables_filter {
    margin: 0;
}
.dataTables_length label,
.dataTables_filter label {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Wrapper (scroll) */
.data-table-wrapper {
    overflow-x: auto;
    border: 1px solid #cbb2c3;
    border-radius: 8px;
}

/* เส้นคั่นแนวนอนระหว่างแถว */
.data-table-wrapper table tbody tr {
    border-bottom: 1px solid #e2d5df;
}
.data-table-wrapper table tbody tr:last-child {
    border-bottom: none;
}

/* เส้นใต้หัวตาราง */
.data-table-wrapper table thead tr {
    border-bottom: 2px solid #4a0e3a;
}

/* เส้นแนวตั้งระหว่างคอลัมน์ (optional) */
.data-table-wrapper table thead th,
.data-table-wrapper table tbody td {
    border-right: 1px solid #f0e8ed;
}
.data-table-wrapper table thead th:last-child,
.data-table-wrapper table tbody td:last-child {
    border-right: none;
}

/* หัวตาราง */
.data-table-wrapper table thead th {
    background-color: #4a0e3a;
    color: #ffffff;
    font-weight: 600;
    border-bottom: 2px solid #6b2a5a;
}

/* Hover effect ทุกตาราง */
.data-table-wrapper table tbody tr:hover td {
    background-color: #f3e5f0 !important;
}

/* Footer (info + pagination) */
.data-table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

/* Pagination buttons */
.paginate_button {
    padding: 5px 10px;
    border: 1px solid #ccc;
    margin: 0 2px;
    cursor: pointer;
    background: white;
    border-radius: 4px;
    transition: all 0.2s;
}
.paginate_button.current {
    background: #4a0e3a;
    color: white;
    border-color: #4a0e3a;
}
.paginate_button:hover:not(.current) {
    background: #f1f5f9;
}
.paginate_button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Status Flow (ใช้ใน registration_user) */
.status-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    background: transparent;
    padding: 6px 12px 20px 12px;
    max-width: 100%;
}
.status-step {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    padding: 4px 12px 4px 8px;
    border-radius: 40px;
    transition: all 0.2s ease;
    border: 1px solid #e2e8f0;
}
.status-step:hover {
    background: #f1f5f9;
    transform: translateY(-1px);
    border-color: #cbd5e1;
}
.step-number {
    background: linear-gradient(135deg, rgb(82,0,46), rgb(44,0,27));
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.step-text {
    font-size: 12px;
    font-weight: 500;
    color: #1e293b;
    white-space: nowrap;
}
.step-arrow {
    color: #94a3b8;
    font-size: 12px;
    margin: 0 2px;
}

/* Table Action Bar (สำหรับปุ่มที่อยู่เหนือตาราง) */
.table-action-bar {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.table-action-bar.align-left {
    justify-content: flex-start;
}
.table-action-bar.align-right {
    justify-content: flex-end;
}

/* Responsive */
@media (max-width: 768px) {
    .data-table-toolbar {
        flex-direction: row !important;
        justify-content: space-between;
        align-items: center;
        flex-wrap: nowrap;
        gap: 8px;
    }
    .toolbar-left-section,
    .toolbar-right-section {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
    }
    .toolbar-left-section {
        justify-content: flex-start;
    }
    .toolbar-right-section {
        justify-content: flex-end;
    }
    .dataTables_length label,
    .dataTables_filter input {
        font-size: 12px;
        white-space: nowrap;
    }
    .dataTables_length select {
        font-size: 11px;
        padding: 2px 4px;
    }
    .dataTables_filter input {
        width: 100%;
        padding: 4px 8px;
    }

    .data-table-footer {
        flex-direction: column;
        align-items: center;
    }

    .status-flow {
        justify-content: center;
        gap: 6px;
        flex-wrap: wrap;
        padding: 6px 8px 20px 8px;
    }
    .status-step {
        padding: 3px 10px 3px 6px;
    }
    .step-number {
        width: 18px;
        height: 18px;
        font-size: 9px;
    }
    .step-text {
        font-size: 10px;
    }
    .step-arrow {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .data-table-toolbar {
        gap: 4px;
    }
    .dataTables_filter input {
        width: 100%;
    }
}

/* ปรับ select ของ length menu ให้กว้างขึ้นและลูกศรไม่ทับข้อความ */
.dataTables_length select {
    padding-right: 28px !important;   /* เว้นที่ว่างสำหรับลูกศร */
    background-position: right 8px center !important;
    background-size: 14px !important;
    min-width: 75px;                  /* ความกว้างขั้นต่ำ */
    width: auto !important;           /* ไม่ให้ยืดเต็มที่ */
}

/* สำหรับมือถือ เพิ่มความกว้างเล็กน้อย */
@media (max-width: 768px) {
    .dataTables_length select {
        min-width: 50px;              /* กว้างขึ้นเล็กน้อยบนมือถือ */
        padding-right: 30px !important;
        font-size: 12px;              /* ลด font เล็กน้อยเพื่อประหยัดพื้นที่ */
    }
    /* ถ้ายังแคบเกินไป ให้ขยาย full width เฉพาะ select */
    .toolbar-left-section {
        flex-wrap: wrap;
    }

    /* .dataTables_length select {
        width: 100% !important;
        min-width: unset;
    } */
}