/**
 * Временные алиасы Bootstrap 4 → 5 для страниц, ещё не переведённых на BS5.
 * Удалять по мере правки Blade-модулей.
 */
.ml-1 { margin-left: 0.25rem !important; }
.ml-2 { margin-left: 0.5rem !important; }
.ml-3 { margin-left: 1rem !important; }
.ml-auto { margin-left: auto !important; }
.mr-1 { margin-right: 0.25rem !important; }
.mr-2 { margin-right: 0.5rem !important; }
.mr-3 { margin-right: 1rem !important; }
.mr-auto { margin-right: auto !important; }
.pl-1 { padding-left: 0.25rem !important; }
.pl-2 { padding-left: 0.5rem !important; }
.pr-1 { padding-right: 0.25rem !important; }
.pr-2 { padding-right: 0.5rem !important; }
.float-left { float: left !important; }
.float-right { float: right !important; }
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }
.font-weight-bold { font-weight: 700 !important; }
.font-weight-normal { font-weight: 400 !important; }
.form-group { margin-bottom: 1rem; }
.input-group-append,
.input-group-prepend { display: flex; }
.input-group-append .btn,
.input-group-append .input-group-text {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}
.input-group-prepend .btn,
.input-group-prepend .input-group-text {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.badge-primary { background-color: var(--bs-primary) !important; color: #fff !important; }
.badge-secondary { background-color: var(--bs-secondary) !important; color: #fff !important; }
.badge-success { background-color: var(--bs-success) !important; color: #fff !important; }
.badge-danger { background-color: var(--bs-danger) !important; color: #fff !important; }
.badge-warning { background-color: var(--bs-warning) !important; color: #212529 !important; }
.badge-info { background-color: var(--bs-info) !important; color: #fff !important; }
.close { box-sizing: content-box; width: 1em; height: 1em; padding: 0.25em; border: 0; border-radius: 0.25rem; opacity: 0.5; background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat; }
.close:hover { opacity: 0.75; }
.btn-block { display: block; width: 100%; }
select.custom-select,
.custom-select {
    display: block;
    width: 100%;
    padding: 0.375rem 2.25rem 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--bs-body-color);
    background-color: var(--bs-body-bg);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    border: var(--bs-border-width) solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    appearance: none;
}
.icheck-primary {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}
.icheck-primary input[type="checkbox"] {
    margin-top: 0.2rem;
    flex-shrink: 0;
}
.btn-default {
    color: var(--bs-body-color);
    background-color: var(--bs-secondary-bg);
    border-color: var(--bs-border-color);
}
.btn-default:hover {
    color: var(--bs-body-color);
    background-color: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
}
.btn-flat {
    border-radius: 0;
    box-shadow: none;
}
.modal .btn-close,
.modal-header .close {
    padding: calc(var(--bs-modal-header-padding-y) * 0.5) calc(var(--bs-modal-header-padding-x) * 0.5);
}
.card-widget.collapsed-card .card-body,
.card.collapsed-card .card-body {
    display: none;
}

/* Expandable table (бывш. AdminLTE 3 data-widget) */
[data-widget="expandable-table"] {
    cursor: pointer;
}
[data-widget="expandable-table"] i.expandable-table-caret {
    transition: transform 0.3s linear;
}
[data-widget="expandable-table"][aria-expanded="true"] td i.expandable-table-caret[class*="right"] {
    transform: rotate(90deg);
}
.table-hover tbody tr.expandable-body:hover {
    background-color: inherit !important;
}
.expandable-body > td {
    padding: 0 !important;
    width: 100%;
}

/* Todo list (manage-access) */
.todo-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.todo-list > li {
    border-radius: 2px;
    padding: 10px;
    background: var(--bs-secondary-bg);
    margin-bottom: 2px;
    border-left: 2px solid var(--bs-border-color);
    color: var(--bs-body-color);
}
.todo-list > li .tools {
    display: none;
    float: right;
}
.todo-list > li:hover .tools {
    display: inline-block;
}
.todo-list .handle {
    display: inline-block;
    cursor: move;
    margin: 0 5px;
}

/* DataTables (интеграция bootstrap4) на странице с BS5 */
div.dataTables_wrapper div.dataTables_length select.form-select {
    display: inline-block;
    width: auto;
    vertical-align: middle;
}
div.dataTables_wrapper div.dataTables_filter input.form-control {
    display: inline-block;
    width: auto;
}
div.dataTables_wrapper .page-item.active .page-link {
    z-index: 1;
}
table.dataTable.table-bordered {
    border: 1px solid var(--bs-border-color);
}
table.dataTable thead th,
table.dataTable thead td {
    border-bottom-color: var(--bs-border-color);
}
div.dataTables_wrapper div.dataTables_info {
    padding-top: 0.75rem;
}

/* custom-file → BS5 */
.custom-file,
.custom-file-input,
.custom-file-label {
    display: block;
    width: 100%;
}
.custom-file-input {
    height: calc(1.5em + 0.75rem + 2px);
}

/* card-* (AdminLTE 3 на BS5 / AdminLTE 4) */
.card.card-primary:not(.card-outline) > .card-header {
    background-color: var(--bs-primary);
    color: #fff;
}
.card.card-primary:not(.card-outline) > .card-header .card-title,
.card.card-primary:not(.card-outline) > .card-header a {
    color: #fff;
}
.card.card-success:not(.card-outline) > .card-header {
    background-color: var(--bs-success);
    color: #fff;
}
.card.card-danger:not(.card-outline) > .card-header {
    background-color: var(--bs-danger);
    color: #fff;
}
.card.card-info:not(.card-outline) > .card-header {
    background-color: var(--bs-info);
    color: #fff;
}
.card.card-outline {
    border-top: 3px solid var(--bs-border-color);
}
.card.card-outline.card-primary {
    border-top-color: var(--bs-primary);
}
.card.card-outline.card-success {
    border-top-color: var(--bs-success);
}
.card.card-outline.card-danger {
    border-top-color: var(--bs-danger);
}
.card.card-outline.card-info,
.card.card-outline.card-secondary {
    border-top-color: var(--bs-info);
}
.card.collapsed-card .card-body,
.card.collapsed-card .card-footer {
    display: none;
}

/* AdminLTE 3 custom-switch (красный OFF / зелёный ON) — разметка BS4 на layout AdminLTE 4 */
.custom-control.custom-switch {
    position: relative;
    z-index: 1;
    display: block;
    min-height: 1.5rem;
    padding-left: 2.25rem;
}

.custom-control.custom-switch .custom-control-input {
    position: absolute;
    left: 0;
    z-index: -1;
    width: 1rem;
    height: 1.25rem;
    opacity: 0;
}

.custom-control.custom-switch .custom-control-label {
    position: relative;
    margin-bottom: 0;
    vertical-align: top;
    cursor: pointer;
}

.custom-control.custom-switch .custom-control-label::before {
    position: absolute;
    top: 0.25rem;
    left: -2.25rem;
    display: block;
    width: 1.75rem;
    height: 1rem;
    pointer-events: all;
    content: "";
    background-color: #dee2e6;
    border: #adb5bd solid 1px;
    border-radius: 0.5rem;
    box-shadow: inset 0 0.1rem 0.15rem rgba(0, 0, 0, 0.08);
}

.custom-control.custom-switch .custom-control-label::after {
    position: absolute;
    top: calc(0.25rem + 2px);
    left: calc(-2.25rem + 2px);
    display: block;
    width: calc(1rem - 4px);
    height: calc(1rem - 4px);
    content: "";
    background-color: #adb5bd;
    border-radius: 0.5rem;
    transition: transform 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

.custom-control.custom-switch .custom-control-input:checked ~ .custom-control-label::after {
    transform: translateX(0.75rem);
}

.custom-switch.custom-switch-off-danger .custom-control-input ~ .custom-control-label::before {
    background-color: #dc3545;
    border-color: #921925;
}

.custom-switch.custom-switch-off-danger .custom-control-input:focus ~ .custom-control-label::before {
    box-shadow: 0 0 0 1px #fff, 0 0 0 2px rgba(220, 53, 69, 0.25);
}

.custom-switch.custom-switch-off-danger .custom-control-input ~ .custom-control-label::after {
    background-color: #7c151f;
}

.custom-switch.custom-switch-on-success .custom-control-input:checked ~ .custom-control-label::before {
    background-color: #28a745;
    border-color: #145523;
}

.custom-switch.custom-switch-on-success .custom-control-input:checked:focus ~ .custom-control-label::before {
    box-shadow: 0 0 0 1px #fff, 0 0 0 2px rgba(40, 167, 69, 0.25);
}

.custom-switch.custom-switch-on-success .custom-control-input:checked ~ .custom-control-label::after {
    background-color: #86e29b;
}
