/* Медиа, ссылки и документы */
.media-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #128c7e;
  color: white;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

/* Вкладки Фото / Видео / Файлы — сброс глобальных input,button / button из styles.css */
.media-gallery-tabs {
  flex-shrink: 0;
  border-bottom: 1px solid #e2e8f0;
  background: #f0f2f5;
  padding: 8px 10px;
}

.media-gallery-tabs-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

button.media-gallery-tab {
  width: auto !important;
  flex: 1 1 0;
  min-width: 0;
  max-width: none !important;
  padding: 8px 8px !important;
  margin: 0 !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.25;
  font-weight: 500;
  background: #ffffff !important;
  color: #3d4a53 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  cursor: pointer;
}

button.media-gallery-tab:hover {
  background: #e8f5f3 !important;
  color: #0e5c54 !important;
}

button.media-gallery-tab-active {
  background: #128c7e !important;
  color: #ffffff !important;
  border-color: #0f7569 !important;
}

button.media-gallery-tab-active:hover {
  background: #0e7a6e !important;
  color: #ffffff !important;
}

.media-gallery-tabs-hint {
  font-size: 12px;
  color: #64748b;
  padding: 4px 2px 0;
}

.media-gallery-sentinel {
  height: 4px;
  width: 100%;
  pointer-events: none;
}

.media-gallery-loading-more {
  text-align: center;
  padding: 12px;
  font-size: 13px;
  color: #64748b;
}

.media-gallery-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  font-size: 14px;
  cursor: pointer;
  background: #fff;
  color: #1e293b;
}

.media-gallery-file-row:hover {
  background: #f8fafc;
}

.media-gallery-file-row .media-gallery-file-open {
  flex-shrink: 0;
  color: #0f766e;
  font-weight: 500;
  font-size: 13px;
}

.media-gallery-file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 8px 8px;
}

.media-categories-list {
  flex: 1;
  overflow-y: auto;
  background: #fff;
}

.media-category-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: background 0.2s;
}

.media-category-item:active {
  background: #f5f5f5;
}

.media-category-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 14px;
  font-size: 20px;
  color: #128c7e;
  background: #e8f5e9;
}

.media-category-icon.media-icon-photo { color: #2196f3; background: #e3f2fd; }
.media-category-icon.media-icon-video { color: #9c27b0; background: #f3e5f5; }
.media-category-icon.media-icon-file { color: #ff9800; background: #fff3e0; }
.media-category-icon.media-icon-audio { color: #e91e63; background: #fce4ec; }
.media-category-icon.media-icon-link { color: #4caf50; background: #e8f5e9; }
.media-category-icon.media-icon-voice { color: #00bcd4; background: #e0f7fa; }
.media-category-icon.media-icon-gif { background: #f5f5f5; }

.media-category-text {
  flex: 1;
  font-size: 16px;
  color: #333;
}

.media-category-count {
  font-size: 15px;
  color: #888;
  margin-left: 8px;
}

/* Галерея — сетка 3 колонки */
.media-gallery-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  -webkit-overflow-scrolling: touch;
}

.media-gallery-month {
  margin-bottom: 16px;
}

.media-gallery-month-title {
  font-size: 15px;
  font-weight: 600;
  color: #666;
  padding: 8px 4px;
  margin-bottom: 4px;
}

.media-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.media-gallery-item {
  aspect-ratio: 1;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background: #f0f0f0;
}

.media-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-gallery-item .media-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e0e0e0;
  color: #666;
  font-size: 28px;
}

.media-gallery-item .media-video-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #e0e0e0;
}

.media-gallery-item .media-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.25);
  color: white;
  font-size: 28px;
  pointer-events: none;
}

.media-gallery-item .media-placeholder.file {
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  font-size: 10px;
  text-align: center;
}
.media-gallery-item .media-placeholder.file .media-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  font-size: 9px;
  line-height: 1.2;
}
.media-gallery-item .media-placeholder.file i { font-size: 22px; }
.media-gallery-item .media-placeholder.file { background: #fff3e0; color: #ff9800; }
.media-gallery-item .media-placeholder.file-pdf { background: #ffebee; color: #e53935; }
.media-gallery-item .media-placeholder.file-word { background: #e3f2fd; color: #1976d2; }
.media-gallery-item .media-placeholder.file-excel { background: #e8f5e9; color: #388e3c; }
.media-gallery-item .media-placeholder.file-archive { background: #fff3e0; color: #f57c00; }
.media-gallery-item .media-placeholder.link { background: #e8f5e9; color: #4caf50; }
.media-gallery-item .media-placeholder.voice { background: #e0f7fa; color: #00bcd4; }

.media-gallery-loading {
  text-align: center;
  padding: 24px;
  color: #888;
}
