/* ==========================================================================
   STORM MINERVA - СТИЛИ МЕНЕДЖЕРА ТОРРЕНТ-ЗАГРУЗОК (DOWNLOADS.CSS)
   ========================================================================== */

/* -------------------------------------------------------------
   СВОРАЧИВАЕМЫЙ БЛОК БЫСТРОГО ВЫБОРА КЛИЕНТА
   ------------------------------------------------------------- */
.downloads-switcher-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--card-shadow);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.downloads-switcher-box:hover {
  border-color: var(--border-hover);
}

.downloads-switcher-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.downloads-switcher-box.collapsed {
  padding: 12px 20px;
}

.downloads-switcher-box.collapsed .downloads-switcher-body {
  display: none !important;
}

.downloads-switcher-toggle-btn {
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 14px;
}

.downloads-active-preview-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 210, 255, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}

/* -------------------------------------------------------------
   ПАНЕЛЬ УПРАВЛЕНИЯ: ФИЛЬТРЫ, ПОИСК, СОРТИРОВКА И ГРУППИРОВКА
   ------------------------------------------------------------- */
.downloads-controls-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Вкладки фильтрации по статусам */
.downloads-status-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 14px;
}

.downloads-status-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.downloads-status-tab:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: var(--bg-tertiary);
  transform: translateY(-1px);
}

.downloads-status-tab.active {
  color: #05070a;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 100%);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 14px var(--accent-glow), 0 2px 6px rgba(0, 0, 0, 0.3);
  font-weight: 700;
}

.downloads-tab-count {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.25);
  color: inherit;
}

.downloads-status-tab.active .downloads-tab-count {
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
}

/* Строка поисковой строки и выпадающих списков */
.downloads-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.downloads-search-wrap {
  position: relative;
  flex: 1;
  min-width: 260px;
  display: flex;
  align-items: center;
}

.downloads-search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}

.downloads-search-input {
  width: 100%;
  padding-left: 36px;
  padding-right: 32px;
  height: 38px;
}

.downloads-search-clear {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  display: none;
  transition: color 0.15s ease;
}

.downloads-search-clear:hover {
  color: var(--accent);
}

.downloads-select-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.downloads-select-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.downloads-select {
  height: 38px;
  padding: 0 34px 0 14px;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  text-align-last: left;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2300D2FF' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.downloads-select:hover, .downloads-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

/* Строка массовых действий и счетчика */
.downloads-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.downloads-counter-text {
  font-size: 12.5px;
  color: var(--text-muted);
}

.downloads-bulk-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* -------------------------------------------------------------
   ЗАГОЛОВКИ ГРУПП (GROUP HEADERS)
   ------------------------------------------------------------- */
.downloads-group-section {
  margin-bottom: 22px;
}

.downloads-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(90deg, rgba(0, 210, 255, 0.1) 0%, rgba(0, 0, 0, 0) 100%);
  border-left: 4px solid var(--accent);
  padding: 8px 16px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 12px;
}

.downloads-group-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.downloads-group-meta {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(0, 0, 0, 0.3);
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
}

/* -------------------------------------------------------------
   ОБЪЕМНЫЕ 3D-КАРТОЧКИ ТОРРЕНТОВ (TORRENT ITEM CARDS)
   ------------------------------------------------------------- */
.qbit-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 12px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.qbit-item-card:hover {
  transform: translateY(-1.5px);
  border-color: var(--border-hover);
  box-shadow: var(--card-shadow), 0 0 16px var(--accent-glow);
}

.qbit-item-card.selected {
  border-color: var(--accent);
  background: rgba(0, 210, 255, 0.04);
}

.qbit-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.qbit-item-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.qbit-item-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: color 0.15s ease;
}

.qbit-item-title:hover {
  color: var(--accent);
}

.qbit-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.qbit-item-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qbit-item-metrics-strip {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.25);
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.qbit-metric-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.qbit-metric-item strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Четкий видимый вертикальный разделитель в строке метрик */
.qbit-metric-divider {
  display: inline-block;
  width: 1px;
  height: 15px;
  background: rgba(255, 255, 255, 0.22);
  flex-shrink: 0;
  margin: 0 2px;
}

[data-theme="STORM DAY"] .qbit-metric-divider {
  background: rgba(0, 0, 0, 0.22);
}

/* Раскрывающийся блок деталей */
.qbit-item-details-drawer {
  display: none;
  border-top: 1px solid var(--border-subtle);
  padding-top: 14px;
  margin-top: 2px;
  font-size: 13px;
  animation: fadeIn 0.2s ease-in-out;
}

.qbit-item-details-drawer.open {
  display: block;
}

.qbit-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.qbit-detail-cell {
  background: var(--bg-secondary);
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.qbit-detail-cell-hash {
  grid-column: span 2;
  min-width: 440px;
}

@media (max-width: 900px) {
  .qbit-detail-cell-hash {
    grid-column: 1 / -1;
    min-width: 100%;
  }
}

.qbit-detail-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.qbit-detail-value {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 600;
  word-break: break-all;
}

/* Таблица файлов внутри торрента с видимыми вертикальными разделителями */
.qbit-files-table-container {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-secondary);
  margin-top: 10px;
}

.qbit-files-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.qbit-files-table th {
  background: var(--bg-tertiary);
  padding: 8px 12px;
  text-align: left;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 11.5px;
  position: sticky;
  top: 0;
  border-bottom: 1px solid var(--border-color);
  border-right: 1px solid var(--border-subtle);
}

.qbit-files-table th:last-child {
  border-right: none;
}

.qbit-files-table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.qbit-files-table td:last-child {
  border-right: none;
}

.qbit-files-table tr:hover td {
  background: rgba(0, 210, 255, 0.04);
  color: var(--text-primary);
}

/* -------------------------------------------------------------
   МОДАЛЬНЫЙ ДИАЛОГ УДАЛЕНИЯ РАЗДАЧИ (DELETE MODAL)
   ------------------------------------------------------------- */
.downloads-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease-out;
}

.downloads-modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  max-width: 520px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), 0 0 24px var(--shadow-color);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: scaleUp 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.downloads-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.downloads-modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.downloads-modal-body {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.downloads-modal-target-name {
  background: var(--bg-secondary);
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  font-weight: 700;
  color: var(--text-primary);
  margin: 10px 0;
  word-break: break-all;
  max-height: 80px;
  overflow-y: auto;
}

.downloads-modal-warning {
  display: none;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid var(--color-red);
  color: #ff6b6b;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-top: 10px;
  font-weight: 600;
}

.downloads-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleUp {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
