/* ── Сетка медиа ── */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

/* ── Базовая карточка — Glassmorphism ── */
.media-item {
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  overflow: hidden;
  transition:
    transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    background 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.media-item:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.14);
  transform: translateY(-3px);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ── Фото-карточка ── */
.media-image {
  display: flex;
  flex-direction: column;
  gap: 0;
  cursor: pointer;
  padding: 0;
}

.media-image img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
  transition: opacity 0.2s ease;
}

.media-image:hover img {
  opacity: 0.92;
}

/* ── Видео-карточка ── */
.media-video {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

/* Превью-кнопка видео */
.media-video-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: none;
  background: #000;
  padding: 0;
  cursor: pointer;
}

.media-video-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

/* Кнопка Play на превью — glass circle */
.media-video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.media-video-thumb:hover .media-video-play {
  transform: translate(-50%, -50%) scale(1.12);
  background: rgba(0, 0, 0, 0.65);
  border-color: rgba(255, 255, 255, 0.25);
}

.media-video-play .icon {
  --icon-size: 20px;
  background-color: white;
  margin-left: 2px;
}

/* Бейдж длительности */
.media-video-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: white;
  font-size: 11px;
  font-weight: 600;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* ── Файл-карточка ── */
.media-file {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  text-decoration: none;
}

.media-file-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-file-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ── Общие элементы ── */
.media-meta {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 8px 12px;
}

.media-download {
  align-self: flex-end;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 10px;
  padding: 6px 12px;
  margin: 0 12px 10px;
  font-size: 12px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.media-download:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.media-empty {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 24px 0;
}
