﻿/* =========================================================
   TPS Shared UI
   One Visual Standard + Multiple Screen Patterns
   ========================================================= */


/* =========================================================
   Page Header
   ========================================================= */

.tps-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.tps-page-heading {
    min-width: 260px;
    margin-bottom: 8px;
}

.tps-page-title {
    margin: 0;
    color: #2f4050;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.4;
}

.tps-page-subtitle {
    margin-top: 4px;
    color: #7a8793;
    font-size: 13px;
}


/* =========================================================
   Toolbar
   ========================================================= */

.tps-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    margin: 0 -4px 8px;
}

    .tps-toolbar > * {
        margin: 0 4px 6px;
    }


/* =========================================================
   Filters
   ========================================================= */

.tps-filter-panel {
    background: #fff;
    border: 1px solid #e5e9ed;
    border-radius: 4px;
    padding: 14px;
    margin-bottom: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .03);
}

.tps-filter-grid {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    flex-wrap: wrap;
    margin: 0 -6px;
}

.tps-filter-item {
    padding: 0 6px;
    margin-bottom: 8px;
    min-width: 0;
}

.tps-filter-item-search {
    flex: 0 1 430px;
    width: 430px;
    max-width: 100%;
}

.tps-filter-item-ddl {
    flex: 0 1 240px;
    width: 240px;
    max-width: 100%;
}

.tps-filter-item-status {
    flex: 0 0 auto;
}

.tps-filter-item-page-size {
    flex: 0 0 110px;
    width: 110px;
}

.tps-filter-label {
    display: block;
    margin-bottom: 6px;
    color: #56616b;
    font-size: 12px;
    font-weight: 700;
}

.tps-filter-control .select2-container {
    width: 100% !important;
}


/* =========================================================
   Search
   ========================================================= */

.tps-search-box {
    display: flex;
    width: 100%;
    border-radius: 4px;
    overflow: hidden;
}

    .tps-search-box .form-control {
        flex: 1 1 auto;
        min-width: 0;
        height: 36px;
        border-radius: 0;
    }

    .tps-search-box .btn {
        flex: 0 0 42px;
        height: 36px;
        margin-inline-start: -1px;
        padding-left: 13px;
        padding-right: 13px;
        border-radius: 0;
    }


/* =========================================================
   Radio Filter
   ========================================================= */

.tps-radio-filter {
    display: inline-flex;
    flex-wrap: wrap;
    border: 1px solid #d9dee3;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
}

    .tps-radio-filter label {
        margin: 0;
        padding: 8px 13px;
        cursor: pointer;
        font-weight: 400;
        color: #59636d;
        background: #fff;
    }

        .tps-radio-filter label + label {
            border-inline-start: 1px solid #e3e7ea;
        }

    .tps-radio-filter input {
        margin-inline-end: 5px;
        vertical-align: middle;
    }


/* =========================================================
   List
   ========================================================= */

.tps-list-container {
    min-height: 80px;
}

.tps-list-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 9px 12px;
    border: 1px solid #e5e9ed;
    border-bottom: 0;
    background: #f8fafb;
    color: #5b6670;
    font-size: 12px;
}

    .tps-list-summary strong {
        color: #2f4050;
    }


/* =========================================================
   Table
   ========================================================= */

.tps-table-wrap {
    overflow-x: auto;
    border: 1px solid #e5e9ed;
    background: #fff;
}

.tps-table {
    margin-bottom: 0;
    min-width: 980px;
}

    .tps-table > thead > tr > th {
        background: #f4f6f8;
        color: #46515b;
        border-bottom: 1px solid #dfe4e8;
        font-size: 12px;
        font-weight: 700;
        white-space: nowrap;
        vertical-align: middle;
        padding: 10px 8px;
    }

    .tps-table > tbody > tr > td {
        vertical-align: middle;
        padding: 9px 8px;
        border-color: #edf0f2;
    }

    .tps-table > tbody > tr:hover {
        background: #fbfcfd;
    }

.tps-table-row-deleted {
    opacity: .72;
    background: #fff8f8;
}


/* =========================================================
   Record Title
   ========================================================= */

.tps-record-title {
    color: #2f4050;
    font-weight: 700;
    line-height: 1.35;
}

.tps-record-subtitle {
    margin-top: 2px;
    color: #8b949c;
    font-size: 11px;
    text-align: start;
}


/* =========================================================
   Status
   ========================================================= */

.tps-status {
    display: inline-block;
    min-width: 42px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    line-height: 1.2;
}

.tps-status-info {
    color: #31708f;
    background: #d9edf7;
}

.tps-status-success {
    color: #3c763d;
    background: #dff0d8;
}

.tps-status-muted {
    color: #6c757d;
    background: #eceff1;
}

.tps-status-danger {
    color: #a94442;
    background: #f2dede;
}


/* =========================================================
   Table Actions
   ========================================================= */

.tps-table-actions {
    white-space: nowrap;
    text-align: center;
}

    .tps-table-actions .btn {
        margin: 1px;
    }

.tps-action-text,
.tps-mobile-record-id {
    display: none;
}


/* =========================================================
   Pagination
   ========================================================= */

.tps-pagination {
    margin: 14px 0 0;
    text-align: center;
}

    .tps-pagination .pagination {
        margin: 0;
    }


/* =========================================================
   Empty State
   ========================================================= */

.tps-empty-state {
    padding: 36px 15px;
    text-align: center;
    color: #8b949c;
}

    .tps-empty-state i {
        display: block;
        margin-bottom: 8px;
        font-size: 30px;
        color: #b7c0c7;
    }


/* =========================================================
   Forms
   ========================================================= */

.tps-form-section {
    margin-bottom: 16px;
    padding: 16px;
    border: 1px solid #e5e9ed;
    border-radius: 4px;
    background: #fff;
}

.tps-form-section-title {
    margin: 0 0 14px;
    padding-bottom: 9px;
    border-bottom: 1px solid #edf0f2;
    color: #34495e;
    font-size: 15px;
    font-weight: 700;
}

.tps-form .form-group {
    margin-bottom: 14px;
}

    .tps-form .form-group > label {
        color: #56616b;
        font-size: 12px;
        font-weight: 700;
    }

.tps-required {
    color: #d9534f;
    margin-inline-start: 2px;
}

.tps-form-help {
    display: block;
    margin-top: 5px;
    color: #8b949c;
    font-size: 11px;
}

.tps-form-check {
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid #e3e7ea;
    border-radius: 4px;
    background: #f9fafb;
}

    .tps-form-check label {
        margin: 0;
        font-weight: 400;
        cursor: pointer;
    }

.tps-form-actions {
    padding-top: 4px;
    text-align: end;
}

    .tps-form-actions .btn {
        min-width: 110px;
    }


/* =========================================================
   Tablet
   ========================================================= */

@media (max-width: 991px) {

    .tps-page-header {
        display: block;
    }

    .tps-filter-item-search {
        flex: 1 1 100%;
        width: 100%;
    }

    .tps-filter-item-ddl {
        flex: 1 1 260px;
        width: auto;
    }

    .tps-filter-item-status {
        flex: 1 1 310px;
    }

    .tps-filter-item-page-size {
        flex: 0 0 110px;
    }
}


/* =========================================================
   Mobile
   Record-based Tables -> Cards
   ========================================================= */

@media (max-width: 767px) {

    .tps-filter-panel {
        padding: 12px;
    }

    .tps-filter-grid {
        display: block;
        margin: 0;
    }

    .tps-filter-item,
    .tps-filter-item-search,
    .tps-filter-item-ddl,
    .tps-filter-item-status,
    .tps-filter-item-page-size {
        width: 100%;
        max-width: none;
        padding: 0;
        margin-bottom: 12px;
    }

        .tps-filter-item:last-child {
            margin-bottom: 0;
        }

    .tps-radio-filter {
        display: flex;
        width: 100%;
    }

        .tps-radio-filter label {
            flex: 1 1 auto;
            text-align: center;
            padding: 8px 6px;
        }

    .tps-list-summary {
        margin-bottom: 8px;
        border-bottom: 1px solid #e5e9ed;
    }

    .tps-table-wrap {
        overflow: visible;
        border: 0;
        background: transparent;
    }

    .tps-table {
        display: block !important;
        min-width: 0 !important;
        width: 100% !important;
        background: transparent;
    }

        .tps-table > thead {
            display: none !important;
        }

        .tps-table > tbody {
            display: block !important;
            width: 100% !important;
        }

            .tps-table > tbody > tr {
                position: relative;
                display: block !important;
                width: 100% !important;
                margin-bottom: 12px;
                overflow: hidden;
                border: 1px solid #e4e8ec;
                border-radius: 6px;
                background: #fff;
                box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
            }

                .tps-table > tbody > tr:hover {
                    background: #fff;
                }

                .tps-table > tbody > tr > td {
                    display: flex !important;
                    align-items: flex-start;
                    justify-content: space-between;
                    width: 100% !important;
                    min-height: 38px;
                    padding: 8px 12px;
                    border-top: 1px solid #edf0f2;
                    border-bottom: 0;
                    text-align: end !important;
                    white-space: normal;
                }

                    .tps-table > tbody > tr > td::before {
                        content: attr(data-label);
                        flex: 0 0 95px;
                        margin-inline-end: 12px;
                        color: #7a8793;
                        font-size: 11px;
                        font-weight: 700;
                        text-align: start;
                    }

                    .tps-table > tbody > tr > td.tps-mobile-hide {
                        display: none !important;
                    }

                    .tps-table > tbody > tr > td.tps-mobile-title {
                        display: block !important;
                        padding: 12px 14px;
                        border-top: 0;
                        background: #f8fafb;
                        text-align: start !important;
                    }

                        .tps-table > tbody > tr > td.tps-mobile-title::before {
                            display: none;
                        }

    .tps-mobile-record-id {
        display: inline-block;
        margin-inline-end: 6px;
        color: #8a949d;
        font-size: 12px;
        font-weight: 700;
    }

    .tps-record-title {
        font-size: 15px;
    }

    .tps-record-subtitle {
        margin-top: 3px;
        font-size: 11px;
    }

    .tps-table > tbody > tr > td.tps-table-actions {
        display: flex !important;
        align-items: center;
        justify-content: flex-start;
        padding: 10px 12px;
        background: #fbfcfd;
        text-align: start !important;
    }

        .tps-table > tbody > tr > td.tps-table-actions::before {
            display: none;
        }

    .tps-table-actions .btn {
        margin: 0;
        margin-inline-end: 6px;
        padding: 5px 9px;
    }

    .tps-action-text {
        display: inline;
        margin-inline-start: 4px;
    }

    .tps-table-empty-row {
        border: 0 !important;
        box-shadow: none !important;
    }

        .tps-table-empty-row > td {
            display: block !important;
            padding: 0 !important;
            border: 1px solid #e5e9ed !important;
            text-align: center !important;
        }

            .tps-table-empty-row > td::before {
                display: none !important;
            }

    .tps-table-row-deleted {
        opacity: .82;
    }
}

/* =========================================================
   Pattern D/E Pilot - Header / Detail + Inline Editing
   Generic TPS UI only
   ========================================================= */

.tps-tabs {
    margin-bottom: 16px;
    border-bottom: 1px solid #dfe4e8;
}

    .tps-tabs > li > a {
        color: #56616b;
        font-weight: 600;
    }

    .tps-tabs > li.active > a,
    .tps-tabs > li.active > a:hover,
    .tps-tabs > li.active > a:focus {
        color: #2f4050;
        background: #fff;
        border-color: #dfe4e8 #dfe4e8 transparent;
    }

.tps-tab-content {
    padding-top: 2px;
}

.tps-workspace {
    margin-bottom: 18px;
}

.tps-workspace-header {
    margin-bottom: 16px;
    padding: 16px;
    border: 1px solid #e5e9ed;
    border-radius: 5px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .03);
}

.tps-workspace-header-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.tps-workspace-title {
    color: #2f4050;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
}

.tps-workspace-subtitle {
    margin-top: 4px;
    color: #7a8793;
    font-size: 12px;
}

.tps-workspace-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.tps-workspace-summary {
    display: flex;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #edf0f2;
}

.tps-workspace-summary-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid #e7ebee;
    border-radius: 4px;
    background: #f9fafb;
}

.tps-workspace-summary-label {
    color: #7a8793;
    font-size: 11px;
    font-weight: 700;
}

.tps-workspace-summary-value {
    color: #2f4050;
    font-size: 14px;
}

.tps-detail-section {
    margin-top: 16px;
    border: 1px solid #e5e9ed;
    border-radius: 5px;
    background: #fff;
    overflow: hidden;
}

.tps-detail-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid #e5e9ed;
    background: #f8fafb;
}

.tps-detail-section-title {
    color: #34495e;
    font-size: 15px;
    font-weight: 700;
}

.tps-detail-section-subtitle {
    margin-top: 3px;
    color: #8b949c;
    font-size: 11px;
}

.tps-detail-section-body {
    padding: 12px;
}

.tps-row-clickable {
    cursor: pointer;
}

.tps-money {
    display: inline-block;
    direction: ltr;
    unicode-bidi: embed;
    font-weight: 700;
}

.tps-table-actions-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 3px;
}

.tps-inline-edit-row > td {
    background: #f8fbfe !important;
    border-top-color: #d9e8f3 !important;
    border-bottom-color: #d9e8f3 !important;
}

.tps-inline-edit-row .form-control,
.tps-inline-edit-row .select2-container {
    width: 100% !important;
    max-width: none !important;
}

.tps-inline-control {
    width: 100%;
}

.tps-inline-form {
    margin: 0;
}

.tps-inline-edit-actions {
    white-space: nowrap;
}

@media (max-width: 767px) {
    .tps-workspace-header {
        padding: 12px;
    }

    .tps-workspace-header-main {
        display: block;
    }

    .tps-workspace-actions {
        margin-top: 12px;
    }

        .tps-workspace-actions .btn {
            flex: 1 1 auto;
        }

    .tps-workspace-summary {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tps-workspace-summary-item {
        justify-content: space-between;
        min-width: 0;
    }

    .tps-detail-section-body {
        padding: 8px 0 0;
        background: #f7f8fa;
    }

    .tps-detail-section {
        border-left: 0;
        border-right: 0;
        border-radius: 0;
    }

    .tps-table-actions-inner {
        justify-content: flex-start;
    }

    .tps-table > tbody > tr.tps-inline-edit-row {
        border: 2px solid #bcd8ec;
    }

        .tps-table > tbody > tr.tps-inline-edit-row > td {
            display: block !important;
            padding: 10px 12px;
        }

            .tps-table > tbody > tr.tps-inline-edit-row > td::before {
                display: block;
                width: auto;
                margin: 0 0 6px;
                color: #63717c;
                text-align: start;
            }

            .tps-table > tbody > tr.tps-inline-edit-row > td.tps-mobile-title::before,
            .tps-table > tbody > tr.tps-inline-edit-row > td.tps-table-actions::before {
                display: none;
            }

            .tps-table > tbody > tr.tps-inline-edit-row > td.tps-table-actions {
                display: flex !important;
                gap: 6px;
            }

    .tps-inline-edit-actions .btn {
        flex: 1 1 auto;
    }
}

/* =========================================================
   Pattern A - List / Operations
   Generic TPS UI only
   ========================================================= */

.tps-summary {
    display: flex;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.tps-summary-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 1 190px;
    min-height: 42px;
    padding: 8px 11px;
    border: 1px solid #e5e9ed;
    border-radius: 4px;
    background: #f8fafb;
}

.tps-summary-label {
    color: #6f7a84;
    font-size: 12px;
    font-weight: 600;
}

.tps-summary-value {
    margin-inline-start: 12px;
    color: #2f4050;
    font-size: 17px;
    font-weight: 700;
}

.tps-status-warning {
    color: #8a6d3b;
    background: #fcf8e3;
}

.tps-loading {
    padding: 40px 15px;
    text-align: center;
    color: #8b949c;
}

    .tps-loading i {
        margin-bottom: 8px;
    }

.tps-operation-result {
    display: none;
    margin-bottom: 16px;
}

.tps-code-value {
    display: inline-block;
    direction: ltr;
    unicode-bidi: embed;
    max-width: 100%;
    font-family: Consolas, Menlo, Monaco, monospace;
    font-size: 11px;
    line-height: 1.4;
    text-align: left;
    word-break: break-all;
}

@media (max-width: 767px) {
    .tps-summary {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tps-summary-item {
        width: 100%;
        min-width: 0;
    }

        .tps-summary-item:first-child {
            grid-column: 1 / -1;
        }
}

/* =========================================================
   File Drop Zone
   Generic TPS UI only
   ========================================================= */

.tps-file-drop-zone {
    position: relative;
    min-height: 240px;
    overflow: hidden;
    border: 2px dashed #cbd3da;
    border-radius: 8px;
    background: #fafbfc;
    cursor: pointer;
    transition: border-color .2s ease, background-color .2s ease;
}

    .tps-file-drop-zone:hover,
    .tps-file-drop-zone:focus,
    .tps-file-drop-zone-active {
        border-color: #337ab7;
        background: #f4f9fc;
        outline: none;
    }

.tps-file-drop-zone-input {
    display: none !important;
}

.tps-file-drop-zone-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    min-height: 240px;
    padding: 25px;
    color: #7a8793;
    text-align: center;
}

.tps-file-drop-zone-empty-icon {
    margin-bottom: 10px;
    color: #aab4bc;
    font-size: 46px;
}

.tps-file-drop-zone-empty-title {
    margin-bottom: 5px;
    color: #46515b;
    font-size: 15px;
    font-weight: 700;
}

.tps-file-drop-zone-empty-subtitle {
    font-size: 12px;
}

.tps-file-drop-zone-preview {
    position: relative;
    min-height: 240px;
    background: #f3f5f6;
}

.tps-file-drop-zone-image {
    display: block;
    width: 100%;
    height: 320px;
    object-fit: contain;
}

.tps-file-drop-zone-actions {
    position: absolute;
    right: 12px;
    bottom: 12px;
    left: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

    .tps-file-drop-zone-actions .btn {
        min-height: 38px;
    }

.tps-file-drop-zone-status {
    min-height: 24px;
    padding: 8px 12px;
    color: #7a8793;
    font-size: 12px;
    text-align: center;
}

.tps-file-drop-zone-status-loading {
    color: #31708f;
}

.tps-file-drop-zone-status-success {
    color: #3c763d;
    font-weight: 700;
}

.tps-file-drop-zone-status-error {
    color: #a94442;
}

@media (max-width: 767px) {
    .tps-file-drop-zone,
    .tps-file-drop-zone-empty,
    .tps-file-drop-zone-preview {
        min-height: 210px;
    }

    .tps-file-drop-zone-image {
        height: 270px;
    }

    .tps-file-drop-zone-actions {
        right: 8px;
        bottom: 8px;
        left: 8px;
    }

        .tps-file-drop-zone-actions .btn {
            flex: 1 1 auto;
            min-height: 44px;
        }
}

.tps-file-drop-zone-file {
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    min-height: 240px;
    padding: 30px 20px 72px;
    color: #7a8793;
    text-align: center;
}

.tps-file-drop-zone-file-icon {
    margin-bottom: 10px;
    color: #c25b56;
    font-size: 58px;
}

.tps-file-drop-zone-file-name {
    max-width: 100%;
    color: #46515b;
    font-size: 13px;
    font-weight: 700;
    direction: ltr;
    word-break: break-all;
}

@media (max-width: 767px) {
    .tps-file-drop-zone-file {
        min-height: 210px;
        padding-bottom: 78px;
    }
}