/* ============================================================
   七寻图片压缩 - 完整样式表
   融合主站简约人文风格，保留全部响应式与动效
   ============================================================ */

/* ---------- 全局重置 ---------- */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* ---------- 基础色调：融合主站暖灰人文感 ---------- */
body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f8f6f3;          /* 暖白背景，替代原冷灰蓝 */
    margin: 0;
    padding: 16px;
    color: #2c2c2c;               /* 加深文字颜色，提升阅读舒适度 */
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

/* ---------- 卡片：增加“纸感”与极淡层次 ---------- */
.card {
    background: #ffffff;
    border-radius: 24px;           /* 略微减小圆角，更显精致 */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    border: 1px solid #f0ede8;     /* 极细暖灰边框，增加质感 */
    padding: 20px 20px 28px;
    margin-bottom: 20px;
    transition: box-shadow 0.3s ease;
}

/* ---------- 标题与徽章：大地色系点缀 ---------- */
h1 {
    font-size: 1.7rem;
    font-weight: 600;
    margin: 0 0 6px;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.badge {
    background: #efe8e0;           /* 暖灰棕，替代原蓝色 */
    color: #5a4a3a;
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 40px;
    font-weight: 500;
}

.sub {
    color: #555;
    margin-bottom: 20px;
    font-size: 0.85rem;
    border-left: 3px solid #c4b5a5; /* 棕色调左边框 */
    padding-left: 12px;
}

/* ---------- 上传区域：柔和交互 ---------- */
.upload-area {
    border: 2px dashed #ddd6ce;
    border-radius: 28px;
    padding: 28px 16px;
    text-align: center;
    background: #fcfbf9;
    cursor: pointer;
    transition: all 0.25s ease;
    margin-bottom: 20px;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: #b8aa9a;          /* 悬停时暖棕色边框 */
    background: #f8f5f0;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.04);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 8px;
    display: block;
}

.file-input {
    display: none;
}

/* ---------- 控制栏：保持清爽 ---------- */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-bottom: 24px;
    background: #faf8f5;           /* 极暖灰背景，替代原冷灰 */
    padding: 16px;
    border-radius: 28px;
}

.control-item {
    flex: 1;
    min-width: 130px;
}

.control-item label {
    font-weight: 600;
    font-size: 0.8rem;
    color: #3d3d3d;
    display: block;
    margin-bottom: 6px;
}

/* ---------- 表单控件：统一圆角与边框 ---------- */
select,
input[type="range"],
input[type="text"],
input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border-radius: 60px;
    border: 1px solid #e2e0db;
    background: white;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

select:focus,
input[type="text"]:focus {
    outline: none;
    border-color: #b8aa9a;
    box-shadow: 0 0 0 3px rgba(184, 170, 154, 0.15);
}

/* 自定义下拉箭头 */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236a5a4a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 36px;
    cursor: pointer;
}
select::-ms-expand {
    display: none;
}

/* 滑块 - 棕色调 */
input[type="range"] {
    padding: 0;
    accent-color: #b8aa9a;
    height: 4px;
    background: #e2e0db;
    border-radius: 4px;
    cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #b8aa9a;
    cursor: pointer;
    transition: transform 0.2s ease;
}
input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.12);
}
input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #b8aa9a;
    cursor: pointer;
    border: none;
}

.value-display {
    font-size: 0.75rem;
    color: #8a7a6a;
    margin-top: 4px;
    text-align: right;
}

/* ---------- 水印区域：素雅暖调 ---------- */
.watermark-section {
    background: #f6f3ef;           /* 极暖灰，替代原亮黄 */
    border-radius: 24px;
    padding: 16px 20px;
    margin-bottom: 20px;
    border: 1px solid #e5ddd5;
    transition: border-color 0.3s ease;
}

.watermark-section-title {
    font-weight: 600;
    color: #5a4a3a;
    margin-bottom: 16px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5ddd5;
}

.watermark-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.watermark-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.watermark-field label {
    font-size: 0.75rem;
    color: #6a5a4a;
    margin-bottom: 0;
}

.watermark-field select,
.watermark-field input {
    background: white;
    border-color: #e5ddd5;
}

.watermark-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px dashed #e5ddd5;
}

.watermark-size-group {
    flex: 2;
    min-width: 130px;
}
.watermark-opacity-group {
    flex: 1;
    min-width: 110px;
}
.watermark-margin-group {
    flex: 1;
    min-width: 110px;
}

.watermark-preview {
    background: #f0ebe5;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.75rem;
    color: #5a4a3a;
    margin-top: 12px;
    transition: background 0.3s ease;
}

/* ---------- 进度条：暖色填充 ---------- */
.progress-bar-container {
    background: #e5e0d8;
    border-radius: 40px;
    height: 8px;
    margin: 12px 0;
    overflow: hidden;
}

.progress-bar-fill {
    background: #b8aa9a;           /* 暖棕替代蓝色 */
    width: 0%;
    height: 100%;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 40px;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #6a5a4a;
    margin-top: 4px;
}

/* ---------- 图片列表：卡片式展示 ---------- */
.image-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-right: 4px;
}

.image-item {
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    border: 1px solid #f0ede8;
    overflow: hidden;
    transition: all 0.25s ease;
}

.image-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #fcfbf9;
    border-bottom: 1px solid #f0ede8;
    flex-wrap: wrap;
    gap: 8px;
}

.item-name {
    font-weight: 600;
    font-size: 0.85rem;
    word-break: break-all;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-status {
    font-size: 0.7rem;
    background: #efe8e0;           /* 暖灰替代蓝色 */
    padding: 4px 10px;
    border-radius: 50px;
    color: #5a4a3a;
}

.preview-dual {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px;
    background: #fcfbf9;
}

.preview-box {
    flex: 1;
    min-width: 130px;
    text-align: center;
}

.preview-img {
    max-width: 100%;
    max-height: 140px;
    border-radius: 16px;
    object-fit: contain;
    background: #f1eee9;
    margin-bottom: 8px;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.preview-img:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.preview-placeholder {
    background: #f1eee9;
    border-radius: 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    width: 100%;
}

.size-text {
    font-size: 0.7rem;
    color: #6a5a4a;
}

/* ---------- 操作按钮 ---------- */
.item-actions {
    padding: 12px 16px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid #f0ede8;
}

.btn-small {
    border: none;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 40px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-download {
    background: #2c2c2c;           /* 深色替代蓝色 */
    color: white;
}
.btn-download:hover {
    background: #1a1a1a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-delete {
    background: #f1f0ed;
    color: #3d3d3d;
    border: 1px solid #ddd6ce;
}
.btn-delete:hover {
    background: #fde8e8;
    border-color: #fccccc;
    transform: translateY(-2px);
}

/* ---------- 按钮与批量操作栏 ---------- */
.batch-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.batch-bar-left {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    background: #2c2c2c;           /* 深色主按钮 */
    color: #f8f6f3;
    border: none;
    padding: 10px 20px;
    border-radius: 60px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    background: #1a1a1a;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #f0ede8;
    color: #3d3d3d;
    border: 1px solid #ddd6ce;
}
.btn-secondary:hover {
    background: #e5e0d8;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

/* ---------- 加载动画 ---------- */
.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #e5e0d8;
    border-top-color: #b8aa9a;     /* 暖色替代蓝色 */
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---------- Toast 提示 ---------- */
.toast-msg {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #2c2c2cb3;
    backdrop-filter: blur(8px);
    color: white;
    padding: 8px 20px;
    border-radius: 60px;
    font-size: 0.8rem;
    z-index: 1000;
    pointer-events: none;
    animation: toastFade 2.5s ease forwards;
}
@keyframes toastFade {
    0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
    15% { opacity: 1; transform: translateX(-50%) translateY(0); }
    85% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* ---------- 模态框（图片放大预览） ---------- */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    cursor: pointer;
    animation: modalFade 0.3s ease;
}
@keyframes modalFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
    animation: modalZoom 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modalZoom {
    from { transform: translate(-50%, -50%) scale(0.9); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    z-index: 2001;
}
.modal-close:hover {
    color: #bbb;
}

/* ---------- 页脚 ---------- */
footer {
    text-align: center;
    font-size: 0.7rem;
    color: #b5aaa0;
    margin: 24px 0 12px;
}

/* ============================================================
   响应式设计 - 完整保留并优化移动端适配
   ============================================================ */

@media (max-width: 640px) {
    .card {
        padding: 16px;
        border-radius: 20px;
    }

    .preview-dual {
        flex-direction: column;
    }

    .batch-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .batch-bar-left {
        justify-content: center;
    }
    .btn {
        justify-content: center;
    }

    .controls .control-item {
        min-width: 100%;
    }

    .watermark-grid {
        grid-template-columns: 1fr;
    }
    .watermark-row {
        flex-direction: column;
        align-items: stretch;
    }

    select {
        padding: 12px 36px 12px 14px;
        background-position: right 16px center;
    }

    .item-name {
        max-width: 150px;
    }

    .preview-placeholder {
        min-height: 100px;
    }

    /* 移动端触摸优化 */
    .upload-area {
        padding: 20px 12px;
    }
    .upload-icon {
        font-size: 36px;
    }

    .modal-content {
        max-width: 95%;
        max-height: 85%;
        border-radius: 12px;
    }
    .modal-close {
        top: 12px;
        right: 20px;
        font-size: 32px;
    }

    .item-actions {
        flex-wrap: wrap;
        justify-content: center;
    }
    .btn-small {
        flex: 1;
        min-width: 80px;
        text-align: center;
    }
}

/* ---------- 极小型设备 (宽度 < 400px) ---------- */
@media (max-width: 400px) {
    body {
        padding: 10px;
    }
    .card {
        padding: 12px;
    }
    h1 {
        font-size: 1.3rem;
    }
    .controls {
        padding: 12px;
        gap: 12px;
    }
    .watermark-section {
        padding: 12px 14px;
    }
}

/* ---------- 暗色模式适配 (与主站"日落了"呼应) ---------- */
@media (prefers-color-scheme: dark) {
    body {
        background: #1e1c1a;
        color: #d5d0ca;
    }
    .card {
        background: #2a2826;
        border-color: #3a3532;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    }
    h1 {
        color: #e8e3dc;
    }
    .badge {
        background: #3a3532;
        color: #c4b5a5;
    }
    .sub {
        color: #a8a09a;
        border-left-color: #5a4a3a;
    }
    .upload-area {
        background: #2a2826;
        border-color: #4a4542;
    }
    .upload-area:hover,
    .upload-area.drag-over {
        border-color: #b8aa9a;
        background: #33302d;
    }
    .controls {
        background: #2a2826;
    }
    .control-item label {
        color: #c4b5a5;
    }
    select,
    input[type="text"] {
        background: #1e1c1a;
        border-color: #4a4542;
        color: #d5d0ca;
    }
    select {
        background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a8a09a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
    }
    input[type="range"] {
        background: #3a3532;
    }
    .value-display {
        color: #a8a09a;
    }
    .watermark-section {
        background: #2a2826;
        border-color: #3a3532;
    }
    .watermark-section-title {
        color: #c4b5a5;
        border-bottom-color: #3a3532;
    }
    .watermark-field label {
        color: #a8a09a;
    }
    .watermark-field select,
    .watermark-field input {
        background: #1e1c1a;
        border-color: #3a3532;
        color: #d5d0ca;
    }
    .watermark-row {
        border-top-color: #3a3532;
    }
    .watermark-preview {
        background: #1e1c1a;
        color: #c4b5a5;
    }
    .progress-bar-container {
        background: #3a3532;
    }
    .progress-bar-fill {
        background: #b8aa9a;
    }
    .progress-stats {
        color: #a8a09a;
    }
    .image-item {
        background: #2a2826;
        border-color: #3a3532;
    }
    .image-item:hover {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    }
    .item-header {
        background: #2a2826;
        border-bottom-color: #3a3532;
    }
    .item-status {
        background: #3a3532;
        color: #c4b5a5;
    }
    .preview-dual {
        background: #2a2826;
    }
    .preview-img {
        background: #1e1c1a;
    }
    .preview-placeholder {
        background: #1e1c1a;
    }
    .size-text {
        color: #a8a09a;
    }
    .item-actions {
        border-top-color: #3a3532;
    }
    .btn-download {
        background: #b8aa9a;
        color: #1e1c1a;
    }
    .btn-download:hover {
        background: #c4b5a5;
    }
    .btn-delete {
        background: #3a3532;
        color: #d5d0ca;
        border-color: #4a4542;
    }
    .btn-delete:hover {
        background: #4a3535;
        border-color: #6a4545;
    }
    .btn {
        background: #b8aa9a;
        color: #1e1c1a;
    }
    .btn:hover {
        background: #c4b5a5;
    }
    .btn-secondary {
        background: #3a3532;
        color: #d5d0ca;
        border-color: #4a4542;
    }
    .btn-secondary:hover {
        background: #4a4542;
    }
    .loading-spinner {
        border-color: #3a3532;
        border-top-color: #b8aa9a;
    }
    .toast-msg {
        background: #1e1c1ab3;
        color: #d5d0ca;
    }
    footer {
        color: #4a4542;
    }
    .modal {
        background-color: rgba(0, 0, 0, 0.92);
    }
}