:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #10b981;
    --light: #f8fafc;
    --dark: #1e293b;
    --gray: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, "Microsoft YaHei", sans-serif;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: 2rem;
}

/* 顶部导航 */
.hd {
    width: 100%;
    height: 50px;
    background-color: #0e90d2;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.hd .link-list {
    padding: 0 16px;
    height: 50px;
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 24px;
}

.hd .link-list a {
    font-size: 16px;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    transition: 0.2s;
}

.hd .link-list a:hover {
    font-weight: bold;
    opacity: 0.9;
}

/* 主体内容 */
.container {
    width: 100%;
    max-width: none;
    margin: 5rem 0;
    padding: 0 15rem;
}

.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 2rem;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-body {
    padding: 1.5rem;
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 1.5rem;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
    margin-bottom: 1.5rem;
    position: relative;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background-color: #f0f9ff;
}

.upload-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.upload-text {
    margin-bottom: 1rem;
}

.btn {
    display: inline-block;
    background-color: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
    text-align: center;
}

.btn:hover {
    background-color: var(--primary-dark);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-secondary {
    background-color: var(--secondary);
}

.btn-secondary:hover {
    background-color: #0da271;
}

.btn:disabled {
    background-color: var(--gray);
    cursor: not-allowed;
}

.control-group {
    margin-bottom: 1.5rem;
}

.control-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.slider {
    flex: 1;
    -webkit-appearance: none;
    height: 8px;
    border-radius: 4px;
    background: #d1d5db;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

.slider-value {
    min-width: 60px;
    text-align: right;
    font-weight: 600;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.stats-box {
    background-color: #f8fafc;
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-top: 1.5rem;
    display: flex;
    justify-content: space-around;
    text-align: center;
}

.stat-item {
    padding: 0 1rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray);
}

.positive {
    color: var(--secondary);
}

/* 多图片样式 */
.image-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
    max-height: 600px;
    overflow-y: auto;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.image-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background-color: #f8fafc;
    transition: transform 0.2s;
}

.image-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.image-comparison {
    display: flex;
    width: 100%;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.image-preview {
    flex: 1;
    text-align: center;
}

.preview-title {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.image-thumbnail {
    width: 100%;
    height: 120px;
    object-fit: contain;
    border-radius: 4px;
    background-color: #e2e8f0;
    border: 1px solid var(--border);
}

.image-info {
    font-size: 0.7rem;
    color: var(--gray);
    margin-top: 0.25rem;
}

.image-name {
    font-size: 0.75rem;
    text-align: center;
    word-break: break-all;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.image-status {
    font-size: 0.7rem;
    margin-top: 0.25rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    width: 100%;
    text-align: center;
}

.status-pending {
    color: #64748b;
    background-color: #f1f5f9;
}

.status-processing {
    color: #2563eb;
    background-color: #dbeafe;
}

.status-completed {
    color: #059669;
    background-color: #d1fae5;
}

.status-error {
    color: #dc2626;
    background-color: #fee2e2;
}

.batch-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
    padding: 1rem;
    background-color: #f1f5f9;
    border-radius: var(--radius);
}

.batch-stat-item {
    text-align: center;
}

.batch-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.batch-stat-label {
    font-size: 0.875rem;
    color: var(--gray);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .action-buttons {
        flex-direction: column;
    }

    .image-list {
        grid-template-columns: 1fr;
    }

    .batch-stats {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .image-comparison {
        flex-direction: column;
    }

    .image-thumbnail {
        height: 150px;
    }
}

/* 页脚 */
footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--gray);
    font-size: 0.875rem;
    margin-top: 2rem;
}

/* 加载动画 */
.spinner {
    width: 40px;
    height: 40px;
    margin: 1rem auto;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* 文件信息 */
.file-info {
    background-color: #f1f5f9;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    display: none;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background-color: #e2e8f0;
    border-radius: 3px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.progress {
    height: 100%;
    background-color: var(--primary);
    width: 0%;
    transition: width 0.3s;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--gray);
    grid-column: 1 / -1;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #cbd5e1;
}

.size-comparison {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: 0.5rem;
}

.size-item {
    text-align: center;
    flex: 1;
}

.size-value {
    font-size: 0.8rem;
    font-weight: 600;
}

.size-label {
    font-size: 0.65rem;
    color: var(--gray);
}

.reduction-badge {
    background-color: var(--secondary);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 0.8rem;
}



/* 图片放大模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    margin: auto;
    padding: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    top: 50%;
    transform: translateY(-50%);
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    color: var(--text-color);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.close:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: scale(1.1);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#modalImage {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 8px;
    background: #f5f5f5;
}

.modal-info {
    padding: 15px;
    background: var(--bg-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-color);
}

.modal-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.modal-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--card-bg);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.stat-label {
    font-weight: 500;
    color: var(--text-color);
}

.stat-value {
    color: var(--primary-color);
    font-weight: 600;
}

/* 为图片添加悬停效果 */
.image-thumbnail {
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.image-thumbnail:hover {
    transform: scale(1.05);
    border-color: var(--primary-color);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        padding: 15px;
    }
    
    .modal-stats {
        grid-template-columns: 1fr;
    }
    
    #modalImage {
        max-height: 60vh;
    }
}

.info-box h2 {
    position: relative; /* 关键 */
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
    display: flex;
    align-items: center;
}

.info-box h2::after {
    content: '';
    position: absolute;
    bottom: -4px;       /* 下划线离文本的距离 */
    left: 0;
    width: 60px;        /* 下划线长度 */
    height: 2px;        /* 下划线粗细 */
    background: linear-gradient(90deg, #3498db, transparent);
}

.info-box {
    background-color: #f8fafc;
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 40px;
    border-left: 4px solid #3498db;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
     /* 宽度和上方 container 内卡片一致 */
}

.info-box h2 {
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
    display: flex;
    align-items: center;
}

.info-box h2 i {
    color: #3498db;
    margin-right: 10px;
}

.info-box p {
    color: #7f8c8d;
    margin: 10px 0;
    line-height: 1.6;
}
