/* Модальное окно аудио в кэше */
#audioCacheModal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 100310;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  overflow-x: hidden;
}

#audioCacheModal[style*="flex"],
#audioCacheModal.show {
  display: flex !important;
}

#audioCacheModal .audio-cache-modal-content {
  position: relative;
  z-index: 100311;
  width: min(640px, 94vw);
  margin: auto;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

#audioCacheModal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: #ffffff;
}

#audioCacheModal .modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text, #1f2933);
}

#audioCacheModal .modal-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.6);
  color: var(--color-text, #1f2933);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

#audioCacheModal .modal-close:hover {
  background: rgba(255, 255, 255, 0.9);
}

#audioCacheModal .modal-close i[data-lucide] {
  width: 18px;
  height: 18px;
}

#audioCacheModal .audio-cache-modal-body {
  max-height: 72vh;
  overflow-y: auto;
  padding: 16px 20px;
}

/* Панель инструментов */
.audio-cache-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}

.audio-cache-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.audio-cache-count {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text, #1f2933);
}

.audio-cache-refresh-btn,
.audio-cache-clear-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--color-border-light, #dee2e6);
  border-radius: 8px;
  background: var(--color-panel-bg, #fff);
  color: var(--color-text, #1f2933);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.audio-cache-refresh-btn:hover {
  background: var(--color-hover, #f8f9fa);
}

.audio-cache-clear-btn {
  color: var(--color-error, #dc2626);
  border-color: rgba(220, 38, 38, 0.3);
}

.audio-cache-clear-btn:hover {
  background: rgba(220, 38, 38, 0.08);
  border-color: var(--color-error, #dc2626);
}

.audio-cache-refresh-btn i,
.audio-cache-clear-btn i {
  width: 16px;
  height: 16px;
}

/* Список аудио */
.audio-cache-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.audio-cache-loading,
.audio-cache-empty {
  color: var(--color-text-secondary, #6b7280);
  text-align: center;
  padding: 32px 16px;
  font-size: 14px;
}

/* Элемент аудио */
.audio-cache-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--color-hover, #f8f9fa);
  border-radius: 10px;
  border: 1px solid var(--color-border-light, #e5e7eb);
  transition: background 0.15s ease;
}

.audio-cache-item:hover {
  background: var(--color-panel-bg, #fff);
  border-color: var(--color-border, #d1d5db);
}

.audio-cache-item-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary, #3b82f6);
  color: #fff;
  border-radius: 8px;
}

.audio-cache-item-icon i {
  width: 16px;
  height: 16px;
}

.audio-cache-item-info {
  flex: 1;
  min-width: 0;
}

.audio-cache-item-url {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text, #1f2933);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: monospace;
}

.audio-cache-item-id-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 6px;
  background: var(--color-primary, #3b82f6);
  color: #fff;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  font-family: sans-serif;
  vertical-align: middle;
  margin-right: 2px;
}

.audio-cache-item-meta {
  font-size: 11px;
  color: var(--color-text-secondary, #6b7280);
  margin-top: 2px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.audio-cache-item-meta span {
  white-space: nowrap;
}

.audio-cache-item-play-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--color-border-light, #dee2e6);
  background: var(--color-panel-bg, #fff);
  color: var(--color-primary, #3b82f6);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.audio-cache-item-play-btn:hover {
  background: var(--color-primary, #3b82f6);
  color: #fff;
  border-color: var(--color-primary, #3b82f6);
}

.audio-cache-item-play-btn i {
  width: 16px;
  height: 16px;
}

.audio-cache-item-play-btn.playing {
  background: var(--color-error, #dc2626);
  color: #fff;
  border-color: var(--color-error, #dc2626);
}

/* Прогресс-бар воспроизведения */
.audio-cache-progress {
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--color-hover, #f8f9fa);
  border-radius: 10px;
  border: 1px solid var(--color-border-light, #e5e7eb);
}

.audio-cache-progress-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--color-text-secondary, #6b7280);
}

.audio-cache-progress-info .now-playing-label {
  font-weight: 600;
  color: var(--color-text, #1f2933);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audio-cache-progress-bar {
  margin-top: 6px;
  width: 100%;
  height: 4px;
  background: var(--color-border-light, #e5e7eb);
  border-radius: 2px;
  overflow: hidden;
}

.audio-cache-progress-bar-fill {
  height: 100%;
  background: var(--color-primary, #3b82f6);
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0%;
}
