/* ============================================================
   图片合并PDF - 样式表
   响应式设计，PC + 移动端适配
   ============================================================ */

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    color: #333;
    background: #f5f7fa;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 16px;
}

a {
    color: #4a90d9;
    text-decoration: none;
}

/* ---------- Header ---------- */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 40px 0 36px;
    text-align: center;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.header .subtitle {
    font-size: 0.95rem;
    opacity: 0.9;
}

/* ---------- Main ---------- */
.main {
    padding: 24px 0 48px;
}

/* ---------- Tool Navigation ---------- */
.tool-nav {
    background: #fff;
    border-bottom: 1px solid #ebeef5;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tool-nav .container {
    display: flex;
    gap: 0;
    white-space: nowrap;
}

.tool-nav a {
    display: inline-block;
    padding: 12px 18px;
    font-size: 0.9rem;
    color: #666;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.tool-nav a:hover {
    color: #667eea;
    border-bottom-color: #c0c4cc;
}

.tool-nav a.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 600;
}

/* ---------- Upload Area ---------- */
.upload-section {
    margin-bottom: 24px;
}

.upload-area {
    border: 2px dashed #c0c4cc;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    background: #fff;
    transition: border-color 0.3s, background-color 0.3s, box-shadow 0.3s;
    cursor: pointer;
    position: relative;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #667eea;
    background: #f0f2ff;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.upload-area.has-images {
    padding: 20px;
}

.upload-icon {
    color: #909399;
    margin-bottom: 12px;
    transition: color 0.3s;
}

.upload-area:hover .upload-icon,
.upload-area.dragover .upload-icon {
    color: #667eea;
}

.upload-text {
    margin-bottom: 16px;
}

.upload-primary {
    font-size: 1.05rem;
    font-weight: 500;
    color: #555;
    margin-bottom: 4px;
}

.upload-hint {
    font-size: 0.85rem;
    color: #999;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 24px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    user-select: none;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.btn-primary:hover {
    background: #5a6fd6;
    border-color: #5a6fd6;
}

.btn-outline {
    background: #fff;
    color: #555;
    border-color: #d0d5dd;
}

.btn-outline:hover {
    border-color: #667eea;
    color: #667eea;
}

.btn-danger {
    background: #fff;
    color: #e74c3c;
    border-color: #e74c3c;
}

.btn-danger:hover {
    background: #e74c3c;
    color: #fff;
}

.btn-lg {
    padding: 14px 36px;
    font-size: 1.1rem;
    border-radius: 10px;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
}

/* ---------- Image Section ---------- */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.section-header h2 {
    font-size: 1.15rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #667eea;
    color: #fff;
    font-size: 0.8rem;
    min-width: 24px;
    height: 24px;
    border-radius: 12px;
    padding: 0 6px;
}

.section-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.drag-hint {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    color: #909399;
    margin-bottom: 12px;
}

/* ---------- Image List ---------- */
.image-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Image item (li) 保留语义，但 Sortable 可能变成 li > div 包裹 */
.image-list .image-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1px solid #ebeef5;
    border-radius: 10px;
    padding: 10px 12px;
    cursor: grab;
    transition: box-shadow 0.2s, border-color 0.2s;
    user-select: none;
}

.image-list .image-item:active {
    cursor: grabbing;
}

.image-list .image-item:hover {
    border-color: #c0c4cc;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.image-list .image-item.sortable-chosen {
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.25);
    border-color: #667eea;
    background: #f8f9ff;
}

.image-list .image-item.sortable-ghost {
    opacity: 0.4;
    border-style: dashed;
    background: #f0f2ff;
}

/* Drag handle */
.drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #909399;
    flex-shrink: 0;
    padding: 4px;
    cursor: grab;
    border-radius: 4px;
    transition: color 0.2s, background-color 0.2s;
}

.drag-handle:hover {
    color: #667eea;
    background-color: rgba(102, 126, 234, 0.08);
}

.drag-handle:active {
    cursor: grabbing;
    color: #4a5fd6;
}

.drag-handle svg {
    display: block;
}

/* Thumbnail */
.item-thumb {
    width: 72px;
    height: 54px;
    object-fit: cover;
    border-radius: 6px;
    background: #f0f0f0;
    flex-shrink: 0;
}

/* Item info */
.item-info {
    flex: 1;
    min-width: 0;
}

.item-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-meta {
    font-size: 0.78rem;
    color: #909399;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Item actions */
.item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.item-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ebeef5;
    border-radius: 6px;
    background: #fff;
    color: #909399;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.item-btn:hover {
    border-color: #e74c3c;
    color: #e74c3c;
}

.no-image-msg {
    text-align: center;
    color: #999;
    padding: 24px 0;
    font-size: 0.9rem;
}

/* ---------- Action Section ---------- */
.action-section {
    text-align: center;
    padding: 24px 0 0;
}

.action-hint {
    font-size: 0.85rem;
    color: #999;
    margin-top: 10px;
}

/* ---------- Loading Overlay ---------- */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e0e0e0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay > p:first-of-type {
    font-size: 1.05rem;
    font-weight: 500;
    color: #555;
}

.loading-sub {
    font-size: 0.85rem;
    color: #999;
    margin-top: 4px;
}

/* ---------- Info Section (SEO) ---------- */
.info-section {
    padding: 40px 0;
}

.info-section:nth-child(even) {
    background: #fff;
    border-top: 1px solid #ebeef5;
    border-bottom: 1px solid #ebeef5;
}

.info-section h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: #333;
}

.feature-list {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.feature-list li {
    padding: 12px 16px;
    background: #fafafa;
    border-radius: 8px;
    font-size: 0.93rem;
    line-height: 1.7;
}

.feature-list li strong {
    color: #667eea;
}

.step-list {
    padding-left: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.step-list li {
    font-size: 0.93rem;
    line-height: 1.7;
    padding-left: 4px;
}

.step-list li::marker {
    color: #667eea;
    font-weight: 700;
}

.faq-list dt {
    font-weight: 600;
    font-size: 0.95rem;
    color: #333;
    margin-top: 16px;
    margin-bottom: 4px;
}

.faq-list dt:first-child {
    margin-top: 0;
}

.faq-list dd {
    font-size: 0.9rem;
    color: #666;
    margin-left: 0;
    margin-bottom: 8px;
    line-height: 1.7;
}

/* ---------- Footer ---------- */
.footer {
    background: #333;
    color: #999;
    text-align: center;
    padding: 20px 0;
    font-size: 0.85rem;
}

/* ============================================================
   移动端适配
   ============================================================ */
@media (max-width: 640px) {
    .header {
        padding: 28px 0 24px;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .header .subtitle {
        font-size: 0.85rem;
    }

    .upload-area {
        padding: 28px 16px;
        border-radius: 10px;
    }

    .upload-primary {
        font-size: 0.95rem;
    }

    .image-list .image-item {
        padding: 8px 10px;
        gap: 8px;
        border-radius: 8px;
    }

    .item-thumb {
        width: 56px;
        height: 42px;
    }

    .item-name {
        font-size: 0.85rem;
    }

    .item-meta {
        font-size: 0.73rem;
    }

    .item-btn {
        width: 28px;
        height: 28px;
    }

    .btn {
        padding: 8px 18px;
        font-size: 0.9rem;
    }

    .btn-lg {
        width: 100%;
        padding: 14px 24px;
        font-size: 1rem;
    }

    .info-section {
        padding: 28px 0;
    }

    .info-section h2 {
        font-size: 1.15rem;
    }

    .feature-list {
        gap: 8px;
    }

    .feature-list li {
        font-size: 0.88rem;
        padding: 10px 12px;
    }
}

/* 小屏手机 */
@media (max-width: 380px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .section-actions {
        width: 100%;
    }

    .section-actions .btn {
        flex: 1;
        text-align: center;
    }
}

/* PC 宽屏 */
@media (min-width: 768px) {
    .feature-list {
        grid-template-columns: 1fr 1fr;
    }
}
