/* assets/css/admin-style.css */

#kvfd-file-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.kvfd-file-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  background: #fff;
  border: 1px solid #ccc;
  border-left: 4px solid #0073aa;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: background 0.2s ease;
  flex-wrap: wrap;
}

.kvfd-file-card:hover {
  background: #f9f9f9;
}

.kvfd-drag-handle {
  cursor: move;
  font-size: 18px;
  padding: 4px 6px;
  color: #777;
}

.kvfd-file-fields {
  display: flex;
  flex-wrap: wrap;
  flex: 1;
  gap: 12px;
  min-width: 0;
}

.kvfd-file-fields label {
  display: flex;
  flex-direction: column;
  font-weight: 500;
  color: #333;
}

.kvfd-file-fields label:nth-child(1) { /* Номер документа */
  flex: 0 1 5%;
  min-width: 30px;
}

.kvfd-file-fields label:nth-child(2),
.kvfd-file-fields label:nth-child(4) { /* Дата документа и Дата опубликования */
  flex: 0 1 8%;
  min-width: 60px;
}

.kvfd-file-fields label:nth-child(3) { /* Название документа */
  flex: 1 1 55%;
  min-width: 300px;
}

.kvfd-file-fields input {
  padding: 6px;
  font-size: 14px;
  width: 100%;
  margin-top: 4px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.kvfd-file-fields select {
  width: 100%;
  padding: 6px;
  margin-top: 2px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}

.kvfd-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.kvfd-save {
  background-color: #0073aa;
  border: none;
  color: #fff;
  padding: 6px 10px;
  border-radius: 3px;
  cursor: pointer;
}

.kvfd-save:hover {
  background-color: #005f8d;
}

.kvfd-save.saving {
  opacity: 0.6;
  pointer-events: none;
}

.kvfd-delete {
  color: #d63638;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.kvfd-delete:hover {
  color: #a00;
}

#kvfd_category_select {
  padding: 8px 12px;
  font-size: 15px;
  border: 1px solid #ccc;
  border-radius: 6px;
  min-width: 250px;
  background-color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* ========================= */
/* Статус документа (frontend) */
/* ========================= */
.kvfd-badge {
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  font-size: 13px;
}

.kvfd-badge.active {
  color: #218739;
  background-color: #e8f5e9;
  border: 1px solid #a5d6a7;
}

.kvfd-badge.cancelled,
.kvfd-badge.expired {
  color: #c62828;
  background-color: #ffebee;
  border: 1px solid #ef9a9a;
}
.kvfd-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.kvfd-filters-row label {
  font-weight: 500;
  margin-right: 6px;
}

.kvfd-filters-row select {
  padding: 6px 10px;
  font-size: 15px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background-color: #fff;
  min-width: 140px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.kvfd-filter-wrapper {
  display: flex;
  align-items: center;
}

.kvfd-view-switcher {
  display: flex;
  align-items: center;
}

/* Стили для таблицы на фронтенде в стиле карточек */
.kvfd-view-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 75, 107, 0.15);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  backdrop-filter: blur(5px);
  font-size: 14px;
  color: #333;
  margin-top: 20px;
  table-layout: fixed;
}

.kvfd-view-table thead {
  background: rgba(248, 250, 252, 0.9);
  backdrop-filter: blur(4px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.kvfd-view-table th,
.kvfd-view-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0, 75, 107, 0.1);
  text-align: left;
  vertical-align: top;
  word-wrap: break-word;
  overflow: hidden;
}

/* Настройка ширины колонок */
.kvfd-view-table th:nth-child(1), /* Номер */
.kvfd-view-table td:nth-child(1) {
  width: 12%;
  min-width: 80px;
}

.kvfd-view-table th:nth-child(2), /* Дата документа */
.kvfd-view-table td:nth-child(2) {
  width: 12%;
  min-width: 100px;
}

.kvfd-view-table th:nth-child(3), /* Название - самая широкая колонка */
.kvfd-view-table td:nth-child(3) {
  width: 40%;
  min-width: 200px;
}

.kvfd-view-table th:nth-child(4), /* Дата публикации */
.kvfd-view-table td:nth-child(4) {
  width: 12%;
  min-width: 100px;
}

.kvfd-view-table th:nth-child(5), /* Статус */
.kvfd-view-table td:nth-child(5) {
  width: 12%;
  min-width: 100px;
}

.kvfd-view-table th:nth-child(6), /* Действия */
.kvfd-view-table td:nth-child(6) {
  width: 12%;
  min-width: 120px;
}

.kvfd-view-table th {
  font-weight: 600;
  color: #4a5568;
  white-space: nowrap;
  background: rgba(248, 250, 252, 0.9);
  border-bottom: 1px solid rgba(0, 126, 167, 0.2);
  font-size: 13px;
  padding: 10px 12px;
}

.kvfd-view-table tbody tr {
  transition: background-color 0.2s ease;
}

.kvfd-view-table tbody tr:hover {
  background: rgba(248, 250, 252, 0.8);
}

.kvfd-view-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.3);
}

.kvfd-view-table tbody tr:nth-child(even):hover {
  background: rgba(248, 250, 252, 0.9);
}

/* Стили для фронтенд карточек */
.kvfd-container .kvfd-file-fields {
  display: flex !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  gap: 8px !important;
  flex: 1 !important;
}

.kvfd-container .kvfd-file-fields p {
  margin: 0 !important;
  font-size: 15px !important;
  line-height: 1.4 !important;
  display: block !important;
  width: 100% !important;
}

.kvfd-container .kvfd-file-fields strong {
  font-weight: 600 !important;
  color: #005f7a !important;
  margin-right: 8px !important;
}

.kvfd-container .kvfd-actions {
  display: flex !important;
  gap: 10px !important;
  margin-top: 10px !important;
  flex-wrap: wrap !important;
}

/* Стили для кнопок действий в таблице */
.kvfd-actions-cell {
  width: 140px;
  min-width: 140px;
  text-align: center;
}

.kvfd-table-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.kvfd-table-download,
.kvfd-table-preview {
  display: block;
  width: 100%;
  max-width: 120px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: bold;
  border-radius: 6px;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s ease;
  border: 1px solid;
  margin: 2px 0;
}

.kvfd-table-download {
  background: #e0f7ff;
  color: #007ea7;
  border-color: #a6dce8;
}

.kvfd-table-download:hover {
  background: #d0efff;
  color: #005f7a;
}

.kvfd-table-preview {
  background: #e0f7ff;
  color: #007ea7;
  border-color: #a6dce8;
}

.kvfd-table-preview:hover {
  background: #d0efff;
  color: #005f7a;
}

/* Адаптивность таблицы */
@media (max-width: 768px) {
  .kvfd-view-table {
    font-size: 12px;
  }
  
  .kvfd-view-table th,
  .kvfd-view-table td {
    padding: 8px 12px;
  }
  
  /* На мобильных устройствах название занимает больше места */
  .kvfd-view-table th:nth-child(3),
  .kvfd-view-table td:nth-child(3) {
    width: 50%;
  }
  
  .kvfd-view-table th:nth-child(1),
  .kvfd-view-table td:nth-child(1),
  .kvfd-view-table th:nth-child(2),
  .kvfd-view-table td:nth-child(2),
  .kvfd-view-table th:nth-child(4),
  .kvfd-view-table td:nth-child(4),
  .kvfd-view-table th:nth-child(5),
  .kvfd-view-table td:nth-child(5) {
    width: 10%;
  }
  
  .kvfd-view-table th:nth-child(6),
  .kvfd-view-table td:nth-child(6) {
    width: 10%;
  }
  
  .kvfd-table-actions {
    flex-direction: row;
    gap: 4px;
  }
  
  .kvfd-table-download,
  .kvfd-table-preview {
    padding: 4px 8px;
    font-size: 11px;
    max-width: 80px;
  }
}

@media (max-width: 480px) {
  .kvfd-view-table {
    font-size: 11px;
  }
  
  .kvfd-view-table th,
  .kvfd-view-table td {
    padding: 6px 8px;
  }
  
  .kvfd-actions-cell {
    width: 100px;
    min-width: 100px;
  }
  
  .kvfd-table-download,
  .kvfd-table-preview {
    padding: 3px 6px;
    font-size: 10px;
    max-width: 70px;
  }
}

/* Оптимизация производительности */
.kvfd-view-table {
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.kvfd-view-table tbody tr {
  will-change: background-color;
}

/* Убираем лишние блоки с категориями внизу */
body .term-tags-div,
body .form-wrap,
body .inline-edit-col,
body .tagsdiv {
    display: none !important;
}
