/* static/css/procurement.css
   ВАЖНО:
   - Этот файл НЕ должен ломать select2 bootstrap4 theme.
   - НИКАКИХ общих правил вида ".select2-container .select2-selection..." здесь нет.
   - Все select2-настройки живут только в custom.css (единый блок).
*/

/* =========================================================
   Таблица тендеров
========================================================= */

/* центрирование всего, кроме предмета */
.table.tenders-table th,
.table.tenders-table td {
  vertical-align: middle;
  text-align: center;
}

/* шапка всегда в одну строку */
.table.tenders-table thead th {
  white-space: nowrap;
}

/* предмет тендера: слева + одна строка с троеточием */
.table.tenders-table td.td-subject {
  text-align: left;
}

.table.tenders-table a.subject-link {
  display: inline-block;
  max-width: 720px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

/* колонки с датами — центр + без переноса */
.table.tenders-table td.td-date {
  text-align: center !important;
  white-space: nowrap;
  padding-right: 0.5rem !important;
}

/* бейджи статуса */
.table.tenders-table .badge {
  white-space: nowrap;
}

/* узкие служебные колонки; колонка Действия — по центру, без лишних отступов */
.table.tenders-table td.td-actions,
.table.tenders-table th.th-actions,
.table.tenders-table td.td-count,
.table.tenders-table th.th-count {
  white-space: nowrap;
  width: 1%;
}
.table.tenders-table th.th-actions {
  text-align: center !important;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}
.table.tenders-table td.td-actions {
  text-align: center !important;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}

/* три колонки без переноса */
.table.tenders-table td.td-type,
.table.tenders-table td.td-org,
.table.tenders-table td.td-subject {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* тип/организация — ограничение ширины */
.table.tenders-table td.td-type { max-width: 180px; }
.table.tenders-table td.td-org  { max-width: 260px; }

/* не ломать слова */
.table.tenders-table td.td-type,
.table.tenders-table td.td-org,
.table.tenders-table td.td-subject,
.table.tenders-table a.subject-link {
  word-break: normal;
  overflow-wrap: normal;
}

/* =========================================================
   Dropzone / Файлы (компактный стиль как у вас)
========================================================= */

.dz-wrap {
  background: #f8fafc;
  border: 1px solid #e0e6ef;
  border-radius: 0.5rem;
  padding: 0.6rem;
  text-align: center;
}

.dz-wrap .dz-message {
  color: #6c757d;
  font-size: 0.82rem;
  margin: 0;
  line-height: 1.4;
}

.file-section-title {
  font-weight: 600;
  margin: 0.3rem 0 0.25rem;
  font-size: 0.82rem;
}

.file-row {
  display: flex;
  align-items: center;
  background: #f9fafb;
  border: 1px solid #e2e6ec;
  border-radius: 0.5rem;
  padding: 0.35rem 0.5rem;
  margin-bottom: 0.3rem;
  font-size: 0.82rem;
}

.file-row .icon {
  width: 22px;
  text-align: center;
  margin-right: 0.4rem;
  font-size: 0.85rem;
}

.file-row .name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.file-row .meta {
  color: #6c757d;
  font-size: 0.78rem;
  margin-left: 0.5rem;
  white-space: nowrap;
}

.file-row .actions {
  margin-left: 0.4rem;
  white-space: nowrap;
}

.file-row.opacity-50 {
  opacity: 0.55;
}

.form-actions {
  padding: 0.5rem 0.7rem;
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 0.4rem;
  font-size: 0.82rem;
}

.form-actions .btn {
  font-size: 0.82rem;
  padding: 0.35rem 0.6rem;
}

.form-control[readonly] {
  background-color: #fff;
  opacity: 1;
}

/* =========================================================
   Унифицированный “tiny-file” стиль (tf-*)
========================================================= */

.tf { font-size: .85rem; }
.tf-sec { font-weight: 600; font-size: .82rem; margin: .5rem 0 .35rem; color: #111827; }

.tf-item {
  display: flex;
  align-items: flex-start;
  background: #f8fafc;
  border: 1px solid #e5eaf2;
  border-radius: .55rem;
  padding: .45rem .6rem;
  margin-bottom: .45rem;
}

.tf-ico { width: 22px; margin-right: .5rem; line-height: 1; font-size: .9rem; text-align: center; }

.tf-name { flex: 1; min-width: 0; }

.tf-name a {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  vertical-align: bottom;
}

.tf-meta { color: #6b7280; font-size: .78rem; margin-top: .2rem; }
.tf-act { margin-left: .6rem; white-space: nowrap; }

.tf-btn {
  border: 1px solid #e5eaf2;
  background: #fff;
  border-radius: .5rem;
  padding: .3rem .45rem;
}

.tf-pending { opacity: .6; border-style: dashed; }

.tf-badge {
  display: inline-block;
  font-size: .72rem;
  color: #92400e;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: .4rem;
  padding: .05rem .35rem;
  margin-left: .4rem;
  vertical-align: middle;
}

/* =========================================================
   Модалка организаций — сетка/гаттеры
========================================================= */

#addOrgModal .modal-dialog { max-width: 760px; }
#addOrgModal .modal-content { overflow-x: hidden; }

#addOrgPanel .card-body { --gutter: .5rem; }

#addOrgPanel .row {
  margin-left: calc(var(--gutter) * -1);
  margin-right: calc(var(--gutter) * -1);
}

#addOrgPanel .row > [class^="col-"],
#addOrgPanel .row > [class*=" col-"] {
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

#addOrgPanel .form-control {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

#addOrgPanel .btn { white-space: nowrap; }

@media (max-width: 768px){
  #addOrgModal .modal-dialog { max-width: 95%; margin: .5rem auto; }
}

#addOrgPanel #btnCheckInn {
  height: calc(1.5rem + 2px);
  line-height: 1.25;
}

/* =========================================================
   Карточки кандидатов
========================================================= */

.cand-card {
  border: 1px solid #e2e6ec;
  border-radius: .5rem;
  background: #fff;
  margin-bottom: .4rem;
  padding: .45rem .55rem;
}

.cand-head { display: flex; align-items: center; justify-content: space-between; }
.cand-title { font-weight: 600; font-size: .9rem; margin: 0; }
.cand-meta { color: #6c757d; font-size: .78rem; margin-top: .15rem; }

.cand-badge {
  display: inline-block;
  background: #eef2f7;
  color: #334155;
  border: 1px solid #d8dee9;
  border-radius: .375rem;
  padding: .05rem .4rem;
  font-size: .72rem;
  margin-right: .4rem;
}

.cand-actions .btn { padding: .15rem .4rem; font-size: .75rem; }
.cand-removed { opacity: .55; background: #fbfbfb; }

/* =========================================================
   Компактные dropzone-блоки (dz-sm / dz-box)
========================================================= */

.dz-wrap.dz-sm {
  min-height: 90px;
  padding: 8px;
  border: 1px dashed #c7cdd6;
  border-radius: .25rem;
  background: #fafbfc;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.dz-wrap .dz-preview { margin: .25rem; }

.dz-box {
  min-height: 66px;
  padding: 8px 10px;
  border: 1px dashed #c7cdd6;
  border-radius: .25rem;
  background: #fafbfc;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.dz-btn,
.dz-btn-static { white-space: nowrap; }

/* карточка файла (dz-list) */
.dz-list .dz-row {
  display: block;
  border: 1px solid rgba(0,0,0,.08);
  background: #fff;
  border-radius: .5rem;
  padding: .35rem .5rem;
  margin-bottom: .5rem;
}

.dz-row .tfile-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
}

.dz-row .tfile-name {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: .4rem;
}

.dz-row .tfile-name a,
.dz-row .tfile-name span {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dz-row .dz-row-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 4px;
}

.dz-row-actions .btn { padding: 2px 6px; line-height: 1; }

.dz-row .tfile-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: .25rem;
}

.dz-row .tfile-meta { color: #6c757d; font-size: .84rem; }

.dz-row *:focus,
.dz-row *:active,
.dz-row *:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

.dz-row.tf-pending { border-color: rgba(255,193,7,.45); }

/* =========================================================
   Документы типа — аккуратные строки и обрезка имён
========================================================= */

#type-docs-list .tf-item { background: #fff; }
#type-docs-list .tf-name { min-width: 0; }

#type-docs-list .tf-name .title { font-weight: 600; }

#type-docs-list .tf-name .fname a {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================================================
   Карточка документов — равномерное распределение секций
========================================================= */

.card-body.files {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 100%;
}

.card-body.files.distribute {
  justify-content: space-between;
}

.file-block { display: block; }
.file-block .file-section-title { margin: 0 0 .35rem; }
.file-block .dz-wrap { margin: 0; }
.file-block .dz-list { margin-top: .4rem; }

/* =========================================================
   Текстовые описания (clamp)
========================================================= */

.desc-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 10;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.desc-expanded {
  -webkit-line-clamp: unset;
  overflow: visible;
}

/* мелкая адаптивность блока мини-карточек */
.card-body .d-flex.flex-wrap.justify-content-center > div {
  min-width: 180px;
}
