@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

/* Accordion не згортається — як на find_service. about.css задає сам вигляд
   .accordion-item / .accordion-button / .header-icon-badge — ми лише блокуємо
   collapse-поведінку. */
.materials-page .accordion-no-collapse .accordion-button {
  pointer-events: none;
  cursor: default;
}
.materials-page .accordion-no-collapse .accordion-button::after {
  display: none !important;
}
.materials-page .accordion-no-collapse .accordion-button.collapsed {
  pointer-events: none;
}
.materials-page .accordion-no-collapse .accordion-collapse {
  display: block !important;
}

/* === Папки (категорії) === */
.folders-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 768px) {
  .folders-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1200px) {
  .folders-grid { grid-template-columns: 1fr 1fr 1fr; }
}

.folder-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 18px;
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.folder-card:hover,
.folder-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(247, 103, 7, 0.12);
  border-color: #f76707;
  text-decoration: none;
  color: inherit;
}
.folder-card-icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #f76707 0%, #ff8500 100%);
  box-shadow: 0 2px 6px rgba(247, 103, 7, 0.2);
}
.folder-card-icon i { color: #fff; font-size: 20px; }
.folder-card-body { flex: 1 1 auto; min-width: 0; }
.folder-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #2c3e50;
  line-height: 1.25;
  word-break: break-word;
}
.folder-card-count {
  font-size: 0.78rem;
  color: #9aa4b1;
  margin-top: 2px;
}
.folder-card-action {
  flex: 0 0 auto;
  color: #cbd5e0;
  font-size: 14px;
  transition: color 0.15s ease, transform 0.15s ease;
}
.folder-card:hover .folder-card-action {
  color: #f76707;
  transform: translateX(2px);
}

/* Кнопка повернення до папок */
.materials-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #656d77;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  margin-bottom: 16px;
  transition: color 0.15s ease;
}
.materials-back:hover { color: #f76707; text-decoration: none; }
.materials-back i { font-size: 0.9em; }

/* Сітка карток усередині accordion-body */
.materials-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 768px) {
  .materials-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1200px) {
  .materials-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.material-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.material-card:hover,
.material-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(247, 103, 7, 0.12);
  border-color: #f76707;
  text-decoration: none;
  color: inherit;
}

/* Іконка типу файлу — ~30% менша за попередній варіант */
.material-card-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: linear-gradient(135deg, #f76707 0%, #ff8500 100%);
  box-shadow: 0 2px 6px rgba(247, 103, 7, 0.2);
}

.material-card-icon i {
  color: #fff;
  font-size: 16px;
}

.material-card-body {
  flex: 1 1 auto;
  min-width: 0;
}

.material-card-title {
  font-size: 0.83rem;        /* ~10% менше за попередні 0.92rem */
  font-weight: 700;          /* bold */
  color: #2c3e50;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;     /* до 4 рядків замість 2 — більше тексту влазить */
  -webkit-box-orient: vertical;
  word-break: break-word;
  margin-bottom: 4px;
}

.material-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 0.75rem;
  color: #6b7785;
}

.material-card-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.material-card-meta-item i {
  font-size: 0.85em;
  color: #9aa4b1;
}

.material-card-action {
  flex: 0 0 auto;
  color: #f76707;
  font-size: 14px;
  transition: transform 0.15s ease;
}

.material-card:hover .material-card-action {
  transform: translate(2px, -2px);
}

.materials-empty {
  text-align: center;
  padding: 64px 16px;
  color: #6b7785;
  font-size: 0.95rem;
}

/* === Відео === */
.videos-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 576px) { .videos-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .videos-grid { grid-template-columns: 1fr 1fr 1fr; } }

.video-card {
  display: block;
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.video-card:hover,
.video-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(247, 103, 7, 0.12);
  border-color: #f76707;
  text-decoration: none;
  color: inherit;
}
.video-card-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}
.video-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s ease;
}
.video-card:hover .video-card-thumb img { transform: scale(1.03); }
.video-card-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 54px;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(247, 103, 7, 0.92);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, background 0.15s ease;
}
.video-card-play i { color: #fff; font-size: 20px; margin-left: 3px; }
.video-card:hover .video-card-play {
  transform: translate(-50%, -50%) scale(1.08);
  background: #f76707;
}
.video-card-body { padding: 12px 14px 14px; }
.video-card-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #2c3e50;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

/* Модалка з плеєром — адаптивне 16:9 */
.video-modal-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}
.video-modal-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Lightbox: центруємо по вертикалі (як .modal-dialog-centered) */
.modal-dialog:has(.video-lightbox) {
  display: flex;
  align-items: center;
  min-height: calc(100% - 3.5rem);
}
/* Lightbox: прибираємо «віконний» вигляд модалки для відео */
.modal-content:has(.video-lightbox) {
  background: transparent;
  border: none;
  box-shadow: none;
}
.modal-content:has(.video-lightbox) .modal-body { padding: 0; }
.modal-content:has(.video-lightbox) .modal-header { display: none; }
.video-lightbox { position: relative; }
/* Стиль як у кнопки «Повідомити про неточність» (btn-report-header) */
.video-lightbox-close {
  position: absolute;
  top: -46px;
  right: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #dee2e6;
  background: #fff;
  color: #f76707;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.video-lightbox-close:hover {
  border-color: #f76707;
  background: #f76707;
  color: #fff;
}
