body, .btn, .form-control {
    font-size : 0.9rem !important;
}

body::-webkit-scrollbar { width: 0; /* Chrome, Safari, Opera */ }

/* Стили для активного пункта меню */
.navbar-dark .navbar-nav .nav-link.active,
.navbar-dark .navbar-nav .nav-link:focus,
.navbar-dark .navbar-nav .nav-link:hover {
    color: white !important;
    /*font-weight: bold;*/
}

.card {
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.card-header {
    padding: 10px 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #ddd;
    font-weight: bold;
}

.card-body {
    padding: 15px;
}

.table-responsive {
    overflow-x: auto;
}

/* МЕНЮ НАВИГАЦИИ */
.navbar {
    padding: 0.5rem 1rem;
}

.login-form {
    background: #fff;
    padding: 30px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.container {
    margin-top: 20px;
}

.container.mt-4 {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.row {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.col, .col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12 {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

@media (min-width: 1200px) {
    .container, .container-lg, .container-md, .container-sm, .container-xl {
        max-width: 100% !important;
    }
}

/* styles for materials.php */
body {
	font-family: Arial, sans-serif;
	margin: 0;
	padding: 20px;
	background-color: #f5f5f5;
}

.container {
	max-width: 100%;
	overflow-x: auto;
}

.project-search {
	margin-bottom: 20px;
	display: flex;
	align-items: center;
}

.project-search input {
	width: 80%;
	max-width: 550px;
	padding: 10px;
	margin-right: 20px;
	font-size: 28px;
	font-family : pantone, helveticaneucyr, roboto;
	border: 0px solid #ddd;
	background-color: #f5f9fd;
	border-radius: 16px;
}

.search-results {
    position: absolute;
    z-index: 1000;
    /* width: 100%; */
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    background: white;
    display: none;
}

.search-results div {
	padding: 8px;
	cursor: pointer;
}

.search-results div:hover {
	background-color: #f0f0f0;
}

.materials-table {
	width: 100%;
	border-collapse: collapse;
	background-color: white;
	box-shadow: 0 1px 3px rgba(0,0,0,0.1);
	line-height: 0.9;
	font-size: 12px;
}

.materials-table th, .materials-table td {
	border: 1px solid #ddd;
	padding: 8px;
	text-align: left;
	position: relative;
}

.materials-table th {
	background-color: #f2f2f2;
	cursor: pointer;
	user-select: none;
}

.materials-table th:hover {
	background-color: #e6e6e6;
}

.materials-table tr:hover {
	background-color: #f9f9f9;
}

.materials-table td {
	/*height: 50px;*/
	vertical-align: middle;
}

.preview-image {
	max-height: 50px;
	max-width: 100px;
	cursor: pointer;
}

.payment-status {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 15px;
	font-size: 12px;
	text-align: center;
}

.not-paid {
	background-color: #e0e0e0;
}

.prepaid {
	background-color: #fff3cd;
}

.paid {
	background-color: #d4edda;
}

#add-material {
	border-radius: 100%;
}

.sort-icon {
	margin-left: 5px;
}

.hidden-column {
	display: none;
}

.column-toggle {
	cursor: pointer;
}

/* НАСТРОЙКА ОТОБРАЖЕНИЯ ТАБЛИЦЫ МАТЕРИАЛОВ */

.materials-table td img.preview-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: cover;
    display: block;
    margin: 0 auto;
}

.materials-table td.has-image {
    padding: 0 !important;
    text-align: center;
    vertical-align: middle;
}

.editable-image {
    padding: 0 !important;
    margin: 0 !important;
}

.materials-table td.non-editable {
    background-color: #f9f9f9;
    color: #555;
    cursor: default;
}

.materials-table tr:hover td.non-editable {
    background-color: #f0f0f0;
}

.materials-table th {
    position: relative;
   /* padding-right: 30px; /* Место для кнопок управления */
}

/* Стиль для кнопки сворачивания */
.collapse-toggle {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    cursor: pointer;
    z-index: 2;
    background: #ddd;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

/* Стиль для ресайз-хендла */
.resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    cursor: col-resize;
    z-index: 1;
}

/* Стили для свернутых столбцов */
.materials-table th.collapsed-column,
.materials-table td.collapsed-column {
    width: 10px !important;
    min-width: 10px !important;
    max-width: 10px !important;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.materials-table th.collapsed-column .sort-icon,
.materials-table th.collapsed-column .column-title {
    display: none;
}

.materials-table th.collapsed-column .collapse-toggle {
    right: 7px;
}

/* Фиксированные минимальные ширины для предотвращения "прыгания" */
.materials-table th, 
.materials-table td {
    /*min-width: 80px;*/
    transition: width 0.2s ease;
}

/* Стили для фильтров */
.filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 200px;
}

.filter-group label {
    margin-bottom: 5px;
    font-weight: bold;
}

/* Базовые ширины столбцов */
.materials-table th[data-column="4"], /* Наименование */
.materials-table td[data-column="4"],
.materials-table th[data-column="19"], /* Примечания */
.materials-table td[data-column="19"] {
    width: 350px;
    min-width: 350px;
    max-width: 350px;
    text-align: left;
    padding-left: 10px;
}

/* Выравнивание по левому краю с отступом */
.materials-table th[data-column="2"], /* Шифр */
.materials-table td[data-column="2"],
.materials-table th[data-column="3"], /* Помещение */
.materials-table td[data-column="3"] {
    text-align: left;
    padding-left: 10px;
}

/* Выравнивание по правому краю для "Итого" */
.materials-table th[data-column="15"], /* Итого */
.materials-table td[data-column="15"] {
    text-align: right;
    padding-right: 10px;
}

/* Выравнивание по центру для остальных столбцов */
.materials-table th:not([data-column="2"]):not([data-column="3"]):not([data-column="4"]):not([data-column="15"]):not([data-column="19"]),
.materials-table td:not([data-column="2"]):not([data-column="3"]):not([data-column="4"]):not([data-column="15"]):not([data-column="19"]) {
    text-align: center;
}

/* Особые настройки для некоторых столбцов */
.materials-table th[data-column="5"], /* Превью */
.materials-table td[data-column="5"] {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
}

.materials-table th[data-column="8"], /* Ед. */
.materials-table td[data-column="8"],
.materials-table th[data-column="9"], /* Кол-во */
.materials-table td[data-column="9"],
.materials-table th[data-column="10"], /* Запас % */
.materials-table td[data-column="10"],
.materials-table th[data-column="11"], /* Валюта */
.materials-table td[data-column="11"],
.materials-table th[data-column="14"], /* Скидка % */
.materials-table td[data-column="14"],
.materials-table th[data-column="17"], /* Оплата */
.materials-table td[data-column="17"] {
    width: 100px;
    min-width: 100px;
    max-width: 100px;
}

.materials-table th[data-column="12"], /* Цена */
.materials-table td[data-column="12"],
.materials-table th[data-column="13"], /* СМР */
.materials-table td[data-column="13"] {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
}

.nowrap {
    font-size: 12px;
    white-space: nowrap !important;
}

/* Minimal Apple-style Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    width: 400px;
    max-width: 90%;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}

.modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
    text-align: center;
    color: #333;
}

.close-btn {
    position: absolute;
    right: 16px;
    top: 16px;
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

/* Панель уведомлений в шапке: на всю высоту, без ограничения max-height */
#alertsModal .modal-body {
    max-height: none !important;
    padding: .75rem !important;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Minimal buttons */
.btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: #007AFF;
    color: white;
}

.btn-primary:hover {
    background: #0066CC;
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
}

.btn-secondary:hover {
    background: #e5e5e5;
}

.btn-info {
    background-color: #0dcaf0;
    color: black;
}

.alert-info {
    padding: 10px;
    background-color: #d1ecf1;
    color: #0c5460;
    border-radius: 4px;
}

.alert-danger {
    padding: 10px;
    background-color: #f8d7da;
    color: #721c24;
    border-radius: 4px;
}

/* Модальное окно для сверки оплаты */
#verificationModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#verificationModal.show {
    opacity: 1;
    visibility: visible;
}

#verificationModal .modal-content {
    width: 100%;
    max-width: 500px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
    margin: 20px;
}

#verificationModal.show .modal-content {
    transform: translateY(0);
}

#verificationModal .modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#verificationModal .modal-title {
    margin: 0;
    font-size: 1.25rem;
}

#verificationModal .close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    line-height: 1;
}

#verificationModal .close-btn:hover {
    color: #333;
}

#verificationModal .modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

#verificationModal .modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Дополнительные стили для таблицы в модальном окне */
#verificationModal table {
    width: 100%;
    border-collapse: collapse;
}

#verificationModal table th,
#verificationModal table td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

#verificationModal table th {
    font-weight: 500;
    background-color: #f8f9fa;
}

#verificationModal .bonus-check {
    margin: 0;
}