﻿/*xử lý:

modal
popup
dialog*/

/*:root {
    --label-font-size: 12px;
    --input-font-size: 13px;
    --label-font-color: #2a0c79;
    --br-header-color: #a3d2fa;
}*/



/* Card ngoài: chiếm full màn hình theo chiều cao, không dùng 100vw */
.main-container-card {
    position: relative; /* hoặc fixed nếu muốn “dán” full màn hình */
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* chặn tràn ra body */
}

/* Thân card: 2 cột (sidebar + bảng), không cho tràn ra ngoài */
.main-content-flex-container {
    flex: 1 1 auto;
    display: flex;
    gap: 0;
    min-height: 0; /* quan trọng để con flex có thể co theo chiều dọc */
    min-width: 0;
    /*overflow: hidden;*/ /* chặn tràn xuống body */
}


.filter-sidebar { /* 10% - Content lọc */
    width: 10%;
    min-width: 180px;
    max-width: 250px;
    padding: 15px;
    border-right: 1px solid #ccc;
    /*box-sizing: border-box;*/ /* QUAN TRỌNG: padding và border không làm tăng width */
    overflow-y: auto; /* Cho phép cuộn nếu form lọc dài */
    flex-shrink: 0;
    background-color: #f0f2f5;
}


/*.form-modal {
    width: 50vw;
    transition: width 0.3s ease;
    box-sizing: border-box;
}
    .form-modal.expanded {
        width: 70vw;  
        box-sizing: border-box; 
    }*/

    .form-modal .modal-header {
        padding: 0.5px 0.5px;
        background-color: var(--br-header-color);
    }

    .form-modal .form-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 12px  20px;
    }

    .form-modal .myform-group {
        display: flex;
        flex-direction: column;
    }

    .myform-group label {
        font-weight: 600;
        font-size: var(--label-font-size);
        margin-bottom: 2px;
        margin-top: 6px;
        color: var(--label-font-color);
    }

.form-check label {
    font-weight: 600;
    font-size: var(--label-font-size);
    color: var(--label-font-color);
    margin-bottom: 2px;
    margin-top: 2px;
}

.myform-group input,
.myform-group select,
.myform-group textarea {
    /*font-size: var(--input-font-size);
    padding: 3px 4px !important;*/
    width: 100%;
}


.form-modal .modal-header,
.form-modal .modal-body,
.form-modal .modal-footer {
    box-sizing: border-box; 
    width: 100%;
    padding-left: 10px;
    padding-right: 10px;
}

/*.form-modal .modal-footer {
    background-color: #f9f9f9;
    padding-top: 0;
    padding-bottom: 0;
}*/


/*     Tỉ lệ cột linh hoạt */
    .fg-10 {flex: 0 0 10%;}
    .fg-20 {flex: 0 0 20%;}
    .fg-25 {flex: 0 0 25%;}
    .fg-30 {flex: 0 0 30%;}
    .fg-40 {flex: 0 0 40%;}
    .fg-50 {flex: 0 0 50%;}
    .fg-60 {flex: 0 0 60%;}
    .fg-70 {flex: 0 0 70%;}
    .fg-80 {flex: 0 0 80%;}
    .fg-100 {flex: 0 0 100%;}
    .fg-auto {
        flex: 0 0 auto;  /*Không co giãn, không cố định % */
        width: auto;     /*Tự động theo nội dung */
    }




/* Draggable Modal 
    Di chuyển modal bằng cách kéo header 
*/
.draggable-modal .modal-dialog {
    position: fixed;
    top: 40px;
    left: 50%;
    /*transform: translateX(-50%);*/
    width: 100%;
    max-width: 800px;
    /*left: calc(50% - 400px);*/
    margin: 0;
}

.draggable-modal .card-header,
.draggable-modal .modal-header {
    cursor: move;
    user-select: none;
}



/* Định nghĩa chiều rộng, min-width và max-width cụ thể cho từng cột */
.col-stt {
    width: 28px;
    min-width: 18px !important;
    max-width: none !important;
    text-align: center !important;
}

.col-stt input {
    width: 100%;
    min-width: 0;
    padding-left: 0;
    padding-right: 0;
}

.col-item-code,
.col-code {
    max-width: 120px;
    min-width: 60px;
}

.col-item-name,
.col-name {
    max-width: 250px; /* Ví dụ: Tên hàng */
    min-width: 150px;
    padding-left: 3px !important;
}

.col-unit {
    width: 60px; /* ĐVT */
    text-align: center !important;
}

.col-acc, col-unitcombo {
    width: 80px;
    min-width: 40px;
    text-align: center !important;
}

.col-invNo {
    width: 80px;
    min-width: 60px;
    text-align: center !important;
}

.col-desc {
    width: 250px; /* Diễn giải */
    min-width: 150px;
    margin-left: 3px !important;
    text-align: left !important;
}

.col-project {
    width: 120px;
    min-width: 100px;
    text-align: left !important;
}


.col-unitp, .col-upri, .col-quantity, .col-qtty,
.col-amoc, .col-amount, .col-amvn {
    min-width: 80px;
    max-width: 130px;
    text-align: right !important;
    margin-right: 6px !important;
}


.col-tax-rate,
.col-rate {
    min-width: 40px;
    text-align: center !important;
}

/* Compact Excel-like voucher detail grid.
   Use this class on detail tables in cash, purchase, sales, inventory, etc. */
.voucher-detail-table {
    table-layout: fixed;
    border-collapse: collapse;
    font-size: var(--atf-detail-font-size, 11px);
}

.voucher-detail-table th {
    padding: 2px 4px !important;
    height: var(--atf-voucher-detail-cell-height, 22px);
    line-height: calc(var(--atf-voucher-detail-cell-height, 22px) - 4px);
    vertical-align: middle;
    white-space: nowrap;
}

.voucher-detail-table td {
    padding: 0 !important;
    height: var(--atf-voucher-detail-cell-height, 22px);
    line-height: var(--atf-voucher-detail-cell-height, 22px);
    vertical-align: middle;
}

.voucher-detail-table input,
.voucher-detail-table select,
.voucher-detail-table .form-control,
.voucher-detail-table .form-select {
    width: 100% !important;
    height: var(--atf-voucher-detail-cell-height, 22px) !important;
    min-height: var(--atf-voucher-detail-cell-height, 22px) !important;
    padding: 0 4px !important;
    margin: 0 !important;
    border-radius: 0 !important;
    line-height: var(--atf-voucher-detail-cell-height, 22px) !important;
    font-size: var(--atf-detail-font-size, 11px) !important;
    background-color: transparent;
    box-sizing: border-box;
}

.voucher-detail-table input:focus,
.voucher-detail-table select:focus,
.voucher-detail-table .form-control:focus,
.voucher-detail-table .form-select:focus {
    outline: none !important;
    border: 1px solid #8fe6d0 !important;
    box-shadow: 0 0 0 0.06rem rgba(32, 201, 151, .18) !important;
    background-color: #fff !important;
}

.voucher-detail-table .select2-container {
    width: 100% !important;
    height: var(--atf-voucher-detail-cell-height, 22px) !important;
    min-height: var(--atf-voucher-detail-cell-height, 22px) !important;
    margin: 0 !important;
    display: block;
}

.voucher-detail-table .select2-container .select2-selection--single {
    height: var(--atf-voucher-detail-cell-height, 22px) !important;
    min-height: var(--atf-voucher-detail-cell-height, 22px) !important;
    border: 0 !important;
    border-radius: 0 !important;
    background-color: transparent !important;
}

.voucher-detail-table .select2-container--focus .select2-selection--single,
.voucher-detail-table .select2-container--open .select2-selection--single {
    outline: none !important;
    border: 1px solid #8fe6d0 !important;
    box-shadow: 0 0 0 0.06rem rgba(32, 201, 151, .18) !important;
    background-color: #fff !important;
}

.voucher-detail-table .select2-container .select2-selection__rendered {
    height: var(--atf-voucher-detail-cell-height, 22px) !important;
    line-height: var(--atf-voucher-detail-cell-height, 22px) !important;
    padding: 0 16px 0 4px !important;
    font-size: var(--atf-detail-font-size, 11px) !important;
}

.voucher-detail-table .select2-container .select2-selection__arrow {
    height: var(--atf-voucher-detail-cell-height, 22px) !important;
    top: 0 !important;
    right: 0 !important;
}

.voucher-detail-table .btn {
    min-height: 20px;
    padding: 0 4px !important;
    line-height: 18px !important;
    border-radius: 0 !important;
}

.voucher-detail-table .drag-cell {
    position: relative;
    padding: 0 !important;
    white-space: nowrap;
}

.voucher-detail-table .drag-cell input {
    display: block;
    padding-right: 14px !important;
}

.voucher-detail-table .drag-handle {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    opacity: 0;
    user-select: none;
}

.voucher-detail-table .drag-handle:active {
    cursor: grabbing;
}

/* Book report: only lighten the toolbar background; its controls use the shared report styles. */
.book-report-shell .book-report-toolbar {
    background: var(--atf-primary-soft) !important;
    padding: 8px 12px 8px 8px !important;
}

/* Keep the Book Report filters between its title and report tabs on wide screens,
   including while a development host is still serving a cached Razor view. */
@media (min-width: 768px) {
    .book-report-shell .book-report-toolbar {
        display: grid !important;
        grid-template-columns: auto minmax(0, 1fr) auto !important;
        align-items: end !important;
        gap: 16px !important;
    }

    .book-report-shell .book-report-toolbar-top { display: contents !important; }
    .book-report-shell .book-report-heading { grid-column: 1 !important; grid-row: 1 !important; align-self: center !important; }
    .book-report-shell .book-report-heading > div { display: none !important; }
    .book-report-shell .book-report-tabs { grid-column: 3 !important; grid-row: 1 !important; align-self: center !important; }
    .book-report-shell #bookReportFilterForm { grid-column: 2 !important; grid-row: 1 !important; min-width: 0 !important; }
    .book-report-shell .book-report-filters {
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
    }
}
