/* 图片压缩工具样式 */

.imgc-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* 标题区 */
.imgc-header {
  text-align: center;
  margin-bottom: 30px;
  padding: 30px 20px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  border: 2px solid rgba(239, 68, 68, 0.2);
}

.imgc-title {
  font-size: 32px;
  font-weight: 900;
  color: #ef4444;
  margin: 0 0 10px 0;
}

.imgc-desc {
  font-size: 16px;
  color: #666;
  margin: 0;
  font-weight: 500;
}

[data-theme="dark"] .imgc-header {
  background: rgba(30, 30, 40, 0.9);
}

[data-theme="dark"] .imgc-title {
  color: #ff7c7c;
}

[data-theme="dark"] .imgc-desc {
  color: #aaa;
}

/* 上传区 */
.imgc-upload-area {
  margin-bottom: 30px;
  padding: 10px 10px;
  background: rgba(255, 255, 255, 0.9);
  border: 3px dashed rgba(239, 68, 68, 0.3);
  border-radius: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
}

.imgc-upload-area:hover {
  border-color: rgba(239, 68, 68, 0.6);
  background: rgba(255, 245, 245, 0.9);
}

.imgc-upload-area.dragging {
  border-color: #ef4444;
  background: rgba(255, 235, 235, 0.95);
  border-style: solid;
}

[data-theme="dark"] .imgc-upload-area {
  background: rgba(30, 30, 40, 0.9);
  border-color: rgba(255, 124, 124, 0.3);
}

[data-theme="dark"] .imgc-upload-area:hover {
  background: rgba(40, 30, 30, 0.9);
  border-color: rgba(255, 124, 124, 0.6);
}

.imgc-upload-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.imgc-upload-title {
  font-size: 20px;
  font-weight: 700;
  color: #333;
  margin: 0 0 10px 0;
}

.imgc-upload-hint {
  font-size: 14px;
  color: #999;
  margin: 0 0 20px 0;
}

[data-theme="dark"] .imgc-upload-title {
  color: #eee;
}

[data-theme="dark"] .imgc-upload-hint {
  color: #888;
}

.imgc-btn-upload {
  padding: 12px 32px;
  font-size: 16px;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s;
}

.imgc-btn-upload:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

/* 设置面板 */
.imgc-settings-panel {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  padding: 10px 20px;
  margin-bottom: 30px;
  border: 2px solid rgba(239, 68, 68, 0.1);
}

[data-theme="dark"] .imgc-settings-panel {
  background: rgba(30, 30, 40, 0.9);
  border-color: rgba(255, 124, 124, 0.2);
}

.imgc-settings-title {
  font-size: 18px;
  font-weight: 800;
  color: #ef4444;
  margin: 0 0 20px 0;
}

[data-theme="dark"] .imgc-settings-title {
  color: #ff7c7c;
}

.imgc-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

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

.imgc-setting-item label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #333;
  margin-bottom: 8px;
}

[data-theme="dark"] .imgc-setting-item label {
  color: #ddd;
}

.imgc-setting-item select,
.imgc-setting-item input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  border: 2px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  background: white;
  color: #333;
  outline: none;
  transition: all 0.3s;
}

.imgc-setting-item select:focus,
.imgc-setting-item input[type="number"]:focus {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

[data-theme="dark"] .imgc-setting-item select,
[data-theme="dark"] .imgc-setting-item input[type="number"] {
  background: rgba(50, 50, 60, 0.9);
  border-color: rgba(255, 124, 124, 0.3);
  color: #eee;
}

/* 宽/高/缩放方式：同一行三列（第三列更窄） */
.imgc-resize-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr 0.4fr;
  gap: 20px;
  align-items: end;
}

@media (max-width: 768px) {
  .imgc-resize-row {
    grid-template-columns: 1fr;
  }
}

/* 让下拉框本身别拉满（桌面端更短一点） */
#keepAspect {
  max-width: 220px;
}

/* ===========================
   压缩质量滑条：左红右白（跟拇指）+ 轨道居中 + 右侧可见
   依赖 JS 动态更新 --p
   =========================== */

.imgc-setting-item input[type="range"]{
  --track-h: 12px;
  --thumb: 26px;

  -webkit-appearance: none;
  appearance: none;

  width: 100%;
  height: var(--thumb);     /* 可点击区域高度 */
  background: transparent;  /* 关键：不再画外框胶囊 */
  border: 0;
  padding: 0;
  margin: 0;

  outline: none;
  cursor: pointer;
}

/* WebKit 轨道（Chrome/Edge/Safari） */
.imgc-setting-item input[type="range"]::-webkit-slider-runnable-track{
  height: var(--track-h);
  border-radius: 999px;
  background: linear-gradient(
    to right,
    #ef4444 0%,
    #ef4444 var(--p, 80%),
    #ffffff var(--p, 80%),
    #ffffff 100%
  );
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.14),
    inset 0 1px 2px rgba(0,0,0,0.10);
}

/* WebKit 拇指 */
.imgc-setting-item input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance: none;
  width: var(--thumb);
  height: var(--thumb);
  border-radius: 50%;
  background: #fff;
  border: 4px solid #ef4444;
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.25), 0 2px 6px rgba(0,0,0,0.18);

  /* 垂直居中到轨道 */
  margin-top: calc((var(--track-h) - var(--thumb)) / 2);
  transition: transform .15s ease, box-shadow .15s ease;
}

.imgc-setting-item input[type="range"]:hover::-webkit-slider-thumb{
  transform: scale(1.06);
}

.imgc-setting-item input[type="range"]:active::-webkit-slider-thumb{
  transform: scale(1.12);
  box-shadow: 0 10px 24px rgba(239, 68, 68, 0.35), 0 4px 10px rgba(0,0,0,0.22);
}

/* Firefox：右白轨道 + 左红进度 */
.imgc-setting-item input[type="range"]::-moz-range-track{
  height: var(--track-h);
  border-radius: 999px;
  background: #ffffff;
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.14),
    inset 0 1px 2px rgba(0,0,0,0.10);
}

.imgc-setting-item input[type="range"]::-moz-range-progress{
  height: var(--track-h);
  border-radius: 999px;
  background: #ef4444;
}

.imgc-setting-item input[type="range"]::-moz-range-thumb{
  width: var(--thumb);
  height: var(--thumb);
  border-radius: 50%;
  background: #fff;
  border: 4px solid #ef4444;
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.25), 0 2px 6px rgba(0,0,0,0.18);
}

/* 深色模式：白色换成浅亮灰，更舒服也更显眼 */
[data-theme="dark"] .imgc-setting-item input[type="range"]::-webkit-slider-runnable-track{
  background: linear-gradient(
    to right,
    #ff7c7c 0%,
    #ff7c7c var(--p, 80%),
    rgba(255,255,255,0.18) var(--p, 80%),
    rgba(255,255,255,0.18) 100%
  );
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.18),
    inset 0 1px 2px rgba(0,0,0,0.35);
}

[data-theme="dark"] .imgc-setting-item input[type="range"]::-moz-range-track{
  background: rgba(255,255,255,0.18);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.18),
    inset 0 1px 2px rgba(0,0,0,0.35);
}

[data-theme="dark"] .imgc-setting-item input[type="range"]::-moz-range-progress{
  background: #ff7c7c;
}

/* 操作按钮 */
.imgc-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.imgc-btn-primary,
.imgc-btn-secondary {
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
}

.imgc-btn-primary {
  color: white;
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.imgc-btn-primary:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.imgc-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.imgc-btn-secondary {
  color: #666;
  background: rgba(239, 68, 68, 0.1);
  border: 2px solid rgba(239, 68, 68, 0.2);
}

.imgc-btn-secondary:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .imgc-btn-secondary {
  color: #ddd;
  background: rgba(255, 124, 124, 0.15);
  border-color: rgba(255, 124, 124, 0.3);
}

/* 提示信息 */
.imgc-tips {
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #ef4444;
  min-height: 20px;
}

[data-theme="dark"] .imgc-tips {
  background: rgba(255, 124, 124, 0.15);
  color: #ff7c7c;
}

/* 文件列表 */
.imgc-file-list {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  padding: 24px;
  border: 2px solid rgba(239, 68, 68, 0.1);
}

[data-theme="dark"] .imgc-file-list {
  background: rgba(30, 30, 40, 0.9);
  border-color: rgba(255, 124, 124, 0.2);
}

.imgc-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid rgba(239, 68, 68, 0.1);
}

.imgc-list-header h3 {
  font-size: 18px;
  font-weight: 800;
  color: #ef4444;
  margin: 0;
}

.imgc-list-header span {
  font-size: 14px;
  font-weight: 700;
  color: #666;
}

[data-theme="dark"] .imgc-list-header h3 {
  color: #ff7c7c;
}

[data-theme="dark"] .imgc-list-header span {
  color: #aaa;
}

.imgc-list-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 文件项 */
.imgc-file-item {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.6);
  border: 2px solid rgba(239, 68, 68, 0.1);
  border-radius: 12px;
  transition: all 0.3s;
}

.imgc-file-item:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .imgc-file-item {
  background: rgba(40, 40, 50, 0.6);
  border-color: rgba(255, 124, 124, 0.2);
}

[data-theme="dark"] .imgc-file-item:hover {
  background: rgba(50, 50, 60, 0.8);
  border-color: rgba(255, 124, 124, 0.4);
}

.imgc-file-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid rgba(239, 68, 68, 0.2);
}

.imgc-file-info {
  min-width: 0;
}

.imgc-file-name {
  font-size: 15px;
  font-weight: 700;
  color: #333;
  margin: 0 0 6px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.imgc-file-stats {
  font-size: 13px;
  font-weight: 600;
  color: #666;
  line-height: 1.5;
}

[data-theme="dark"] .imgc-file-name {
  color: #eee;
}

[data-theme="dark"] .imgc-file-stats {
  color: #aaa;
}

.imgc-file-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.imgc-file-format {
  padding: 4px 10px;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 900;
  color: #ef4444;
  text-transform: uppercase;
}

[data-theme="dark"] .imgc-file-format {
  background: rgba(255, 124, 124, 0.2);
  color: #ff7c7c;
}

.imgc-file-download {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  color: white;
  background: #ef4444;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
}

.imgc-file-download:hover {
  background: #dc2626;
  transform: scale(1.05);
}

.imgc-file-download:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
