/* 图片压缩工具专用样式 - 使用pcm前缀避免样式冲突 */
.pcm-container {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.pcm-title {
  text-align: center;
  color: #2c3e50;
  margin-bottom: 30px;
  font-weight: 400;
  font-size: 1.7rem;
}

/* 控制区域 */
.pcm-controls {
  background: white;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid #eaeaea;
}

.pcm-controls-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
  margin-bottom: 15px;
}

@media (min-width: 768px) {
  .pcm-controls-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .pcm-controls-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.pcm-control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pcm-control-label {
  font-size: 14px;
  color: #34495e;
  font-weight: 500;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pcm-control-label i {
  color: #3498db;
  font-size: 13px;
}

.pcm-size-preset,
.pcm-quality-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e0e0e0;
  /*border-radius: 8px;*/
  font-size: 14px;
  color: #2c3e50;
  background-color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232c3e50' stroke-width='2' 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;
  background-size: 16px;
  padding-right: 40px;
}

.pcm-size-preset:hover,
.pcm-quality-select:hover {
  border-color: #3498db;
}

.pcm-size-preset:focus,
.pcm-quality-select:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

/* 自定义尺寸输入 */
.pcm-dimension-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pcm-dimension-input-group {
  display: flex;
  align-items: center;
  border: 1px solid #e0e0e0;
  /*border-radius: 8px;*/
  overflow: hidden;
  transition: border-color 0.2s;
  flex: 1;
}

.pcm-dimension-input-group:focus-within {
  /*border-color: #3498db;*/
  /*box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);*/
}

.pcm-dimension-input {
  width: 100%;
  padding: 10px 12px;
  border: none;
  font-size: 14px;
  color: #2c3e50;
  background-color: white;
  outline: none;
  min-width: 0;
}

.pcm-dimension-input::placeholder {
  color: #95a5a6;
}

.pcm-dimension-label {
  padding: 0 12px;
  font-size: 13px;
  color: #7f8c8d;
  background-color: #ffffff;
  height: 100%;
  display: flex;
  align-items: center;
  border-left: 1px solid #e0e0e0;
}

.pcm-dimension-separator {
  color: #7f8c8d;
  font-weight: 500;
  font-size: 16px;
}

/* 开始压缩按钮 */
.pcm-btn {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
}

.pcm-btn-compress {
  background: linear-gradient(135deg, #26a0f1, #1a8cd8);
  color: white;
  font-weight: 600;
  width: 100%;
}

.pcm-btn-compress:hover {
  background: linear-gradient(135deg, #1a8cd8, #0e7abf);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(38, 160, 241, 0.3);
}

.pcm-btn-compress:disabled {
  background: #bdc3c7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.pcm-compress-icon {
  width: 18px;
  height: 18px;
}

.pcm-quality-hint {
  font-size: 13px;
  color: #7f8c8d;
  margin-top: 10px;
  line-height: 1.5;
  padding: 10px;
  background-color: #f8f9fa;
  border-radius: 6px;
  border-left: 3px solid #3498db;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.pcm-quality-hint i {
  color: #3498db;
  margin-top: 1px;
  flex-shrink: 0;
}

/* 上传区域 */
.pcm-upload-area {
  border: 4px dashed #d8d8d8;
  border-radius: 12px;
  padding: 50px 20px;
  text-align: center;
  background-color: white;
  margin-bottom: 30px;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  display: block; /* 默认显示 */
}

.pcm-upload-area:hover, .pcm-upload-area.pcm-dragover {
  border-color: #3498db;
  background-color: #f8fafc;
  border-style: solid;
}

.pcm-upload-area.hidden {
  display: none; /* 隐藏上传区域 */
}

.pcm-upload-content {
  pointer-events: none; /* 让内容不拦截点击事件 */
}

.pcm-upload-icon {
  color: #2196F3;
  margin-bottom: 15px;
  font-size: 48px;
}

.pcm-upload-area:hover .pcm-upload-icon {
  color: #3498db;
}

.pcm-upload-text {
  font-size: 18px;
  color: #2c3e50;
  margin-bottom: 8px;
  font-weight: 500;
}

.pcm-upload-hint {
  color: #95a5a6;
  font-size: 14px;
}

.pcm-file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* 预览区域 */
.pcm-preview-section {
  background: white;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid #eaeaea;
  display: none; /* 默认隐藏 */
}

.pcm-preview-section.visible {
  display: block; /* 显示预览区域 */
}

.pcm-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #ecf0f1;
  flex-wrap: wrap;
  gap: 15px;
}

.pcm-preview-title {
  color: #2c3e50;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pcm-preview-title i {
  color: #3498db;
}

.pcm-stats {
  display: flex;
  gap: 20px;
  font-size: 14px;
  color: #34495e;
  background: #f8f9fa;
  padding: 8px 15px;
  border-radius: 6px;
}

.pcm-stats span {
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
}

.pcm-stats i {
  color: #3498db;
  font-size: 13px;
}

#pcm-selected-count {
  color: #3498db;
}

#pcm-compressed-count {
  color: #2ecc71;
}

#pcm-saved-size {
  color: #e74c3c;
}

/* 图片网格 - 三列布局 */
.pcm-images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .pcm-images-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1200px) {
  .pcm-images-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.pcm-image-card {
  background: #f8f9fa;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid #eaeaea;
  display: flex;
  min-height: 180px;
  max-height: 220px;
}

.pcm-image-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.pcm-image-preview-container {
  width: 150px;
  min-width: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #2c3e50;
  position: relative;
  border-right: 1px solid #eaeaea;
}

.pcm-image-preview {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  padding: 8px;
}

.pcm-image-details {
  flex: 1;
  padding: 12px 15px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.pcm-image-header {
  margin-bottom: 8px;
}

.pcm-image-name {
  font-weight: 600;
  color: #2c3e50;
  font-size: 13px;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pcm-image-status {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 500;
  margin-bottom: 3px;
}

.pcm-status-waiting {
  background-color: #f0f7ff;
  color: #3498db;
}

.pcm-status-compressing {
  background-color: #fff7e6;
  color: #f39c12;
}

.pcm-status-done {
  background-color: #e8f7f0;
  color: #27ae60;
}

.pcm-image-specs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.pcm-spec-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pcm-spec-label {
  font-size: 10px;
  color: #7f8c8d;
  font-weight: 500;
}

.pcm-spec-value {
  font-size: 11px;
  font-weight: 600;
  color: #2c3e50;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pcm-original-size-value {
  color: #e74c3c;
}

.pcm-compressed-size-value {
  color: #27ae60;
}

.pcm-image-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: auto;
}

.pcm-btn-download-single {
  background-color: #2ecc71;
  color: white;
  padding: 5px 10px;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 70px;
  height: 28px;
}

.pcm-btn-download-single:hover:not(:disabled) {
  background-color: #27ae60;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(39, 174, 96, 0.3);
}

.pcm-btn-download-single:disabled {
  background-color: #bdc3c7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.pcm-btn-download-single i {
  font-size: 10px;
}

/* 底部操作按钮区域 */
.pcm-bottom-actions {
  padding-top: 20px;
  border-top: 1px solid #ecf0f1;
  display: none; /* 默认隐藏 */
}

.pcm-action-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* 重新上传按钮 */
.pcm-btn-reupload {
  background: linear-gradient(135deg, #4a90e2, #3a7bc8);
  color: white;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(74, 144, 226, 0.2);
  border: 1px solid #3a7bc8;
}

.pcm-btn-reupload:hover {
  background: linear-gradient(135deg, #3a7bc8, #2a6bb8);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(74, 144, 226, 0.3);
}

/* 批量下载按钮 */
.pcm-btn-download-all {
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  color: white;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(46, 204, 113, 0.2);
  border: 1px solid #27ae60;
}

.pcm-btn-download-all:hover:not(:disabled) {
  background: linear-gradient(135deg, #27ae60, #1e9b53);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(46, 204, 113, 0.3);
}

.pcm-btn-download-all:disabled {
  background: #bdc3c7;
  border-color: #95a5a6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* 压缩状态指示器 */
.pcm-compressing-indicator {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: white;
  font-size: 12px;
}

.pcm-compressing-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: pcm-spin 1s ease-in-out infinite;
  margin-bottom: 8px;
}

@keyframes pcm-spin {
  to { transform: rotate(360deg); }
}

/* 响应式调整 */
@media (max-width: 768px) {
  .pcm-container {
    padding: 15px;
  }
  
  .pcm-image-card {
    flex-direction: column;
    min-height: auto;
    max-height: none;
  }
  
  .pcm-image-preview-container {
    width: 100%;
    height: 150px;
    min-width: 100%;
    border-right: none;
    border-bottom: 1px solid #eaeaea;
  }
  
  .pcm-image-specs {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  
  .pcm-preview-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .pcm-stats {
    width: 100%;
    justify-content: space-between;
  }
  
  .pcm-action-buttons {
    flex-direction: column;
    width: 100%;
  }
  
  .pcm-btn-reupload,
  .pcm-btn-download-all {
    width: 100%;
  }
}