/*
 * MbanguPay internal view foundation.
 *
 * Otika remains the upstream visual baseline. This file only owns reusable
 * internal-portal adaptations that are not part of the Otika distribution.
 */

.portal-context {
    align-items: center;
    background: var(--mb-color-surface, #ffffff);
    border: 1px solid var(--mb-color-border, #e9ecef);
    border-left: 4px solid var(--mb-color-primary, #c43d14);
    border-radius: 0.35rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding: 0.85rem 1rem;
}

.portal-context__identity,
.portal-context__trail {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.portal-context__name {
    color: var(--mb-color-text, #343a40);
    font-weight: 700;
}

.portal-context__section,
.portal-context__trail {
    color: var(--mb-color-text-muted, #6c757d);
    font-size: 0.875rem;
}

.portal-context__trail a {
    color: var(--mb-color-primary, #c43d14);
}

.portal-context__trail a:hover,
.portal-context__trail a:focus-visible {
    color: var(--mb-color-primary-hover, #9f2f10);
}

.portal-context__trail a:focus-visible {
    border-radius: 2px;
    box-shadow: 0 0 0 3px var(--mb-color-focus-ring, rgba(196, 61, 20, 0.28));
    outline: 0;
}

.portal-context__trail span + span::before,
.portal-context__trail a + span::before {
    color: var(--mb-color-gray-400, #adb5bd);
    content: "/";
    margin-right: 0.45rem;
}

.internal-filter--compact {
    width: 130px;
}

.internal-table--full {
    width: 100%;
}

.internal-table__caption {
    caption-side: top !important;
}

.internal-table__amount {
    text-align: right;
}

.internal-panel--fill {
    height: calc(100% - 0.5rem);
}

.progress {
    background-color: var(--mb-color-gray-50, #f8f9fa);
    border: 1px solid var(--mb-color-gray-300, #ced4da);
    border-radius: 4px;
    height: 18px !important;
    overflow: hidden;
}

.progress-bar {
    font-size: 0.75rem;
    font-weight: 500;
    transition: width 0.6s ease;
}

.stats-card {
    background: var(--mb-color-gray-50, #f8f9fa);
    border-left: 3px solid var(--mb-color-brand-500, #ff6b35);
    border-radius: 5px;
    margin-bottom: 0.5rem;
    padding: 0.75rem;
}

.stats-card .stats-label {
    color: var(--mb-color-text-muted, #6c757d);
    font-size: 0.9rem;
}

.stats-card .stats-value {
    color: var(--mb-color-text, #343a40);
    font-size: 1.1rem;
    font-weight: 600;
}

.page-content .card {
    border: 1px solid var(--mb-color-border, #e9ecef);
    border-radius: 0.75rem;
    box-shadow: 0 0.125rem 0.5rem rgba(52, 57, 94, 0.06);
    overflow: hidden;
}

.page-content .card-header {
    padding: 1rem 1.25rem !important;
    border-bottom: 1px solid var(--mb-color-border, #e9ecef) !important;
    background: var(--mb-color-surface, #ffffff);
}

.page-content .card-header-action {
    width: 100%;
    margin: 0 !important;
    padding: 1.1rem 1.2rem;
    border: 1px solid var(--mb-color-border, #e9ecef);
    border-radius: 0.75rem;
    background: linear-gradient(180deg, #fffaf3 0%, #ffffff 100%);
}

.page-content .card-header-action .form-inline {
    width: 100%;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
}

.page-content .form-group {
    margin: 0 !important;
    min-width: 200px;
    flex: 0 0 auto;
}

.page-content .form-group > div:first-child {
    margin-bottom: 0.35rem;
    color: var(--mb-color-text-muted, #6c757d);
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.page-content .page-content__action-spacer {
    color: transparent;
    user-select: none;
}

.page-content .card-header-action .form-control,
.page-content .card-header-action .custom-select {
    width: 100%;
    min-width: 200px;
    min-height: 2.75rem;
    border: 1px solid var(--mb-color-border, #e9ecef);
    border-radius: 0.75rem;
    background: var(--mb-color-surface, #ffffff);
    color: var(--mb-color-text, #343a40);
    box-shadow: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.page-content .card-header-action .form-control:focus,
.page-content .card-header-action .custom-select:focus {
    border-color: var(--mb-color-primary, #c43d14);
    box-shadow: 0 0 0 0.2rem rgba(196, 61, 20, 0.14);
    background: var(--mb-color-surface, #ffffff);
}

.page-content .card-header-action .btn {
    margin-top: 0;
}

.page-content .card-header-action .select2-container {
    width: 100% !important;
    min-width: 200px;
}

.page-content .card-header-action .select2-selection {
    height: calc(1.5em + 1.25rem + 2px) !important;
    border: 1px solid var(--mb-color-border, #e9ecef) !important;
    border-radius: 0.75rem !important;
}

.page-content .card-header-action .select2-selection__rendered {
    line-height: calc(1.5em + 1.2rem) !important;
    padding-left: 0.75rem !important;
}

.page-content .card-header-action .select2-selection__arrow {
    height: calc(1.5em + 1.2rem) !important;
}

/*
 * Product Shell legacy table normalization.
 *
 * A large part of the School portal still renders CI3/Bootstrap tables
 * (`table table-striped table-hover`). The Product Shell must present these
 * tables with the same visual contract as the newer page-frame tables, even
 * before each view is fully rewritten.
 */

.product-shell__main .table-responsive {
    width: 100%;
    overflow-x: auto;
}

.product-shell__main table.table,
.product-shell__main table.display,
.product-shell__main table.school-fee-create__schedule-table {
    width: 100%;
    min-width: 54rem;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
    background: transparent;
}

.product-shell__main table.table thead th,
.product-shell__main table.display thead th {
    color: var(--mb-color-text-muted, #6c757d);
    background: var(--mb-color-gray-50, #f8f9fa);
    border-bottom: 1px solid var(--mb-color-border, #e9ecef);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.product-shell__main table.table th,
.product-shell__main table.table td,
.product-shell__main table.display th,
.product-shell__main table.display td {
    padding: 0.85rem 0.9rem;
    vertical-align: middle;
    border-top: 0;
    border-bottom: 1px solid var(--mb-color-border, #e9ecef);
    background: transparent;
}

.product-shell__main table.table tbody tr:last-child td,
.product-shell__main table.display tbody tr:last-child td {
    border-bottom: 0;
}

.product-shell__main table.table tbody tr:hover td,
.product-shell__main table.display tbody tr:hover td {
    background: rgba(255, 91, 46, 0.04);
}

.product-shell__main table.table a,
.product-shell__main table.display a {
    color: var(--mb-color-primary-hover, #9f2f10);
    font-weight: 700;
}

.product-shell__main .dataTables_wrapper {
    margin: 0;
    padding: 0;
}

.product-shell__main .dataTables_wrapper .row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    margin-left: 0;
    margin-right: 0;
}

.product-shell__main .dataTables_wrapper .row > [class*="col-"] {
    width: auto;
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
}

.product-shell__main .dataTables_wrapper .dataTables_length,
.product-shell__main .dataTables_wrapper .dataTables_filter,
.product-shell__main .dataTables_wrapper .dt-buttons,
.product-shell__main .dataTables_wrapper .dataTables_info,
.product-shell__main .dataTables_wrapper .dataTables_paginate {
    color: var(--mb-color-text-muted, #6c757d);
    font-size: 0.875rem;
}

.product-shell__main .dataTables_wrapper .dataTables_length,
.product-shell__main .dataTables_wrapper .dataTables_filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: auto;
}

.product-shell__main .dataTables_wrapper .dt-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: auto;
}

.product-shell__main .dataTables_wrapper .dataTables_length select,
.product-shell__main .dataTables_wrapper .dataTables_filter input {
    min-height: 2.25rem;
    border: 1px solid var(--mb-color-border, #e9ecef);
    border-radius: 0.5rem;
    background: var(--mb-color-surface, #ffffff);
    color: var(--mb-color-text, #343a40);
    padding: 0 0.875rem;
    box-shadow: none;
}

.product-shell__main .dataTables_wrapper .dt-buttons .btn,
.product-shell__main .dataTables_wrapper .dt-buttons button,
.product-shell__main .mb-component-data-table__header-actions .btn,
.product-shell__main .mb-component-data-table__header-actions button {
    min-height: 2.1rem;
    border-radius: 0.5rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
}

.product-shell__main .dataTables_wrapper .dataTables_filter input {
    min-width: 16rem;
}

.product-shell__main .dataTables_wrapper .dataTables_paginate {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.35rem;
}

.product-shell__main .dataTables_wrapper .dataTables_paginate .paginate_button {
    min-width: 2.4rem;
    min-height: 2.4rem;
    margin: 0 !important;
    padding: 0.45rem 0.8rem !important;
    border: 1px solid var(--mb-color-border, #e9ecef) !important;
    background: var(--mb-color-surface, #ffffff) !important;
    color: var(--mb-color-text, #343a40) !important;
    border-radius: 999px !important;
}

.product-shell__main .dataTables_wrapper .dataTables_paginate .paginate_button.current,
.product-shell__main .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover,
.product-shell__main .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    border-color: rgba(196, 61, 20, 0.18) !important;
    background: rgba(255, 145, 77, 0.12) !important;
    color: var(--mb-color-primary-hover, #9f2f10) !important;
}

.product-shell__main .dataTables_wrapper .dataTables_info {
    padding-top: 0;
}

.product-shell__main .admin-eleves-table-surface {
    width: 100%;
}

.product-shell__main .admin-eleves-table-surface #tableEleves_wrapper {
    width: 100%;
}

.product-shell__main .admin-eleves-table-surface #tableEleves_wrapper > .row:first-child {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin: 0;
}

.product-shell__main .admin-eleves-table-surface #tableEleves_wrapper > .row:first-child > .col-sm-12,
.product-shell__main .admin-eleves-table-surface #tableEleves_wrapper > .row:first-child > .col-sm-6,
.product-shell__main .admin-eleves-table-surface #tableEleves_wrapper > .row:first-child > [class*="col-"] {
    width: auto;
    max-width: 100%;
    flex: 0 1 auto;
    padding-left: 0;
    padding-right: 0;
}

.product-shell__main .admin-eleves-table-surface #tableEleves_wrapper .dataTables_length,
.product-shell__main .admin-eleves-table-surface #tableEleves_wrapper .dt-buttons,
.product-shell__main .admin-eleves-table-surface #tableEleves_wrapper .dataTables_filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.product-shell__main .admin-eleves-table-surface #tableEleves_wrapper .dt-buttons {
    margin-right: auto;
}

.product-shell__main .admin-eleves-table-surface #tableEleves_wrapper > .row:first-child > .dataTables_filter,
.product-shell__main .admin-eleves-table-surface #tableEleves_wrapper > .row:first-child > [class*="col-sm-"] {
    margin-left: auto;
}

.product-shell__main .admin-eleves-table-surface #tableEleves_wrapper > .row:last-child {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem 1rem;
    margin: 0;
}

.product-shell__main .admin-eleves-table-surface #tableEleves_wrapper .dt-buttons .btn,
.product-shell__main .admin-eleves-table-surface #tableEleves_wrapper .dt-buttons button,
.product-shell__main .admin-eleves-table-surface #tableEleves_wrapper .dt-buttons .btn-group > .btn,
.product-shell__main .admin-eleves-table-surface #tableEleves_wrapper .dt-buttons .btn-group > button {
    min-height: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    padding: 0.25rem 0.6rem;
    font-size: 0.77rem;
    line-height: 1.1;
}

.product-shell__main .admin-eleves-table-surface #tableEleves_wrapper .dt-buttons .btn + .btn,
.product-shell__main .admin-eleves-table-surface #tableEleves_wrapper .btn-group > .btn + .btn,
.product-shell__main .admin-eleves-table-surface #tableEleves_wrapper .dt-buttons .btn-group > button + button {
    margin-left: 0.4rem;
}

.product-shell__main .admin-eleves-table-surface #tableEleves_wrapper .dataTables_filter {
    justify-content: flex-end;
    margin-left: auto;
}

.product-shell__main .admin-eleves-table-surface #tableEleves_wrapper .dataTables_filter input {
    min-width: 14rem;
}

.product-shell__main .admin-eleves-table-surface #tableEleves_wrapper .dataTables_paginate {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.35rem;
}

.product-shell__main .admin-eleves-table-surface #tableEleves_wrapper .dataTables_info,
.product-shell__main .admin-eleves-table-surface #tableEleves_wrapper .dataTables_paginate {
    margin-top: 0.5rem;
}

.product-shell__main .admin-eleves-table-surface .table-responsive {
    margin: 0;
}

@media (max-width: 575.98px) {
    .portal-context {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.5rem;
    }

    .internal-filter--compact {
        width: 100%;
    }

    .product-shell__main table.table,
    .product-shell__main table.display,
    .product-shell__main table.school-fee-create__schedule-table {
        min-width: 42rem;
    }

    .product-shell__main .dataTables_wrapper .dataTables_filter input {
        min-width: 100%;
    }

    .product-shell__main .admin-eleves-table-surface #tableEleves_wrapper .dataTables_filter input {
        min-width: 100%;
    }

    .product-shell__main .admin-eleves-table-surface #tableEleves_wrapper > .row:first-child,
    .product-shell__main .admin-eleves-table-surface #tableEleves_wrapper > .row:last-child {
        display: grid;
        gap: 0.6rem;
    }
}
