.image-converter-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.converter-description {
    margin-bottom: 20px;
    color: #666;
}

.upload-container {
    border: 2px dashed #d2b48c; /* 棕褐色虛線邊框 */
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 30px;
    background-color: rgba(245, 240, 232, 0.4); /* 淺奶茶色背景 */
}

.upload-container.highlight {
    border-color: #a0522d; /* 赭色邊框 */
    background-color: rgba(160, 82, 45, 0.1); /* 赭色半透明背景 */
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.upload-content i {
    font-size: 48px;
    color: #a0522d; /* 赭色圖標 */
}

.hidden-input {
    display: none;
}

.file-input-label {
    background-color: #a0522d; /* 赭色按鈕 */
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.file-input-label:hover {
    background-color: #8b4513; /* 鞍褐色 */
}

.supported-formats {
    font-size: 0.85em;
    color: #888;
    margin-top: 10px;
}

.preview-container,
.conversion-options,
.result-container {
    margin-bottom: 30px;
    background-color: #fdfbf7; /* 奶油白背景 */
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.hidden {
    display: none;
}

.image-preview,
.result-preview {
    text-align: center;
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    max-height: 70vh;
    background-image: 
        repeating-linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc), 
        repeating-linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc);
    background-position: 0 0, 10px 10px;
    background-size: 20px 20px;
    border-radius: 4px; /* Add border-radius to the container */
}

.image-preview img,
.result-preview img {
    max-width: 100%;
    max-height: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.image-info,
.result-info {
    background-color: #f5f0e8; /* 淺奶油色 */
    border-radius: 4px;
    padding: 10px 15px;
    margin-bottom: 15px;
}

.image-info p,
.result-info p {
    margin: 5px 0;
    font-size: 14px;
}

h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #5d4037; /* 暖棕色文字 */
    border-bottom: 1px solid rgba(210, 180, 140, 0.4);
    padding-bottom: 10px;
}

.option-group {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.option-group label {
    margin-right: 15px;
    font-weight: bold;
    min-width: 80px;
}

.option-group select {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #d2b48c; /* 棕褐色邊框 */
    background-color: #fdfbf7;
    min-width: 120px;
}

.slider-container {
    display: flex;
    align-items: center;
}

/* --- 調整數值輸入框樣式 --- */
.adjustment-input {
    width: 60px;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #d2b48c;
    background-color: #fdfbf7;
    color: #5d4037;
    text-align: center;
    -moz-appearance: textfield; /* Firefox */
}

.adjustment-input::-webkit-outer-spin-button,
.adjustment-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* --- 調整滑桿樣式 --- */
input[type=range].adjustment-slider {
  -webkit-appearance: none; /* 移除 Webkit/Blink 的預設樣式 */
  width: 150px;
  background: transparent; /* 讓軌道背景可見 */
}

/* 軌道樣式 (Chrome, Safari, Opera, Edge) */
input[type=range].adjustment-slider::-webkit-slider-runnable-track {
  width: 100%;
  height: 8px;
  cursor: pointer;
  background: #e8e2d9; /* 軌道背景色 */
  border-radius: 4px;
  border: 1px solid #d2b48c;
}

/* 拉動鈕樣式 (Chrome, Safari, Opera, Edge) */
input[type=range].adjustment-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  border: 1px solid #8b4513; /* 深棕色邊框 */
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: #a0522d; /* 赭色背景 */
  cursor: pointer;
  margin-top: -5px; /* 垂直置中 */
  transition: background-color 0.2s;
}

/* 軌道樣式 (Firefox) */
input[type=range].adjustment-slider::-moz-range-track {
  width: 100%;
  height: 8px;
  cursor: pointer;
  background: #e8e2d9;
  border-radius: 4px;
  border: 1px solid #d2b48c;
}

/* 拉動鈕樣式 (Firefox) */
input[type=range].adjustment-slider::-moz-range-thumb {
  border: 1px solid #8b4513;
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: #a0522d;
  cursor: pointer;
}

#resizeOptions {
    margin-top: 10px;
    margin-left: 95px;
    display: none;
    padding: 15px;
    background-color: #f5f0e8; /* 淺奶油色 */
    border-radius: 4px;
}

.dimensions {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

.dimensions input {
    width: 80px;
    padding: 5px;
    border-radius: 4px;    
    border: 1px solid #d2b48c;
}

.maintain-ratio {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: normal;
}

.convert-button,
.download-button,
.new-conversion-button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.3s;
    width: 100%;
    margin-bottom: 10px;
}

.convert-button {
    background-color: #8b4513; /* 鞍褐色 */
    color: white;
}

.convert-button:hover {
    background-color: #a0522d; /* 赭色 */
}

.download-button {
    background-color: #a0522d; /* 赭色 */
    color: white;
}

.download-button:hover {
    background-color: #8b4513; /* 鞍褐色 */
}

.new-conversion-button {
    background-color: #f5f0e8;
    color: #5d4037;
    border: 1px solid #d2b48c;
}

.new-conversion-button:hover {
    background-color: #efe8d9;
    border-color: #c8a97e;
}

/* --- Checkbox 樣式 --- */
input[type="checkbox"] {
    accent-color: #a0522d; /* 赭色 */
    width: 16px;
    height: 16px;
}

/* 響應式設計 */
@media (max-width: 600px) {
    .option-group {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .option-group label {
        margin-bottom: 5px;
    }
    
    #resizeOptions {
        margin-left: 0;
        width: 100%;
    }
    
    .dimensions {
        flex-direction: column;
    }
}

/* 编辑工具区域 */
.edit-options {
  margin-bottom: 25px;
  padding: 15px;
  background-color: rgba(245, 240, 232, 0.6); /* 奶茶色背景 */
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(210, 180, 140, 0.3); /* 淺棕色邊框 */
}

.edit-tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.tool-group {
  background: rgba(255, 255, 255, 0.7); /* 半透明白色背景 */
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(45, 24, 16, 0.08);
  border: 1px solid rgba(210, 180, 140, 0.2);
}

.tool-group h4 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 16px;
  color: #5d4037; /* 暖棕色文字 */
  border-bottom: 1px solid rgba(210, 180, 140, 0.4);
  padding-bottom: 8px;
}

.button-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tool-button {
  padding: 8px 12px;
  background-color: #f5f0e8; /* 淺奶油色 */
  border: 1px solid #d2b48c; /* 棕褐色邊框 */
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.tool-button:hover {
  background-color: #efe8d9;
}

.tool-button:active {
  background-color: #e8dfd0;
}

/* 滤镜选项 */
.filter-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 10px;
}

.filter-option {
  text-align: center;
  cursor: pointer;
}

.filter-preview {
  height: 60px;
  background-color: #e8e2d9;
  border-radius: 4px;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #5d4037;
}

.filter-option.active .filter-preview {
  border: 2px solid #a0522d; /* 選中時的深棕色邊框 */
  box-shadow: 0 0 8px rgba(160, 82, 45, 0.5);
}

.filter-gallery-title {
    font-size: 14px;
    color: #8c735b;
    margin-top: 20px;
    margin-bottom: 10px;
    font-weight: 500;
}

.filter-drag-handle {
    cursor: grab;
    color: #a0522d;
    padding: 0 5px;
    margin-right: 5px;
    font-size: 18px;
    line-height: 1;
}

.filter-drag-handle:hover {
    color: #8b4513;
}

/* 已選濾鏡容器 */
.active-filters-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(210, 180, 140, 0.4);
}

.active-filter-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #f5f0e8;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #d2b48c;
    cursor: grab;
}

.active-filter-item.dragging {
    opacity: 0.5;
    background: #efe8d9;
}

.active-filter-name {
    font-weight: bold;
    color: #5d4037;
    min-width: 80px;
    cursor: grab; /* 只有名稱區域顯示拖拽游標 */
    user-select: none; /* 防止拖拽時選中文字 */
}

.active-filter-item .slider-container {
    flex-grow: 1;
}

.remove-filter-btn {
    background: none;
    border: none;
    color: #a0522d;
    cursor: pointer;
    font-size: 16px;
}

/* 浮水印選項 */
.watermark-options .option-group {
    margin-bottom: 15px;
}

.watermark-input {
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #d2b48c;
    background-color: #fdfbf7;
    color: #5d4037;
    width: calc(100% - 95px);
}

.position-grid {
    display: grid;
    grid-template-columns: repeat(3, 30px);
    grid-template-rows: repeat(3, 30px);
    gap: 5px;
}

.position-btn {
    width: 30px;
    height: 30px;
    background-color: #f5f0e8;
    border: 1px solid #d2b48c;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.position-btn:hover {
    background-color: #efe8d9;
}

.position-btn.active {
    background-color: #a0522d;
    border-color: #8b4513;
}

/* 调整选项 */
.adjustment-options .option-group {
  margin-bottom: 10px;
}

/* 编辑预览 */
.edit-preview {
  text-align: center;
  margin: 20px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  max-height: 70vh;
  background-image: 
    repeating-linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc), 
    repeating-linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc);
  background-position: 0 0, 10px 10px;
  background-size: 20px 20px;
  border-radius: 4px; /* Add border-radius to the container */
}

.edit-preview canvas {
  max-width: 100%;
  max-height: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 编辑操作按钮 */
.edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.primary-button {
  padding: 8px 16px;
  background-color: #8b4513; /* 鞍褐色 */
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s, box-shadow 0.2s;
}

.primary-button:hover {
  background-color: #a0522d; /* 赭色 */
  box-shadow: 0 2px 5px rgba(139, 69, 19, 0.3);
}

.secondary-button {
  padding: 8px 16px;
  background-color: #f5f0e8;
  color: #5d4037;
  border: 1px solid #d2b48c;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.secondary-button:hover {
  background-color: #efe8d9;
  border-color: #c8a97e;
}

/* 比较视图 */
.comparison-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin: 15px 0;
}

.comparison-container.hidden {
  display: none;
}

.comparison-original,
.comparison-result {
  text-align: center;
}

.comparison-original h4,
.comparison-result h4 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 14px;
  color: #5d4037; /* 暖棕色文字 */
}

.comparison-original img,
.comparison-result img {
  max-width: 100%;
  height: auto;
  object-fit: contain;
  max-height: 70vh;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 比較視圖中顯示透明背景的相關樣式 */
.comparison-image-container {
    /* 保留棋盤格背景 */
    background-image: linear-gradient(45deg, #ccc 25%, transparent 25%),
                      linear-gradient(-45deg, #ccc 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, #ccc 75%),
                      linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: #fdfbf7;
    border: 1px solid #d2b48c; /* 棕褐色邊框 */
    border-radius: 4px;
    margin: 8px 0;
    padding: 0;
    display: inline-flex; /* 修改為inline-flex以適應內容大小 */
    align-items: center;
    justify-content: center;
    position: relative;
}

#comparisonOriginal, #comparisonResult {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    display: block;
    position: relative;
    z-index: 1;
}

/* --- 裁切比例按鈕高亮樣式 --- */

/* 當按鈕被選中時 (擁有 .active class) 的高亮樣式 */
.aspect-ratio-group .tool-button.active {
    background-color: #a0522d; /* 赭色背景 */ 
    color: #ffffff; /* 白色文字 */
    border-color: #8b4513; /* 深一點的棕色邊框 */
}

.aspect-ratio-group .tool-button.active:hover {
    background-color: #8b4513; /* 滑鼠懸停時的深棕色 */
}