﻿/* สไตล์พื้นฐาน */

/* ===== นำเข้าฟอนต์ Sarabun สำหรับภาษาไทย ===== */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');

/* ===== การตั้งค่าฟอนต์หลักและขนาดฟอนต์พื้นฐาน ===== */
html, body {
    font-family: 'Sarabun', sans-serif;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 3.5rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggO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boundary::after {
        content: "An error has occurred."
    }

/* ส่วนหัวของหน้า */
.page-header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap; /* ป้องกันการขึ้นบรรทัดใหม่ */
}

    .page-header h3 {
        margin: 0;
        font-weight: 600;
        display: flex;
        align-items: center;
    }

        .page-header h3 i {
            margin-right: 10px;
        }

.user-info {
    display: flex;
    align-items: center;
    gap: 10px; /* ใช้ gap แทน margin */
    white-space: nowrap; /* ป้องกันการขึ้นบรรทัดใหม่ */
}

.welcome-text {
    font-size: 1rem;
    display: flex;
    align-items: center;
}

    .welcome-text i {
        margin-right: 8px;
    }

.page-header .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* ส่วนค้นหาและดาวน์โหลด */
.search-download-container {
    background-color: #f8f9fa;
    border-radius: 6px;
    padding: 0.75rem;
    margin: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.search-download-container .row {
    margin: 0;
    padding: 0;
    gap: 0.4rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.search-download-container .col-12,
.search-download-container .col-6 {
    padding: 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
}

.search-box {
    position: relative;
    margin: 0 0 0.4rem 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
}

.search-box i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 0.85rem;
    z-index: 1;
}

.search-box input {
    padding-left: 30px;
    border-radius: 4px;
    height: 32px;
    border: 1px solid #ced4da;
    background-color: #fff;
    font-size: 0.85rem;
    transition: all 0.2s;
    margin: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.search-box input:focus {
    border-color: #3a7bd5;
    box-shadow: 0 0 0 0.15rem rgba(58, 123, 213, 0.15);
}

.export-buttons {
    display: flex;
    gap: 0.4rem;
    margin: 0.4rem 0 0 0;
    padding: 0;
    width: 100%;
    justify-content: center;
}

.export-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    border-radius: 4px;
    transition: all 0.2s;
    white-space: nowrap;
    border: none;
    min-width: 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.export-btn i {
    margin-right: 0.35rem;
    font-size: 0.9rem;
}

.export-btn.btn-success {
    background-color: #28a745;
    color: white;
}

.export-btn.btn-danger {
    background-color: #dc3545;
    color: white;
}

.export-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
}

/* ปรับแต่งสำหรับหน้าจอขนาดเล็ก */
@media (max-width: 576px) {
    .search-download-container {
        padding: 0.6rem;
    }

    .export-buttons {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    .export-btn {
        width: 100%;
        max-width: 100%;
    }
}

/* เลย์เอาท์หลักแบบใหม่ */
.main-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

/* เมนูด้านซ้าย */
.settings-sidebar {
    flex: 1;
    min-width: 350px;
    max-width: 350px;
    max-height: calc(100vh - 100px); /* กำหนดความสูงสูงสุด */
    overflow-y: auto; /* เพิ่ม scrollbar เมื่อเนื้อหาเกิน */
    position: sticky;
    top: 20px;
}

/* ปรับแต่ง scrollbar */
.settings-sidebar::-webkit-scrollbar {
    width: 8px;
}

.settings-sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.settings-sidebar::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.settings-sidebar::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* พื้นที่แสดงเนื้อหาด้านขวา */
.content-area {
    flex: 3;
    min-width: 500px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

/* ปรับแต่ง scrollbar ของ content-area */
.content-area::-webkit-scrollbar {
    width: 8px;
}

.content-area::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.content-area::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.content-area::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* การ์ดการตั้งค่า */
.filter-card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
    overflow: hidden;
}

    .filter-card .card-header {
        background: linear-gradient(to right, #3a7bd5, #00d2ff);
        border-bottom: none;
        padding: 0.1rem 0.5rem;
        color: white;
    }

    .filter-card .card-body {
        padding: 1rem;
        background-color: #f8f9fa;
    }

/* ส่วนของแท็บ */
.tab-layout {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.department-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    padding: 0;
    margin: 0;
    list-style: none;
    white-space: nowrap;
}

    .department-tabs::-webkit-scrollbar {
        height: 5px;
    }

    .department-tabs::-webkit-scrollbar-track {
        background: #f1f1f1;
    }

    .department-tabs::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 5px;
    }

    .department-tabs li {
        margin: 0;
        padding: 0;
    }

        .department-tabs li button {
            border: none;
            background: none;
            padding: 12px 20px;
            font-weight: 500;
            color: #6c757d;
            cursor: pointer;
            transition: all 0.2s;
            border-bottom: 3px solid transparent;
            white-space: nowrap;
        }

            .department-tabs li button:hover {
                background-color: #e9ecef;
                color: #495057;
            }

        .department-tabs li.active-tab button {
            background-color: #fff;
            color: #3a7bd5;
            border-bottom: 3px solid #3a7bd5;
            font-weight: bold;
        }

.tab-content {
    padding: 1.5rem;
}

.section-header {
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

    .section-header h5 {
        color: #495057;
        font-size: 1.1rem;
        margin: 0;
        display: flex;
        align-items: center;
    }

        .section-header h5 i {
            color: #3a7bd5;
            margin-right: 0.5rem;
        }

/* ส่วนของแผนก */
.department-section {
    background-color: #fff;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.department-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to right, #757f9a, #d7dde8);
    color: white;
    padding: 0.8rem 1.5rem;
    font-weight: 500;
}

    .department-header h5 {
        margin: 0;
        font-size: 1.1rem;
        display: flex;
        align-items: center;
    }

        .department-header h5 i {
            margin-right: 0.5rem;
        }

/* ตาราง */
.data-table {
    margin-bottom: 0;
    width: 100%;
}

    .data-table thead th {
        background: linear-gradient(to right, #304352, #485563);
        color: white;
        font-weight: 500;
        border: none;
        padding: 0.75rem;
        position: relative;
        cursor: pointer;
        transition: background-color 0.2s;
        white-space: nowrap;
    }

        .data-table thead th.sortable:hover {
            background: linear-gradient(to right, #1e3c72, #2a5298);
        }

        .data-table thead th .sort-icon {
            display: inline-block;
            margin-left: 5px;
            font-size: 0.8rem;
            opacity: 0.7;
        }

/* สีแถวในตาราง */
.officer-row {
    background-color: #fff9e6; /* สีเหลืองอ่อนสำหรับยศสูง */
}

.staff-row {
    background-color: #DAEEF3; /* สีฟ้าอ่อนสำหรับยศต่ำ */
}

.data-table tbody tr:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    filter: brightness(0.95);
}

.data-table tbody td {
    vertical-align: middle;
    padding: 0.5rem 0.75rem;
    border-top: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
}

/* ปรับความกว้างคอลัมน์ลำดับ */
.data-table th:first-child,
.data-table td:first-child {
    width: 1%;
    white-space: nowrap;
    text-align: center;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* แก้ไขสไตล์รูปภาพเป็นสี่เหลี่ยมขอบมน */
.profile-image {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px; /* เปลี่ยนจาก 50% เป็น 6px เพื่อให้เป็นสี่เหลี่ยมขอบมนเล็กน้อย */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border: 2px solid #fff;
    transition: transform 0.2s;
    cursor: pointer; /* เพิ่ม cursor เพื่อแสดงว่าสามารถคลิกได้ */
}

    .profile-image:hover {
        transform: scale(1.1);
    }

/* ช่องลงนาม */
.signature-space {
    display: block;
    height: 30px;
    border-bottom: 1px solid #adb5bd;
    margin-top: 5px;
    min-width: 100px;
}

/* การแจ้งเตือน */
.alert-info {
    border-left: 5px solid #17a2b8;
    background-color: #e8f4f8;
    color: #0c5460;
    padding: 1rem;
    display: flex;
    align-items: center;
}

    .alert-info i {
        margin-right: 0.5rem;
        font-size: 1.25rem;
    }

/* Loading spinner */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.spinner-container {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.spinner {
    width: 3rem;
    height: 3rem;
    border: 3px solid #f3f3f3;
    border-radius: 50%;
    border-top: 3px solid #3a7bd5;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Modal สำหรับแสดงรูปภาพ */
.image-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    cursor: pointer;
}

.image-modal-content {
    position: relative;
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    max-width: 90%;
    max-height: 90vh;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    cursor: default;
}

.image-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    z-index: 10000;
}

    .image-modal-close:hover {
        color: #000;
    }

.image-modal-img {
    max-width: 100%;
    max-height: 80vh;
    display: block;
    margin: 0 auto;
    border-radius: 4px;
}

/* สไตล์สำหรับปุ่มจัดการ */
.action-buttons {
    white-space: nowrap;
}

    .action-buttons .btn {
        padding: 0.25rem 0.5rem;
        margin: 0 0.15rem;
        transition: all 0.2s;
    }

        .action-buttons .btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
        }

    .action-buttons .btn-primary {
        background-color: #3a7bd5;
        border-color: #3a7bd5;
    }

    .action-buttons .btn-danger {
        background-color: #d9534f;
        border-color: #d9534f;
    }

/*สำหรับตารางตั้งค่า radio*/
/*สำหรับตารางตั้งค่า radio*/
.settings-table {
    margin-bottom: 0;
    table-layout: auto;
    width: 100%;
    font-size: 0.75rem;
}

    .settings-table td {
        padding: 3px 10px;
        vertical-align: top;
        border: none;
    }

.setting-label-col {
    font-weight: 500;
    width: 1%;
    white-space: nowrap;
    padding-top: 6px;
}

.radio-col {
    width: auto;
    font-size: 0.75rem;
}

.form-check {
    margin-bottom: 0;
    padding-top: 3px;
}

/* สำหรับช่อง rowspan ให้จัดชิดบนเพิ่มเติม */
td[rowspan] .setting-label {
    display: block;
    padding-top: 3px;
}

/* การจัดหน้าของ compact-settings */
.compact-settings {
    background-color: rgba(240, 240, 240, 0.6);
    border-radius: 0.25rem;
    padding: 0.5rem;
}

.table-responsive {
    margin-bottom: 0;
}

/* export pdf */

.export-buttons {
    display: flex;
    gap: 8px;
}

.search-download-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.search-box {
    position: relative;
    flex-grow: 1;
}

.export-btn {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
}

@media (max-width: 768px) {
    .search-download-container {
        flex-direction: column;
        align-items: stretch;
    }

    .export-buttons {
        display: flex;
        justify-content: space-between;
    }

    .export-btn {
        flex: 1;
    }
}

/* ปรับสไตล์สำหรับมือถือ */
@media (max-width: 576px) {
    .action-buttons .btn {
        padding: 0.2rem 0.35rem;
        font-size: 0.75rem;
    }
}

/* Responsive design */
@media (max-width: 1200px) {
    .settings-sidebar {
        min-width: 280px;
    }
}

@media (max-width: 992px) {
    .main-container {
        flex-direction: column;
    }

    .settings-sidebar {
        max-width: 100%;
        min-width: 100%;
    }

    .content-area {
        min-width: 100%;
    }

    .sticky-settings {
        position: relative;
        top: 0;
    }
}

@media (max-width: 768px) {
    .filter-card .card-body {
        padding: 0.8rem;
    }

    .settings-row {
        flex-direction: column;
        gap: 0.5rem;
    }

    .data-table thead th,
    .data-table tbody td {
        padding: 0.4rem 0.6rem;
    }

    .department-tabs li button {
        padding: 8px 15px;
        font-size: 0.9rem;
    }

    .department-header {
        padding: 0.6rem 1rem;
    }

        .department-header h5 {
            font-size: 1rem;
        }
}

@media (max-width: 576px) {
    .page-header h3 {
        font-size: 1.2rem;
    }

    .department-tabs li button {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .data-table {
        font-size: 0.9rem;
    }

    .profile-image {
        width: 35px;
        height: 35px;
    }

    .card-header h5 {
        font-size: 0.9rem;
    }

    .columns-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .export-btn {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }
}

/* ส่วนเลือกคอลัมน์ */
.columns-section {
    background-color: #fff;
    border-radius: 8px;
    padding: 0.8rem;
    border: 1px solid #e9ecef;
}

.columns-header {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.1rem;
    color: #495057;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid #e9ecef;
}

.columns-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.column-checkbox {
    margin-bottom: 0.4rem;
    padding: 4px 8px;
    background-color: #f8f9fa;
    border-radius: 4px;
    transition: background-color 0.2s;
}

    .column-checkbox:hover {
        background-color: #e9ecef;
    }

    .column-checkbox label {
        cursor: pointer;
        font-size: 0.8rem;
        margin-left: 5px;
    }

.label_setting {
    cursor: pointer;
    font-size: 0.8rem;
}

/* ใช้ Flexbox เพื่อจัดวาง checkbox และข้อความในบรรทัดเดียวกัน */
.checkbox-container {
    display: flex;
    align-items: center; /* จัดกึ่งกลางในแนวดิ่ง */
    justify-content: flex-start; /* จัดตำแหน่งเริ่มต้นในแนวนอน (สามารถปรับเป็น center ได้) */
}

    .column-checkbox input:checked + label {
        color: #007bff;
        font-weight: 500;
}
