/* image-converter.html 私有样式 */

/* ---- 上传区域 ---- */
.upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f9fafb;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #667eea;
    background: #eef2ff;
}

.upload-area .icon {
    font-size: 48px;
}

.upload-area .upload-text {
    color: #6b7280;
    font-size: 14px;
    margin-top: 8px;
}

.upload-area .upload-text strong {
    color: #667eea;
}

.upload-area .upload-tip {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 6px;
}

/* ---- 原图信息卡 ---- */
.orig-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.orig-card .thumb {
    width: 80px;
    height: 80px;
    border-radius: 6px;
    object-fit: contain;
    background: white;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.orig-card .meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.orig-card .meta .name {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.orig-card .meta .dims {
    font-size: 12px;
    color: #6b7280;
}

.orig-card .meta .size {
    font-size: 12px;
    color: #9ca3af;
}

.orig-card .btn-remove {
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
    align-self: flex-start;
}

.orig-card .btn-remove:hover {
    color: #dc2626;
    background: #fef2f2;
}

/* ---- 目标格式选择 ---- */
.format-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.format-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
}

.format-card:hover {
    border-color: #667eea;
}

.format-card.active {
    border-color: #667eea;
    background: #eef2ff;
    color: #4338ca;
}

.format-card .fmt-icon {
    font-size: 22px;
}

.format-card .fmt-name {
    font-size: 13px;
    font-weight: 600;
}

.format-card .fmt-desc {
    font-size: 11px;
    color: #9ca3af;
}

.format-card.active .fmt-desc {
    color: #4338ca;
}

.format-card.current {
    opacity: 0.5;
    cursor: not-allowed;
    border-style: dashed;
}

.format-card.current .fmt-icon {
    filter: grayscale(0.5);
}

/* ---- 质量区 ---- */
.quality-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quality-row input[type="range"] {
    flex: 1;
    accent-color: #667eea;
    cursor: pointer;
}

.quality-row .val {
    font-size: 13px;
    font-weight: 600;
    color: #667eea;
    min-width: 36px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.quality-note {
    font-size: 11px;
    color: #9ca3af;
    margin-top: -6px;
}

/* ---- 预览面板 ---- */
.preview-box {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    min-height: 300px;
}

.preview-box img {
    max-width: 100%;
    max-height: 420px;
    display: block;
    border-radius: 4px;
}

/* ---- 转换统计卡 ---- */
.stats-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.stats-card .stat {
    text-align: center;
    flex: 1;
    min-width: 80px;
}

.stats-card .stat .label {
    font-size: 11px;
    opacity: 0.8;
}

.stats-card .stat .value {
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.stats-card .stat .value.smaller {
    color: #bbf7d0;
}

.stats-card .stat .value.larger {
    color: #fecaca;
}

.stats-card .stat .value.same {
    opacity: 0.9;
}

.stats-card .arrow {
    font-size: 24px;
    opacity: 0.6;
}

/* ---- 说明区 ---- */
.info-content {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.info-item {
    padding: 12px 16px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #667eea;
    color: #4b5563;
    line-height: 1.6;
    font-size: 13px;
}

.info-item strong {
    color: #374151;
}

/* ---- 两张图并排对比 ---- */
.compare-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.compare-box {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.compare-box .tag {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.compare-box img {
    max-width: 100%;
    max-height: 260px;
    border-radius: 4px;
}

.compare-box .info {
    margin-top: 8px;
    font-size: 12px;
    color: #6b7280;
}

.compare-box .info .size {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ---- 图片预览弹窗 ---- */
.img-preview-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.img-preview-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.img-preview-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
}

.img-preview-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    z-index: 1;
}

.img-preview-img {
    display: block;
    border-radius: 4px;
    cursor: grab;
}

.img-preview-close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #374151;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    z-index: 10000;
    transition: background 0.2s;
}

.img-preview-close:hover {
    background: #fee2e2;
    color: #dc2626;
}

.compare-box img {
    cursor: zoom-in;
}

@media (max-width: 600px) {
    .format-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .compare-wrap {
        grid-template-columns: 1fr;
    }
    .stats-card {
        flex-direction: column;
        align-items: flex-start;
    }
    .stats-card .stat {
        min-width: 100%;
        text-align: left;
        display: flex;
        justify-content: space-between;
    }
}
