/* Обрезка длинных комментариев в таблицах */
.comment-cell {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Можно добавить сюда свои стили позже (галерея, карточки и т.д.) */

/* === dropzone style === */
.upload-dropzone {
  border: 2px dashed #0d6efd33;
  border-radius: .75rem;
  background: #f8f9fa;
  padding: 1.5rem;
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.upload-dropzone.dragover {
  border-color: #0d6efd;
  background: #e7f1ff;
  box-shadow: 0 0 0 2px rgba(13,110,253,.15);
}
.drag-handle {
  cursor: grab;
  font-size: 1.2rem;
  line-height: 1;
  opacity: .6;
}
.drag-handle:hover {
  opacity: 1;
}
.row-drag-chosen {
  background-color: #e7f1ff !important;
}
.row-drag-ghost {
  opacity: .5;
}


/* === File table layout fix === */

/* фиксируем ширины столбцов */
table.table.file-table thead th:nth-child(1) { width: 26px; }
table.table.file-table thead th:nth-child(2) { width: 32px; }
table.table.file-table thead th:nth-child(3) { width: 90px; }   /* Тип */
table.table.file-table thead th:nth-child(4) { width: 180px; }  /* Файл */
table.table.file-table thead th:nth-child(5) { width: 200px; }  /* Название */
table.table.file-table thead th:nth-child(6) { width: 170px; }  /* Категория */
table.table.file-table thead th:nth-child(7) { width: 160px; }  /* Дата */
table.table.file-table thead th:nth-child(8) { width: 120px; }  /* Действия */

/* одинаковые шрифты */
table.table.file-table thead th,
table.table.file-table td {
    font-size: 13px !important;
    white-space: nowrap;
}

/* иконки в типе файла */
.file-type-icon {
    font-size: 13px !important;
    color: #333 !important;
}

/* категории в режиме readonly */
.file-cat-readonly {
    font-size: 13px !important;
    color: #555 !important;
}

/* фиксируем высоту строки */
table.table.file-table tbody tr {
    height: 58px;
}

/* фикс картинки в ячейках */
table.table.file-table img.photo-thumb {
    max-height: 60px !important;
    width: auto !important;
}

/* выравнивание кнопок действий */
table.table.file-table .text-end .btn {
    padding: 3px !important;
}

/* более строгие заголовки */
table.table.file-table thead th {
    background: #f5f5f5 !important;
    border-bottom: 1px solid #ddd !important;
    font-weight: 600 !important;
    color: #444 !important;
}

/* минималистичные иконки */
.drag-handle { opacity: .4 !important; }
.drag-handle:hover { opacity: 1 !important; }

/* select категории – одинаковая ширина */
.file-category-select {
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
}


/* === Table column layout (USPK FIX) === */

.file-table th.col-drag     { width: 26px !important; }
.file-table th.col-pin      { width: 32px !important; }
.file-table th.col-type     { width: 90px !important; }
.file-table th.col-file     { width: 180px !important; }
.file-table th.col-name     { width: 220px !important; }
.file-table th.col-cat      { width: 150px !important; }
.file-table th.col-date     { width: 150px !important; }
.file-table th.col-actions  { width: 120px !important; }

/* Принудительная таблица без растяжки DataTables */
.file-table {
  table-layout: fixed !important;
  width: 100% !important;
}

/* Текст не прыгает */
.file-table td,
.file-table th {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Фото */
.file-table img.photo-thumb {
  max-height: 72px !important;
  width: auto !important;
  border-radius: 8px;
}

/* Тип файла */
.file-type-icon {
  font-size: 13px;
  opacity: .7;
}

/* Строки */
.file-table tbody tr {
  height: 64px !important;
  transition: background .15s ease;
}
.file-table tbody tr:hover {
  background-color: #eef6ff !important;
}

/* Кнопки */
.file-table .btn {
  padding: 3px 6px !important;
}

/* === File block: GitLab style === */

.file-group-title {
    font-weight: 600;
    font-size: 17px;
    color: #1f1f1f;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 30px 0 10px;
}

.file-group-title .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    opacity: .9;
}

.dot-to     { background: #6a5acd; }
.dot-dtp    { background: #c92a2a; }
.dot-strah  { background: #e67700; }
.dot-other  { background: #868e96; }

.table thead th {
    background: #fafafa !important;
    font-weight: 600;
    color: #555;
    border-bottom: 1px solid #ddd;
}

.file-type-icon {
    font-size: 13px;
    color: #444;
    font-weight: 500;
}

.file-cat-readonly {
    font-size: 13px;
    color: #555;
}

.file-category-select {
    border-color: #ccc;
    font-size: 13px;
}

.drag-handle {
    opacity: .4;
    cursor: grab;
}

.drag-handle:hover {
    opacity: .8;
}

.file-action-btn i,
.btn-outline-secondary i,
.btn-outline-primary i,
.btn-outline-danger i {
    opacity: .6;
}

.file-action-btn i:hover,
.btn-outline-secondary i:hover,
.btn-outline-primary i:hover,
.btn-outline-danger i:hover {
    opacity: 1;
}


.dt-status-value {
  display: none;
}

/* === Стили для кнопок фильтра на главной (USPK) === */

.filter-panel {
  background: #f8f9fa;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid #e2e3e5;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.filter-row:last-child {
  margin-bottom: 0;
}

.filter-label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #6c757d;
  min-width: 80px;
}

.filter-controls {
  flex: 1;
  overflow-x: auto;
}

/* базовый вид "таблеток" для всех фильтров */
.filter-panel .btn {
  border-radius: 999px;
  font-weight: 500;
  padding: 0.28rem 0.9rem;
  font-size: 0.85rem;
  line-height: 1.2;
  white-space: nowrap;
  margin-right: .3rem;
  transition: background-color .12s ease, color .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.filter-panel .btn:last-child {
  margin-right: 0;
}

/* лёгкий hover для всех */
.filter-panel .btn:not(.active):hover {
  background-color: rgba(13,110,253,.04);
}

/* чуть толще рамка у "типов" и статусов */
#type-filter .btn,
#opr-filter .btn {
  border-width: 1.5px;
}

#status-filter .btn,
#osago-filter .btn {
  border-width: 1.7px;
}

/* активная кнопка – лёгкое свечение */
.filter-panel .btn.active {
  box-shadow: 0 0 0 0.14rem rgba(0,0,0,.08);
}

/* серые "Все ..." в каждой группе */
.filter-panel .btn-outline-secondary {
  color: #343a40;
  border-color: #adb5bd;
  background-color: #f1f3f5;
}

.filter-panel .btn-outline-secondary.active {
  background-color: #495057;
  border-color: #495057;
  color: #fff;
}

/* ТИП ТС + ОПР – корпоративный синий */
#type-filter .btn-outline-primary,
#opr-filter .btn-outline-primary {
  color: #0d6efd;
  border-color: #0d6efd;
  background-color: #ffffff;
}

#type-filter .btn-outline-primary.active,
#opr-filter .btn-outline-primary.active {
  background-color: #0d6efd;
  border-color: #0d6efd;
  color: #fff;
}

/* СТАТУС ТС – светофор */
#status-filter .btn-outline-success {
  color: #198754;
  border-color: #198754;
  background-color: #ffffff;
}
#status-filter .btn-outline-success.active {
  background-color: #198754;
  border-color: #198754;
  color: #fff;
}

#status-filter .btn-outline-warning {
  color: #d39e00;
  border-color: #ffc107;
  background-color: #ffffff;
}
#status-filter .btn-outline-warning.active {
  background-color: #ffc107;
  border-color: #ffc107;
  color: #212529;
}

#status-filter .btn-outline-danger {
  color: #dc3545;
  border-color: #dc3545;
  background-color: #ffffff;
}
#status-filter .btn-outline-danger.active {
  background-color: #dc3545;
  border-color: #dc3545;
  color: #fff;
}

/* ОСАГО – такой же светофор */
#osago-filter .btn-outline-success {
  color: #198754;
  border-color: #198754;
  background-color: #ffffff;
}
#osago-filter .btn-outline-success.active {
  background-color: #198754;
  border-color: #198754;
  color: #fff;
}

#osago-filter .btn-outline-danger {
  color: #dc3545;
  border-color: #dc3545;
  background-color: #ffffff;
}
#osago-filter .btn-outline-danger.active {
  background-color: #dc3545;
  border-color: #dc3545;
  color: #fff;
}

#osago-filter .btn-outline-warning {
  color: #d39e00;
  border-color: #ffc107;
  background-color: #ffffff;
}
#osago-filter .btn-outline-warning.active {
  background-color: #ffc107;
  border-color: #ffc107;
  color: #212529;
}

#osago-filter .btn-outline-dark {
  color: #212529;
  border-color: #343a40;
  background-color: #ffffff;
}
#osago-filter .btn-outline-dark.active {
  background-color: #212529;
  border-color: #212529;
  color: #fff;
}

/* адаптация под мобилу: убираем подписи слева, чтобы всё в один ряд влазило */
@media (max-width: 768px) {
  .filter-panel {
    padding: 0.5rem 0.75rem;
  }
  .filter-label {
    display: none;
  }
}



.navbar-brand-logo {
  height: 42px;   /* нормальный размер для десктопа */
  width: auto;
  border-radius: 50%; /* если хочешь идеально круглый вид */
}

/* чуть поменьше на мобильных */
@media (max-width: 575.98px) {
  .navbar-brand-logo {
    height: 34px;
  }
  .navbar-brand-text {
    font-size: 0.9rem;
  }
}

/* ===========================
   Дополнительные файлы ТС (desktop)
   =========================== */

.veh-files-card {
  margin-top: 0.5rem;
}

.veh-files-accordion .accordion-item {
  border: 0;
  border-top: 1px solid #e5e7eb;
}

.veh-files-accordion .accordion-item:first-child {
  border-top: 0;
}

.veh-files-accordion .accordion-button {
  padding: 0.35rem 0.75rem;
  background-color: transparent;
  font-size: 0.9rem;
}

.veh-files-accordion .accordion-button:not(.collapsed) {
  background-color: #f8f9fa;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.04);
}

.veh-files-accordion .accordion-button:focus {
  box-shadow: 0 0 0 0.12rem rgba(13,110,253,.25);
}

.veh-files-accordion .accordion-button .badge {
  border-radius: 999px;
}

/* Таблица файлов в карточке ТС — тот же стиль, что и раньше, но привязан к veh-file-table */

.veh-file-table {
  table-layout: fixed;
  width: 100%;
}

.veh-file-table th.col-drag     { width: 26px; }
.veh-file-table th.col-pin      { width: 32px; }
.veh-file-table th.col-type     { width: 90px; }
.veh-file-table th.col-file     { width: 180px; }
.veh-file-table th.col-name     { width: 220px; }
.veh-file-table th.col-cat      { width: 150px; }
.veh-file-table th.col-date     { width: 150px; }
.veh-file-table th.col-actions  { width: 120px; }

.veh-file-table thead th,
.veh-file-table td {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.veh-file-table thead th {
  background: #fafafa;
  border-bottom: 1px solid #ddd;
  font-weight: 600;
  color: #444;
}

.veh-file-table tbody tr {
  height: 64px;
  transition: background .15s ease;
}

.veh-file-table tbody tr:hover {
  background-color: #eef6ff;
}

.veh-file-table img.photo-thumb {
  max-height: 72px;
  width: auto;
  border-radius: 8px;
}

.veh-file-table .btn {
  padding: 3px 6px;
}

.file-type-icon {
  font-size: 13px;
  opacity: .7;
}

/* ===========================
   Галерея фото ТС (desktop)
   =========================== */

.veh-photo-gallery {
  margin-top: 1rem;
}

.veh-photo-gallery-inner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.veh-photo-strip {
  flex: 1 1 auto;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 0.25rem 0;
}

/* аккуратный скроллбар */
.veh-photo-strip::-webkit-scrollbar {
  height: 6px;
}
.veh-photo-strip::-webkit-scrollbar-track {
  background: transparent;
}
.veh-photo-strip::-webkit-scrollbar-thumb {
  background-color: rgba(148, 163, 184, 0.8);
  border-radius: 999px;
}

.veh-photo-item {
  flex: 0 0 auto;
  width: 220px;           /* фикс ширина карточки */
}

/* превью в галерее — фиксированный размер,
   чтобы не растягивались в оригинальное разрешение */
.veh-photo-gallery .veh-photo-thumb {
  display: block;
  width: 100%;            /* занимаем всю ширину .veh-photo-item */
  height: 140px;          /* фикс высота */
  object-fit: cover;      /* аккуратная обрезка */
  border-radius: 0.5rem;
  cursor: pointer;
}


.gallery-arrow {
  flex: 0 0 auto;
  border-radius: 999px;
}

.gallery-arrow:focus {
  box-shadow: 0 0 0 0.1rem rgba(13, 110, 253, 0.25);
}

/* на всякий случай прячем галерею, если кто-то уберёт d-none d-md-block */
@media (max-width: 767.98px) {
  .veh-photo-gallery {
    display: none !important;
  }
}

/* ===========================
   Site footer
   =========================== */

.site-footer {
  background-color: #f9fafb;
  font-size: 13px;
}

.site-footer .fw-semibold {
  font-size: 13px;
}

.site-footer i.bi {
  vertical-align: -0.12em;
}

@media (max-width: 767.98px) {
  .site-footer {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}

/* ===========================
   Заявки
   =========================== */

.upload-dropzone.drag-over {
  border-color: #0d6efd;
  background-color: #f0f8ff;
}

.upload-dropzone.is-uploading {
  opacity: 0.7;
  pointer-events: none;
}

/* ЯРКАЯ подсветка всей строки при успешном сохранении поля */
tr.row-updated {
  animation: reqRowFlash 0.9s;
}

@keyframes reqRowFlash {
  0%   { background-color: #fff3cd; }  /* жёлтый, как предупреждение */
  100% { background-color: inherit; }
}

/* И заметная подсветка самого изменённого поля */
.field-saved {
  background-color: #e6ffed !important;   /* нежно-зелёный фон */
  box-shadow: 0 0 0 2px #198754;          /* зелёная рамка */
}

/* Заявки ТМЦ — подсветка обновлённой строки */
tr.row-updated {
  animation: requestRowSavedFlash 0.8s ease-out;
}

@keyframes requestRowSavedFlash {
  0% {
    background-color: #fff3cd;
  }
  100% {
    background-color: inherit;
  }
}

/* Подсветка поля после сохранения */
.inline-edit.field-saved {
  box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.25);
  border-color: #198754;
}

/* Заявки — сортировка */
#requests-table th.sortable {
  white-space: nowrap;
  cursor: pointer;
}

#requests-table th.sortable .sort-link {
  color: inherit;
  text-decoration: none;
}

#requests-table th.sortable .sort-link:hover {
  text-decoration: underline;
}

#requests-table th.sortable.sorted::after {
  content: "▲";
  font-size: 0.7rem;
  opacity: 0.7;
  margin-left: 0.25rem;
}

#requests-table th.sortable.sorted.sorted-desc::after {
  content: "▼";
}

/* Зона дропа заявок */
#requests-upload {
  border: 2px dashed #ced4da;
  border-radius: 0.75rem;
  background-color: #f8f9fa;
  transition: border-color .15s ease, background-color .15s ease;
}

#requests-upload.is-dragover {
  border-color: #0d6efd;
  background-color: #e7f1ff;
}

#requests-upload.uploading {
  opacity: 0.6;
  pointer-events: none;
}


/* === Цветовое выделение места поставки === */

.dp-tag {
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.75rem;
    display: inline-block;
}

/* Ванкор — синий */
.dp-vankor {
    background: #dce8ff;
    color: #0b49a3;
}

/* Тагул — фиолетовый */
.dp-tagul {
    background: #efe0ff;
    color: #732d91;
}

/* Сузун — оранжевый */
.dp-suzun {
    background: #ffe8cc;
    color: #b85c00;
}

/* Ичеминка — зелёный */
.dp-icheminka {
    background: #e5f8e7;
    color: #2e8b57;
}
