/* 多媒体播放工具样式 */

body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 10px;
  color: #333;
  margin: 0;
}

.container {
  max-width: 100%;
  width: 100%;
  margin: 0;
  padding: 20px;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.file-input-wrapper {
  position: relative;
}

.btn-success {
  background: linear-gradient(135deg, #28a745, #20c997);
  color: white;
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.btn-info {
  background: linear-gradient(135deg, #17a2b8, #20c997);
  color: white;
}

.btn-info:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(23, 162, 184, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, #dc3545, #e83e8c);
  color: white;
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.btn-secondary {
  background: linear-gradient(135deg, #6c757d, #868e96);
  color: white;
}

.btn-secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4);
}

/* 播放区域容器 */
.players-container {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  min-height: calc(100vh - 180px);
  width: 100%;
}

/* 动态布局 - 根据播放器数量自动调整 */
.players-container.players-1 .player-area {
  width: 100%;
  height: calc(100vh - 200px);
  min-height: 600px;
}

.players-container.players-2 .player-area {
  width: calc(50% - 10px);
  height: calc(100vh - 200px);
  min-height: 600px;
}

.players-container.players-3 .player-area {
  width: calc(33.333% - 14px);
  height: calc(50vh - 100px);
  min-height: 400px;
}

.players-container.players-4 .player-area {
  width: calc(25% - 15px);
  height: calc(50vh - 100px);
  min-height: 400px;
}

/* 超过4个播放器时，每行最多4个 */
.players-container.players-more .player-area {
  width: calc(25% - 15px);
  height: calc(50vh - 100px);
  min-height: 400px;
}

.empty-state {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #6c757d;
  text-align: center;
}

.empty-icon {
  width: 64px;
  height: 64px;
  fill: #dee2e6;
  margin-bottom: 16px;
}

.empty-state p {
  font-size: 16px;
  margin: 0;
}

/* 播放器区域 */
.player-area {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 10px;
  box-shadow: 0 3px 15px rgba(0,0,0,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  overflow: hidden;
  position: relative;
  resize: both;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
}

.player-area:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.12);
}

.player-header {
  padding: 12px 16px;
  background: rgba(102, 126, 234, 0.1);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.player-title {
  font-size: 14px;
  font-weight: 600;
  color: #2c3e50;
  margin: 0;
}

.player-controls {
  display: flex;
  gap: 2px;
}

.control-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.control-btn:hover {
  background: rgba(0,0,0,0.1);
}

.control-btn .icon {
  width: 16px;
  height: 16px;
  fill: #6c757d;
}

.player-content {
  position: relative;
  height: calc(100% - 49px);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
}

.media-display {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.media-info {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(4px);
  opacity: 1;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

/* 视频模式下默认隐藏，悬停时显示 */
.player-content video ~ .media-info {
  opacity: 0;
}

.player-content:hover video ~ .media-info {
  opacity: 1;
}

.file-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  margin-right: 12px;
}

.file-counter {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: rgba(255,255,255,0.2);
  padding: 2px 8px;
  border-radius: 12px;
  white-space: nowrap;
  min-width: 50px;
  text-align: center;
}

.no-media {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #6c757d;
  text-align: center;
  padding: 20px;
}

.no-media .icon {
  width: 48px;
  height: 48px;
  fill: #dee2e6;
  margin-bottom: 12px;
}

/* 播放控制按钮 */
.play-controls {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none; /* 隐藏中间的切换按钮 */
  gap: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.player-content:hover .play-controls {
  opacity: 1;
}

.play-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(0,0,0,0.7);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.play-btn:hover {
  background: rgba(0,0,0,0.9);
  transform: scale(1.1);
}

.play-btn .icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* 模态框样式 */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  background: white;
  margin: 10% auto;
  padding: 0;
  border-radius: 10px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #2c3e50;
}

.close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.close-btn:hover {
  background: rgba(0,0,0,0.1);
}

.close-btn .icon {
  width: 20px;
  height: 20px;
  fill: #6c757d;
}

.modal-body {
  padding: 20px 24px;
}

.setting-group {
  margin-bottom: 20px;
}

.setting-group:last-child {
  margin-bottom: 0;
}

.setting-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 8px;
}

.radio-group {
  display: flex;
  gap: 16px;
}

.radio-item {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #495057;
}

.radio-item input[type="radio"] {
  margin: 0;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #495057;
}

.checkbox-item input[type="checkbox"] {
  margin: 0;
}

.slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #dee2e6;
  outline: none;
  -webkit-appearance: none;
  margin-bottom: 8px;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.slider-value {
  font-size: 12px;
  color: #6c757d;
  font-weight: 500;
}

.modal-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid #dee2e6;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* 右键菜单 */
.context-menu {
  position: fixed;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  border: 1px solid rgba(0,0,0,0.1);
  padding: 4px 0;
  min-width: 150px;
  z-index: 1001;
  display: none;
}

.context-item {
  padding: 8px 16px;
  font-size: 14px;
  color: #495057;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.2s ease;
}

.context-item:hover {
  background: #f8f9fa;
}

.context-item .icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.context-divider {
  height: 1px;
  background: #dee2e6;
  margin: 4px 0;
}

/* 响应式设计 */
@media (max-width: 1200px) {
  /* 在中等屏幕上，最多2列 */
  .players-container.players-3 .player-area,
  .players-container.players-4 .player-area,
  .players-container.players-more .player-area {
    width: calc(50% - 10px);
    height: calc(50vh - 100px);
    min-height: 400px;
  }
}

@media (max-width: 768px) {
  body {
    padding: 5px;
  }
  
  .container {
    padding: 10px;
  }
  
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .toolbar .btn {
    justify-content: center;
  }
  
  /* 在小屏幕上，所有播放器都占满宽度 */
  .players-container.players-1 .player-area,
  .players-container.players-2 .player-area,
  .players-container.players-3 .player-area,
  .players-container.players-4 .player-area,
  .players-container.players-more .player-area {
    width: 100%;
    height: calc(50vh - 80px);
    min-height: 300px;
    resize: vertical;
  }
  
  .modal-content {
    margin: 5% auto;
    width: 95%;
  }
}

/* 图标样式 */
.icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0;
}

/* Toast 通知样式 */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(40, 167, 69, 0.95);
  color: white;
  padding: 12px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: translateX(400px);
  transition: transform 0.3s ease;
  z-index: 1002;
}

.toast.show {
  transform: translateX(0);
}

/* 加载状态 */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #6c757d;
}

.loading::after {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid #dee2e6;
  border-top: 2px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 8px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 导航反馈动画 */
@keyframes fadeInOut {
  0% { 
    opacity: 0; 
    transform: translateX(-50%) translateY(-10px); 
  }
  20% { 
    opacity: 1; 
    transform: translateX(-50%) translateY(0); 
  }
  80% { 
    opacity: 1; 
    transform: translateX(-50%) translateY(0); 
  }
  100% { 
    opacity: 0; 
    transform: translateX(-50%) translateY(-10px); 
  }
}