﻿/* =====================================================
   ERP UI SYSTEM (GLOBAL STANDARD)
   ===================================================== */

/* GLOBAL */
html {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    background-color: #f8f9fa;
    max-width: 100%;
    overflow-x: hidden;
}

.container-fluid {
    max-width: 100%;
}

.layout-wrapper,
.layout-container,
.layout-page,
.content-wrapper {
    max-width: 100%;
}

.container-xxl,
.container-xl,
.container-lg,
.container-md,
.container-sm,
.container {
    max-width: 100%;
}

/* HEADINGS */
h2 i {
    font-size: 1.5rem;
}

h2.fw-bold {
    color: #225977;
}

/* SHARED PAGE TITLES */
.page-title {
    color: #225977;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.page-subtitle {
    color: #6c757d;
    font-size: 0.95rem;
}

/* BUTTONS */
.btn {
    border-radius: 0.5rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s ease-in-out;
}

.btn-sm {
    height: 32px;
    min-width: 32px;
    padding: 0 10px;
    font-size: 13px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
}

.btn-primary {
    background-color: #225977;
    border-color: #225977;
}

    .btn-primary:hover {
        background-color: #1b4a63;
        border-color: #1b4a63;
    }

.btn-warning {
    background-color: #ff9f43;
    border-color: #ff9f43;
    color: #fff;
}

    .btn-warning:hover {
        background-color: #e6892e;
    }

.btn-outline-primary {
    border-color: #225977;
    color: #225977;
}

    .btn-outline-primary:hover {
        background-color: #225977;
        color: #fff;
    }

.btn-outline-danger {
    border-color: #ff4d4f;
    color: #ff4d4f;
}

    .btn-outline-danger:hover {
        background-color: #ff4d4f;
        color: #fff;
    }

.btn-outline-info {
    border-color: #0084cf;
    color: #0084cf;
}

    .btn-outline-info:hover {
        background-color: #0084cf;
        color: #fff;
    }

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* BUTTON GROUP */
.btn-group .btn {
    height: 32px;
    min-width: 32px;
    padding: 0 8px;
}

.btn-group,
.btn-toolbar,
.dt-buttons {
    flex-wrap: wrap;
}

.dropdown-menu {
    max-width: min(92vw, 360px);
    overflow-wrap: anywhere;
}

/* CARD */
.card {
    border-radius: 0.75rem;
    transition: all 0.2s ease-in-out;
    max-width: 100%;
}

    .card.shadow-sm {
        box-shadow: 0 2px 10px rgba(0,0,0,0.05) !important;
    }

    .card:hover {
        transform: translateY(-2px);
    }

/* ERP SECTION CARD (GLOBAL) */
.erp-section-card {
    border: 1px solid #e6edf3;
    border-radius: 0.9rem;
    background: #fff;
    overflow: hidden;
}

.erp-section-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #edf2f7;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
}

.erp-section-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #225977;
}

.erp-section-body {
    padding: 1.25rem;
}

/* SUMMARY CHIPS (GLOBAL) */
.summary-chip-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.summary-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #eef6fb;
    color: #225977;
    border: 1px solid #d9e9f4;
    border-radius: 999px;
    padding: 0.45rem 0.8rem;
    font-size: 12px;
    font-weight: 600;
}

/* TABLE */
.table-responsive,
.dataTables_wrapper {
    width: 100%;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    margin-bottom: 0;
    width: 100%;
}

    .table th {
        font-size: 13px;
        letter-spacing: 0.3px;
    }

    .table td {
        font-size: 14px;
        vertical-align: middle;
    }

    .table .btn {
        margin: 0 2px;
    }

.table-hover tbody tr:hover {
    background-color: rgba(0,0,0,0.03);
}

/* Global ERP thead style */
.table thead th {
    background: #eef4f8 !important;
    color: #284b63 !important;
    border-color: #d9e2ec !important;
    font-weight: 700;
    white-space: nowrap;
    vertical-align: middle;
}

/* DATATABLE */
.dataTables_wrapper .dt-buttons .btn {
    height: 32px;
    min-width: 36px;
    padding: 0 10px;
    font-size: 13px;
    border-radius: 0.5rem;
}

.dataTables_wrapper .dt-buttons {
    gap: 6px;
}

.dataTables_wrapper .dataTables_filter input {
    border-radius: .4rem;
    border: 1px solid #ced4da;
    padding: .375rem .75rem;
}

.dataTables_wrapper .dataTables_length select {
    border-radius: .4rem;
    border: 1px solid #ced4da;
    padding: .25rem 1.75rem .25rem .5rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: .4rem !important;
    margin: 0 2px;
}

.dataTables_wrapper .dataTables_info {
    color: #6c757d;
    font-size: .9rem;
}

table.dataTable tbody td {
    vertical-align: middle;
}

.dataTables_wrapper .row {
    --bs-gutter-y: .75rem;
}

.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_length {
    width: 100%;
}

.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_length label {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: 0;
}

.dataTables_wrapper .dataTables_filter input {
    min-width: min(260px, 100%);
}

.dataTables_wrapper .dataTables_paginate {
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: .25rem;
}

/* BADGES */
.badge {
    font-size: 12px;
    padding: 6px 8px;
    border-radius: 0.35rem;
}

.bg-success {
    background-color: #33ce96 !important;
}

.bg-danger {
    background-color: #ff4d4f !important;
}

.bg-warning {
    background-color: #ff9f43 !important;
}

.bg-secondary {
    background-color: #6c757d !important;
}

/* INPUTS */
.form-control, .form-select {
    border-radius: 0.4rem;
    max-width: 100%;
}

    .form-control:focus, .form-select:focus {
        border-color: #225977;
        box-shadow: 0 0 0 0.15rem rgba(34, 89, 119, 0.2);
    }

.form-label {
    margin-bottom: 4px;
    font-weight: 600;
}

.form-note {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
}

/* MODAL */
.modal-content {
    border-radius: 0.75rem;
    border: 0;
    overflow: visible;
    max-width: 100%;
}

.modal-header {
    background-color: #fff;
    color: #225977;
    border-bottom: 1px solid #dee2e6;
    padding: 1rem 1.25rem;
    position: relative;
    border-top-left-radius: 0.75rem;
    border-top-right-radius: 0.75rem;
    padding-right: 4.25rem;
}

.modal-title {
    font-weight: 700;
    color: #225977;
    margin-bottom: 0;
    overflow-wrap: anywhere;
}

    .modal-title i {
        color: #225977;
    }

.btn-close-red {
    filter: none !important;
    background-color: red !important;
    border-radius: 0.25rem;
    padding: 0.25rem 0.4rem;
    width: 1.5rem;
    height: 1.5rem;
    opacity: 1;
}

    .btn-close-red:hover {
        background-color: darkred !important;
    }

/* TOAST */
.toast {
    border-radius: 0.5rem;
    font-size: 1rem;
}

/* HELPERS */
.avatar-sm {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: .5rem;
}

.bg-label-primary {
    background: rgba(13, 110, 253, .12);
}

.bg-label-warning {
    background: rgba(255, 193, 7, .15);
}

.bg-label-info {
    background: rgba(13, 202, 240, .12);
}

.erp-info-strip {
    border: 0;
    border-radius: .6rem;
    padding: .75rem .9rem;
}

    .erp-info-strip.primary {
        background: rgba(13, 110, 253, .1);
        color: #0b5ed7;
    }

    .erp-info-strip.info {
        background: rgba(13, 202, 240, .12);
        color: #087990;
    }

    .erp-info-strip.warning {
        background: rgba(255, 193, 7, .18);
        color: #997404;
    }

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 84px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

    .status-pill.active {
        background: rgba(51, 206, 150, 0.14);
        color: #1d8f68;
    }

    .status-pill.inactive {
        background: rgba(255, 77, 79, 0.12);
        color: #d9363e;
    }

.action-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

    .action-strip .btn {
        min-width: 130px;
    }

/* RESPONSIVE */
@media (hover: none) {
    .card:hover {
        transform: none;
    }
}

@media (max-width: 768px) {
    body {
        font-size: .92rem;
    }

    .container-xxl,
    .container-xl,
    .container-lg,
    .container-md,
    .container-sm,
    .container,
    .container-fluid {
        padding-right: .75rem;
        padding-left: .75rem;
    }

    .container-p-y:not([class*="pt-"]) {
        padding-top: 1rem !important;
    }

    .container-p-y:not([class*="pb-"]) {
        padding-bottom: 1rem !important;
    }

    .row {
        --bs-gutter-x: 1rem;
        --bs-gutter-y: 1rem;
    }

    .page-title,
    h1,
    h2 {
        font-size: 1.35rem;
        line-height: 1.25;
    }

    .page-subtitle {
        font-size: .86rem;
    }

    .card-body,
    .card-header,
    .card-footer {
        padding: 1rem;
    }

    .btn {
        font-size: 0.85rem;
        padding: 0.4rem 0.6rem;
        min-height: 38px;
        white-space: normal;
    }

    .btn-sm,
    .btn-icon,
    .btn-group .btn {
        min-height: 34px;
    }

    .btn-group,
    .btn-toolbar,
    .action-strip,
    .dt-buttons,
    .card-header,
    .modal-footer {
        gap: .5rem;
    }

    .card-header,
    .modal-footer,
    .dt-buttons {
        flex-wrap: wrap;
    }

    .modal-footer .btn,
    .action-strip .btn {
        flex: 1 1 100%;
        width: 100%;
    }

    .table-responsive {
        margin-bottom: .5rem;
        border-radius: .6rem;
    }

    .table {
        min-width: 720px;
    }

    .table th, .table td {
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .table td .btn,
    .table td .dropdown-toggle {
        white-space: nowrap;
    }

    .dataTables_wrapper > .row:first-child,
    .dataTables_wrapper > .row:last-child {
        align-items: stretch !important;
    }

    .dataTables_wrapper > .row:first-child > [class*="col"],
    .dataTables_wrapper > .row:last-child > [class*="col"] {
        width: 100%;
        flex: 0 0 100%;
    }

    .dataTables_wrapper .dataTables_filter label,
    .dataTables_wrapper .dataTables_length label {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .dataTables_wrapper .dataTables_filter input,
    .dataTables_wrapper .dataTables_length select {
        width: 100% !important;
        margin-left: 0 !important;
    }

    .erp-section-body {
        padding: 1rem;
    }

    .action-strip {
        flex-direction: column;
    }

        .action-strip .btn {
            width: 100%;
        }

    .summary-chip {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .form-label {
        font-size: .86rem;
    }

    .form-control,
    .form-select,
    .input-group-text {
        min-height: 40px;
        font-size: .9rem;
    }

    .input-group {
        flex-wrap: nowrap;
    }

    .modal-dialog {
        margin: .5rem;
    }

    .modal-header {
        padding: .85rem 3.5rem .85rem 1rem;
    }

    .modal-body {
        max-height: calc(100vh - 170px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-title {
        font-size: 1rem;
    }

    .toast-container {
        right: .5rem !important;
        left: .5rem !important;
        top: .5rem !important;
        width: auto;
    }

    .erp-toast {
        min-width: 0 !important;
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    .layout-page {
        min-width: 0;
    }

    .content-wrapper {
        min-width: 0;
    }

    .card {
        border-radius: .65rem;
    }

    .card-header {
        align-items: stretch !important;
        flex-direction: column;
    }

    .card-header .btn,
    .card-header .btn-group,
    .card-header .dropdown {
        width: 100%;
    }

    .btn-group {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
        width: 100%;
    }

    .modal-dialog {
        max-width: calc(100vw - 1rem);
    }

    .modal-dialog-scrollable .modal-body {
        max-height: calc(100vh - 150px);
    }

    .modal-footer {
        padding: .75rem 1rem;
    }

    .offcanvas,
    .layout-menu {
        max-width: min(300px, 86vw);
    }

    .table {
        min-width: 680px;
    }
}

/* SIDEBAR */
.layout-menu-collapsed .layout-menu {
    width: 78px !important;
}

.layout-menu-collapsed .menu-text {
    display: none;
}

.layout-menu-collapsed .layout-menu:hover {
    width: 260px !important;
}

.layout-menu {
    transition: width 0.25s ease;
}

@media (max-width: 1199.98px) {
    .layout-menu {
        width: 300px !important;
        max-width: 86vw;
    }

    .layout-menu .menu-inner {
        overflow-x: hidden;
    }

    .layout-overlay {
        cursor: pointer;
    }
}

/* PRINT */
@media print {
    body {
        background: #fff !important;
    }

    .card, .btn {
        display: none !important;
    }
}

.notification-item {
    transition: background-color .2s ease, padding-left .2s;
    border-left: 4px solid transparent;
}

    .notification-item:hover {
        background-color: #f8f9fa;
        padding-left: 6px;
        border-left-color: #225977;
    }

.unread-item {
    background: #eef6ff !important;
    border-left-color: #0d6efd;
    font-weight: 600;
}

/* Sidebar menu full name display */
.layout-menu .menu-link {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    min-height: 44px;
    align-items: flex-start;
}

.layout-menu .menu-text {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    line-height: 1.25rem;
    word-break: break-word;
    flex: 1;
}

.layout-menu {
    width: 300px !important;
}

.app-brand-logo svg,
.app-brand-logo img {
    width: 28px;
    height: 28px;
}


/* GLOBAL UI STATES */
.erp-global-loader {
    position: fixed;
    inset: 0;
    z-index: 1075;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 1rem;
    pointer-events: none;
    background: rgba(248, 249, 250, 0.28);
}

.erp-global-loader.d-none {
    display: none !important;
}

.erp-loader-box {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 42px;
    padding: 0.65rem 1rem;
    border: 1px solid #d9e2ec;
    border-radius: 0.5rem;
    background: #fff;
    color: #225977;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(34, 89, 119, 0.14);
}

.fade-in-loader {
    animation: erpFadeIn 0.15s ease-in;
}

@keyframes erpFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.erp-state-host {
    position: relative;
    min-height: 96px;
}

.erp-state-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    border-radius: inherit;
    background: rgba(255, 255, 255, 0.78);
    color: #225977;
    font-weight: 700;
}

.erp-state {
    display: flex;
    min-height: 140px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.5rem;
    border: 1px dashed #d9e2ec;
    border-radius: 0.6rem;
    background: #fbfdff;
    color: #6c757d;
    text-align: center;
    font-weight: 600;
}

.erp-state i {
    font-size: 2rem;
    color: #225977;
}

.erp-state-error {
    border-color: rgba(255, 77, 79, 0.35);
    background: rgba(255, 77, 79, 0.05);
    color: #b4232a;
}

.erp-state-error i {
    color: #ff4d4f;
}

.erp-table-processing {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #225977;
    font-weight: 700;
}

.erp-table-empty {
    padding: 1rem;
    color: #6c757d;
    font-weight: 600;
}

.btn.is-loading {
    pointer-events: none;
}

@media (max-width: 768px) {
    .erp-global-loader {
        padding-inline: 1rem;
    }

    .erp-loader-box {
        width: 100%;
        justify-content: center;
    }
}
