/* ----------------- БАЗОВЫЕ СТИЛИ ------------------ */
html, body {
    height: 100%;
    min-height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    box-sizing: border-box;
}

/* Убедимся, что всё масштабируется правильно */
*,
*::before,
*::after {
    box-sizing: inherit;
}

/* Контейнер — не выходит за ширину */
.container,
.container-fluid {
    max-width: 100%;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* Карточки на всю ширину */
.card {
    width: 100%;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 6px rgb(0 0 0 / 0.15);
    transition: transform 0.2s ease;
}
/*.card:hover {
  transform: translateY(0px);
}*/
.card i {
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 3rem;
    opacity: 0.25;
}

/* Все input'ы, select'ы и кнопки — на 100% */
form input,
form select,
form button {
    width: 100%;
    display: block;
    margin-bottom: 0.5rem;
    box-sizing: border-box;
}
/*form .btn {
    width: 100%;
}*/
form input[type="number"],
form input[type="date"],
form select,
form button {
    width: 100%;
}

/* Чтобы форма оплаты не растягивалась на больших экранах */
form.mb-4 > .row > div:first-child {
    max-width: 200px;
}

/* Кнопка в форме добавления */
form.mb-5 .btn {
    min-width: 60px;
}

/* ----------------- LAYOUT ------------------ */
main, #appWrapper {
    overflow-x: hidden;
    overflow-y: auto;
}

/* ----------------- SIDEBAR ------------------ */
#sidebarMenu, .sidebar, #sidebar {
    width: 240px;
    transition: width 0.3s ease;
    background-color: #343a40;
    padding: 0;
    color: white;
    z-index: 1000;
    position: fixed;
    top: 56px;
    bottom: 0;
    left: 0;
    height: calc(100vh - 56px);
    overflow-y: auto;
}
#sidebarMenu.collapsed,
.sidebar.collapsed,
#sidebar.collapsed {
    width: 70px;
}
.sidebar .title {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.75rem 1rem;
    color: #adb5bd;
    border-bottom: 1px solid #495057;
    text-transform: uppercase;
}
.sidebar .nav-link {
    position: relative;
    padding: 0.75rem 1rem 0.75rem 1.25rem;
    color: #adb5bd;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-radius: 0;
    width: 100%;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background-color: #495057;
    color: white;
}
.sidebar .nav-link i {
    width: 20px;
    min-width: 20px;
    text-align: center;
}
.sidebar .nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background-color: #0d6efd;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.sidebar .nav-link:hover::before,
.sidebar .nav-link.active::before {
    opacity: 1;
}
.sidebar .link-text {
    transition: opacity 0.2s ease;
}
.sidebar.collapsed .link-text {
    opacity: 0;
    visibility: hidden;
    width: 0;
}

/* ----------------- MAIN CONTENT ------------------ */
#mainContent {
    overflow-y: auto;
    min-height: calc(100vh - 56px);
    margin-left: 240px;
    transition: margin-left 0.3s ease;
    max-height: none !important;
}
#layoutWrapper[data-collapsed="true"] #mainContent,
.sidebar.collapsed + #mainContent {
    margin-left: 70px;
}
#layoutWrapper {
    display: flex;
    min-height: 100vh;
    flex-direction: row;
}

/* ----------------- NAVBAR ------------------ */
.navbar {
    height: 56px;
}
.navbar.fixed-top {
    left: 0;
    right: 0;
    width: 100vw;
    z-index: 1030;
}

/* ----------------- TABLE ------------------ */
.table {
    font-size: 0.9rem;
}
.table thead th {
    vertical-align: middle;
    text-align: center;
}
.table tbody td {
    vertical-align: middle;
    text-align: center;
    white-space: nowrap;
}
.table .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;

}

/* ----------------- МОДАЛКА ------------------ */
.modal-dialog-scrollable .modal-body {
    max-height: 60vh;
    overflow-y: auto;
}

/* ----------------- FLEX-КОНТЕЙНЕР ------------------ */
.d-flex.flex-wrap {
    gap: 0.5rem;
}

/* ----------------- АДАПТИВНОСТЬ ------------------ */
@media (max-width: 991.98px) {
    #sidebarMenu, .sidebar, #sidebar {
        position: absolute;
        top: 56px;
        left: -240px;
        width: 240px !important;
        height: calc(100vh - 56px);
        transition: left 0.3s ease, transform 0.3s ease-in-out;
        z-index: 1050;
        background-color: #343a40;
        padding: 0;
        flex-shrink: 0;
    }
    #sidebarMenu.mobile-open,
    .sidebar.show {
        left: 0;
        transform: translateX(0);
    }
    #sidebarMenu:not(.mobile-open),
    .sidebar:not(.show) {
        transform: translateX(-100%);
    }
    #mainContent {
        margin-left: 0 !important;
    }
    #mainContent.overlay {
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.3);
        z-index: 1040;
    }
}
@media (max-width: 768px) {
    .navbar {
        height: 80px;
    }
    #sidebarMenu, .sidebar {
        height: calc(100vh - 80px);
        top: 80px;
    }
    #mainContent.overlay {
        top: 80px;
    }
    .row {
        display: flex;
        flex-wrap: wrap;
    }
    form .col,
    form .col-6,
    form .col-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    form.mb-4 .row > div {
        max-width: 100% !important;
    }
}
@media (max-width: 575.98px) {
    .card h5 {
        font-size: 1rem;
    }
    .card p.h4 {
        font-size: 1.5rem;
    }
    button.btn-sm {
        white-space: nowrap;
    }
}
