/* =========================================================================
   NT TRADER ERP theme
   ธีมกลางของทุกหน้าจอ (โหลดเป็นไฟล์สุดท้ายใน index.php)
   ปรับเฉพาะหน้าตา: สี ตัวอักษร ความหนาแน่น ตาราง ฟอร์ม ปุ่ม แท็บ modal
   ไม่แตะ id / class ที่ JS ใช้งาน
   ========================================================================= */

:root {
    --erp-navy: #0b1b33;
    --erp-primary: #1f5fbf;
    --erp-primary-600: #1a52a6;
    --erp-primary-50: #eaf1fb;
    --erp-accent: #f2b705;
    --erp-bg: #f3f5f9;
    --erp-surface: #ffffff;
    --erp-surface-2: #f8fafc;
    --erp-border: #e3e8ef;
    --erp-border-strong: #cfd7e3;
    --erp-text: #1a2433;
    --erp-text-2: #475467;
    --erp-muted: #667085;
    --erp-success: #12b76a;
    --erp-warning: #f79009;
    --erp-danger: #f04438;
    --erp-radius: 8px;
    --erp-radius-sm: 6px;
    --erp-font: 'Prompt', 'Segoe UI', Tahoma, sans-serif;
}

/* ---------- พื้นหลังและตัวอักษร ---------- */
html body {
    background: var(--erp-bg);
    color: var(--erp-text);
    font-family: var(--erp-font);
    font-size: 13.5px;
}

html body .main-menu a,
html body .header-navbar a,
html body .main-menu a:hover,
html body .header-navbar a:hover {
    text-decoration: none;
}

html body .app-content .content-wrapper {
    padding: 1.25rem 1.5rem 2rem;
}

html body h1, html body h2, html body h3, html body h4, html body h5, html body h6 {
    font-family: var(--erp-font);
    color: var(--erp-navy);
}

/* ---------- หัวหน้าจอ (Page header) ---------- */
html body .content-header {
    align-items: center;
    margin-bottom: .75rem;
}

html body .content-header .content-header-left {
    margin-bottom: .5rem !important;
}

html body .content-header-title {
    position: relative;
    padding-left: 14px;
    font-size: 1.25rem !important;
    font-weight: 600;
    letter-spacing: .01em;
    color: var(--erp-navy);
}

html body .content-header-title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 15%;
    bottom: 15%;
    width: 4px;
    border-radius: 2px;
    background: var(--erp-accent);
}

html body .content-header .breadcrumb-wrapper br {
    display: none;
}

/* ---------- Card = Panel ---------- */
html body .card {
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
    margin-bottom: 1rem;
}

html body .card .card-header {
    padding: .75rem 1.25rem;
    background: var(--erp-surface-2);
    border-bottom: 1px solid var(--erp-border);
    border-radius: var(--erp-radius) var(--erp-radius) 0 0;
}

html body .card .card-header .card-title,
html body .card .card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--erp-navy);
}

html body .card .card-body {
    padding: 1.25rem;
}

/* ---------- แท็บแบบ ERP ---------- */
html body .nav.nav-tabs {
    border-bottom: 1px solid var(--erp-border);
    gap: 2px;
}

html body .nav.nav-tabs .nav-item .nav-link {
    position: relative;
    padding: .6rem 1rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--erp-text-2);
    font-weight: 500;
}

html body .nav.nav-tabs .nav-item .nav-link:hover {
    color: var(--erp-primary);
    background: var(--erp-primary-50);
}

html body .nav.nav-tabs .nav-item .nav-link.active {
    color: var(--erp-primary);
    background: transparent;
    box-shadow: inset 0 -2px 0 var(--erp-primary);
}

/* ---------- ฟอร์ม ---------- */
html body label,
html body .form-group label,
html body .col-form-label {
    margin-bottom: .3rem;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--erp-text-2);
}

html body .form-control,
html body .custom-select,
html body select.form-control {
    height: calc(1.5em + .9rem + 2px);
    padding: .45rem .75rem;
    font-size: 13.5px;
    color: var(--erp-text);
    border: 1px solid var(--erp-border-strong);
    border-radius: var(--erp-radius-sm);
    background-color: #fff;
    transition: border-color .15s, box-shadow .15s;
}

html body textarea.form-control {
    height: auto;
}

html body .form-control:focus,
html body .custom-select:focus {
    border-color: var(--erp-primary);
    box-shadow: 0 0 0 3px rgba(31, 95, 191, .15);
}

html body .form-control[readonly],
html body .form-control:disabled {
    background-color: var(--erp-surface-2);
    color: var(--erp-text-2);
}

html body .form-control::placeholder {
    color: #98a2b3;
}

html body .form-group {
    margin-bottom: .9rem;
}

html body .input-group-text {
    border-color: var(--erp-border-strong);
    background: var(--erp-surface-2);
    color: var(--erp-text-2);
}

/* ---------- ปุ่ม ---------- */
html body .btn {
    padding: .45rem 1rem;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: var(--erp-radius-sm);
    box-shadow: none !important;
}

html body .btn-sm {
    padding: .25rem .6rem;
    font-size: 12.5px;
}

html body .btn-primary,
html body .btn-info {
    background-color: var(--erp-primary) !important;
    border-color: var(--erp-primary) !important;
    color: #fff !important;
}

html body .btn-primary:hover,
html body .btn-info:hover {
    background-color: var(--erp-primary-600) !important;
    border-color: var(--erp-primary-600) !important;
}

html body .btn-outline-primary,
html body .btn-outline-info {
    color: var(--erp-primary) !important;
    border-color: var(--erp-border-strong) !important;
    background: #fff !important;
}

html body .btn-outline-primary:hover,
html body .btn-outline-info:hover {
    color: var(--erp-primary) !important;
    border-color: var(--erp-primary) !important;
    background: var(--erp-primary-50) !important;
}

html body .btn-success {
    background-color: var(--erp-success) !important;
    border-color: var(--erp-success) !important;
}

html body .btn-danger {
    background-color: var(--erp-danger) !important;
    border-color: var(--erp-danger) !important;
}

html body .btn-warning {
    background-color: var(--erp-warning) !important;
    border-color: var(--erp-warning) !important;
    color: #fff !important;
}

html body .btn-secondary,
html body .btn-light {
    color: var(--erp-text) !important;
    background: #fff !important;
    border-color: var(--erp-border-strong) !important;
}

html body .btn-secondary:hover,
html body .btn-light:hover {
    background: var(--erp-surface-2) !important;
}

html body .btn-group > .btn + .btn {
    margin-left: -1px;
}

/* ---------- ตารางข้อมูล ---------- */
html body .table {
    color: var(--erp-text);
    font-size: 13px;
}

html body .table thead th,
html body table.dataTable thead th {
    padding: .6rem .75rem;
    background: var(--erp-surface-2);
    border-top: 0;
    border-bottom: 1px solid var(--erp-border) !important;
    color: var(--erp-text-2);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
    white-space: nowrap;
    vertical-align: middle;
}

html body .table td,
html body table.dataTable tbody td {
    padding: .5rem .75rem;
    border-top: 1px solid #eef1f5;
    vertical-align: middle;
}

html body .table-bordered,
html body .table-bordered td,
html body .table-bordered th {
    border-color: var(--erp-border) !important;
}

html body .table-striped tbody tr:nth-of-type(odd),
html body table.dataTable.stripe tbody tr.odd {
    background-color: #fafbfd;
}

html body .table-hover tbody tr:hover,
html body table.dataTable tbody tr:hover {
    background-color: var(--erp-primary-50) !important;
}

html body .table-responsive {
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
}

html body .table-responsive > .table {
    margin-bottom: 0;
}

/* DataTables controls */
html body .dataTables_wrapper .dataTables_length select,
html body .dataTables_wrapper .dataTables_filter input {
    height: 32px;
    padding: .25rem .5rem;
    border: 1px solid var(--erp-border-strong);
    border-radius: var(--erp-radius-sm);
    font-size: 13px;
}

html body .dataTables_wrapper .dataTables_info {
    font-size: 12.5px;
    color: var(--erp-muted);
}

html body .dataTables_wrapper .dt-buttons .btn,
html body .dataTables_wrapper .dt-buttons .dt-button {
    padding: .3rem .8rem;
    font-size: 12.5px;
    color: var(--erp-text) !important;
    background: #fff !important;
    border: 1px solid var(--erp-border-strong) !important;
}

html body .dataTables_wrapper .dt-buttons .btn:hover,
html body .dataTables_wrapper .dt-buttons .dt-button:hover {
    background: var(--erp-surface-2) !important;
}

html body .page-item .page-link {
    margin: 0 2px;
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-sm) !important;
    color: var(--erp-text-2);
    font-size: 12.5px;
}

html body .page-item.active .page-link {
    background-color: var(--erp-primary);
    border-color: var(--erp-primary);
    color: #fff;
}

/* ---------- สถานะ (Badge) ---------- */
html body .badge {
    padding: .3em .7em;
    border-radius: 4px;
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: .01em;
}

html body .badge-success { background: #ecfdf3; color: #027a48; box-shadow: inset 0 0 0 1px #abefc6; }
html body .badge-warning { background: #fffaeb; color: #b54708; box-shadow: inset 0 0 0 1px #fedf89; }
html body .badge-danger  { background: #fef3f2; color: #b42318; box-shadow: inset 0 0 0 1px #fecdca; }
html body .badge-info,
html body .badge-primary { background: var(--erp-primary-50); color: var(--erp-primary-600); box-shadow: inset 0 0 0 1px #c3d6f2; }
html body .badge-secondary { background: #f2f4f7; color: #344054; box-shadow: inset 0 0 0 1px #e4e7ec; }

/* ---------- Modal = หน้าต่างเอกสาร ---------- */
html body .modal-content {
    border: 0;
    border-radius: 10px;
    box-shadow: 0 24px 48px -12px rgba(16, 24, 40, .25);
    overflow: hidden;
}

html body .modal-header {
    padding: .85rem 1.25rem;
    background: var(--erp-navy);
    border-bottom: 3px solid var(--erp-accent);
}

html body .modal-header .modal-title,
html body .modal-header h1, html body .modal-header h2, html body .modal-header h3,
html body .modal-header h4, html body .modal-header h5 {
    color: #fff;
    font-size: 1.05rem;
    font-weight: 600;
}

html body .modal-header .close {
    color: #fff;
    opacity: .8;
    text-shadow: none;
}

html body .modal-header .close:hover {
    opacity: 1;
}

html body .modal-body {
    padding: 1.25rem;
}

html body .modal-footer {
    padding: .75rem 1.25rem;
    background: var(--erp-surface-2);
    border-top: 1px solid var(--erp-border);
}

html body .modal-backdrop.show {
    opacity: .45;
}

/* ---------- SweetAlert ---------- */
html body .swal2-popup {
    border-radius: 10px;
    font-family: var(--erp-font);
}

html body .swal2-styled.swal2-confirm {
    background-color: var(--erp-primary) !important;
    border-radius: var(--erp-radius-sm) !important;
}

/* ---------- Dropdown ---------- */
html body .dropdown-menu {
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    box-shadow: 0 12px 24px -8px rgba(16, 24, 40, .18);
}

html body .dropdown-item {
    padding: .5rem 1rem;
    font-size: 13px;
}

html body .dropdown-item:hover {
    background: var(--erp-primary-50);
    color: var(--erp-primary);
}

/* ---------- Footer = แถบสถานะ ---------- */
html body footer.erp-statusbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 6px 1.5rem;
    background: #fff;
    border-top: 1px solid var(--erp-border);
    font-size: 12px;
    color: var(--erp-muted);
    white-space: nowrap;
}

html body footer.erp-statusbar .erp-sb-group {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
    overflow: hidden;
}

html body footer.erp-statusbar .erp-sb-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

html body footer.erp-statusbar b {
    font-weight: 600;
    color: var(--erp-text);
}

html body footer.erp-statusbar .erp-sb-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--erp-success);
    box-shadow: 0 0 0 3px rgba(18, 183, 106, .15);
}

/* ---------- Scrollbar ---------- */
html body ::-webkit-scrollbar { width: 10px; height: 10px; }
html body ::-webkit-scrollbar-thumb { background: #cfd7e3; border-radius: 6px; border: 2px solid var(--erp-bg); }
html body ::-webkit-scrollbar-track { background: transparent; }

/* ---------- Responsive ---------- */
@media (max-width: 767.98px) {
    html body .app-content .content-wrapper {
        padding: 1rem .75rem 1.5rem;
    }

    html body .card .card-body {
        padding: 1rem;
    }

    html body footer.erp-statusbar .erp-sb-hide-sm {
        display: none;
    }
}
