/* src/frontend/static/css/components.css */
/* Утилитарные классы для часто используемых паттернов */

/* ── Состояние загрузки ─────────────────────────────── */
.loading-center {
  padding: 40px;
  text-align: center;
}

.loading-center__loader {
  margin: 0 auto;
}

.loading-center__text {
  color: var(--text);
  margin-top: 16px;
}

/* ── Пустое состояние сетки ─────────────────────────── */
.grid-empty-state {
  grid-column: 1 / -1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 30vh;
  color: var(--muted);
  font-size: 16px;
}

/* ── Кнопка "Показать ещё" ─────────────────────────── */
.load-more-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 18px 0;
}

.load-more-btn {
  width: 250px;
  margin: 50px;
}

/* ── Ссылка/кнопка автора в модальном окне ─────────── */
.modal-author-link {
  cursor: pointer;
  color: var(--accent);
  transition: opacity 0.2s ease;
}

.modal-author-link:hover {
  opacity: 0.8;
}

/* ── Чипы (теги/фильтры) ───────────────────────────── */
.chips {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0;
  padding: 0 20px;
}

.chip {
  background: #1c1c1c;
  padding: 7px 14px;
  border-radius: 10px;
  color: var(--muted);
  cursor: pointer;
  border: 2px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  user-select: none;
}

.chip.active {
  background: var(--chip-bg);
  color: var(--text-inverse);
  font-weight: 600;
}

/* ── Лейблы в модальном окне ───────────────────────── */
.modal-label {
  color: #9aa0a6;
  font-size: 12px;
  margin-top: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.modal-prompt {
  background: rgba(255, 255, 255, 0.02);
  padding: 8px;
  border-radius: 8px;
}

/* ── Кнопки (базовые) ──────────────────────────────── */
.btn {
  padding: 10px 14px;
  border-radius: 10px;
  border: 0;
  cursor: pointer;
  font-weight: 700;
  font-family: var(--font-family-sans);
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.btn:hover {
  opacity: 0.9;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--chip-bg);
  color: var(--text-inverse);
}

.btn-secondary {
  background: var(--glass);
  color: var(--text);
  border: 1px solid var(--border-color);
}

.btn-ghost {
  background: none;
  color: var(--text);
}

/* ── Относится к provider/source бейджу ─────────────── */
.provider {
  font-weight: 700;
  font-size: 13px;
}

.link {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}

/* ── Responsive для чипов ──────────────────────────── */
@media (max-width: 900px) {
  .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-right: 20px;
  }

  .chips::-webkit-scrollbar {
    display: none;
  }

  .chip {
    white-space: nowrap;
    flex-shrink: 0;
  }
}

/* ── React Modal Styles (Migrated) ───────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  backdrop-filter: blur(12px);
  /* increased blur for depth */
  padding: 20px;
}

.modal-content {
  background: var(--card-bg, #101010);
  border: 1px solid rgba(255, 255, 255, 0.05);
  /* subtle border */
  border-radius: 22px;
  /* match card radius */
  width: min(1400px, 95%);
  height: 90vh;
  max-height: 90vh;
  display: flex;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  position: relative;
  flex-direction: row;
}

.modal-close {
  position: absolute;
  right: 16px;
  top: 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  z-index: 100000;
  transition: background 0.2s, transform 0.2s;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.modal-media-col {
  flex: 1;
  min-width: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.modal-info-col {
  width: 420px;
  flex-shrink: 0;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  background: var(--card-bg, #101010);
  border-left: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-title {
  font-weight: 700;
  font-size: 24px;
  line-height: 1.3;
  color: #fff;
  letter-spacing: -0.02em;
  margin: 0;
}

.modal-desc {
  color: #aaa;
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  margin: 0;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-btn {
  width: 100%;
  padding: 14px 20px;
  font-size: 15px;
}

/* Modal Primary Button (Order / Generate) */
.modal-btn-primary {
  background: var(--chip-bg, #D6FF3F) !important;
  color: #111 !important;
  border-radius: 40px !important; /* Rounded pill style */
  font-weight: 700;
  border: none;
  transition: transform 0.15s ease !important;
  flex: 1; /* Take up available space */
}

.modal-btn-primary:hover {
  background: var(--chip-bg, #D6FF3F) !important; /* No rogue hover colors */
  transform: scale(0.98);
}

.modal-btn-primary:active {
  transform: scale(0.95);
}

/* Copy Link Icon Button */
.modal-copy-icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.2s;
}

.modal-copy-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.modal-copy-icon-btn:active {
  transform: scale(0.95);
}

/* Wrap actions side by side */
.modal-actions-row {
  display: flex;
  gap: 12px;
  width: 100%;
}

@media (max-width: 900px) {
  .modal-content {
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
  }

  .modal-info-col {
    width: 100%;
    flex: 1 1 auto;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
  }

  .modal-media-col {
    height: 40vh;
    flex: 0 0 auto;
  }

  .modal-overlay {
    padding: 0;
  }

  .modal-close {
    background: rgba(0, 0, 0, 0.5);
    /* contrast against video */
  }
}