/* =============================================
   广广小助手 — 工具页面通用样式 (iOS 拟物风)
   ============================================= */

/* ---- Tool Page Layout ---- */
.tool-page-bg {
    min-height: 100vh;
    background: var(--ios-bg);
}

/* Breadcrumb */
.breadcrumb {
    max-width: 900px;
    margin: 0 auto;
    padding: 14px 24px 0;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.breadcrumb a {
    color: var(--blue);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb-sep {
    color: #c7c7cc;
}

/* ---- Tool Hero ---- */
.tool-hero {
    max-width: 900px;
    margin: 0 auto;
    padding: 28px 24px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.tool-hero-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    flex-shrink: 0;
}

.tool-hero-icon img {
    width: 32px;
    height: 32px;
}

.tool-hero-text h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.tool-hero-text p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ---- Main Tool Panel ---- */
.tool-panel {
    max-width: 900px;
    margin: 0 auto 40px;
    padding: 0 24px;
}

/* ---- Upload Zone (iOS Card Style) ---- */
.upload-card {
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    margin-bottom: 20px;
}

.upload-zone {
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    border: 2px dashed rgba(0, 0, 0, 0);
    transition: all var(--transition);
    position: relative;
}

.upload-zone:hover,
.upload-zone.drag-over {
    background: rgba(0, 122, 255, 0.03);
}

.upload-zone.drag-over {
    border-color: var(--blue);
    border-style: dashed;
}

.upload-zone input[type=file] {
    display: none;
}

.upload-icon-wrap {
    width: 80px;
    height: 80px;
    margin: 0 auto 18px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-icon);
}

.upload-icon-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.35), transparent);
    border-radius: 20px 20px 0 0;
}

.upload-icon-wrap img,
.upload-icon-wrap svg {
    position: relative;
    z-index: 1;
}

.upload-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.upload-title span {
    color: var(--blue);
}

.upload-hint {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.upload-formats {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.fmt-tag {
    padding: 4px 12px;
    background: rgba(0, 122, 255, 0.08);
    border: 1px solid rgba(0, 122, 255, 0.15);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: var(--blue);
    letter-spacing: 0.3px;
}

/* ---- File List ---- */
.file-section {
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    margin-bottom: 16px;
    display: none;
}

.file-section.visible {
    display: block;
}

.file-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 0.5px solid var(--ios-separator);
    flex-wrap: wrap;
    gap: 10px;
}

.file-section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-count-pill {
    background: var(--blue);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
}

.file-head-actions {
    display: flex;
    gap: 8px;
}

/* Ghost Button */
.btn-ghost-sm {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 0.5px solid rgba(0, 0, 0, 0.1);
    background: var(--ios-bg);
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-ghost-sm:hover {
    background: var(--ios-bg2);
    color: var(--text-primary);
}

/* Drag instruction */
.drag-instruction {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 20px;
    font-size: 12px;
    color: var(--text-tertiary);
    background: rgba(0, 0, 0, 0.01);
    border-bottom: 0.5px solid var(--ios-separator);
}

/* File Grid (card thumbnails) */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
    padding: 16px 20px;
}

/* File Card (thumbnail) */
.file-thumb-card {
    background: var(--ios-bg);
    border-radius: 14px;
    overflow: hidden;
    cursor: grab;
    border: 1.5px solid transparent;
    transition: all var(--transition);
    position: relative;
    user-select: none;
    animation: cardAppear 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: scale(0.85);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.file-thumb-card:hover {
    border-color: rgba(0, 122, 255, 0.3);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.file-thumb-card.dragging {
    opacity: 0.4;
    cursor: grabbing;
}

.file-thumb-card.drag-target {
    border-color: var(--blue);
    background: rgba(0, 122, 255, 0.04);
}

.card-order-badge {
    position: absolute;
    top: 7px;
    left: 7px;
    width: 22px;
    height: 22px;
    background: var(--blue);
    color: white;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    box-shadow: 0 2px 6px rgba(0, 122, 255, 0.3);
}

.card-delete-btn {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 22px;
    height: 22px;
    background: rgba(255, 59, 48, 0.12);
    border: 0.5px solid rgba(255, 59, 48, 0.25);
    border-radius: 6px;
    color: var(--red);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition);
    z-index: 3;
    font-family: inherit;
}

.file-thumb-card:hover .card-delete-btn {
    opacity: 1;
}

.thumb-preview {
    aspect-ratio: 3/4;
    background: linear-gradient(145deg, #e8eaf6, #f3e5f5);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.04);
}

.thumb-preview canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.thumb-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100%;
    color: var(--text-tertiary);
    font-size: 11px;
}

.thumb-info {
    padding: 8px 10px;
}

.thumb-name {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.thumb-meta {
    display: flex;
    justify-content: space-between;
    font-size: 10.5px;
    color: var(--text-tertiary);
}

.thumb-pages {
    color: var(--blue);
    font-weight: 600;
}

/* Drag handle bottom dots */
.thumb-drag-handle {
    text-align: center;
    padding: 4px 0 2px;
    color: var(--text-tertiary);
}

/* ---- Info Summary Bar ---- */
.info-summary {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    padding: 16px 20px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    margin-bottom: 16px;
}

.info-col {
    text-align: center;
    padding: 0 16px;
    border-right: 0.5px solid var(--ios-separator);
}

.info-col:last-child {
    border-right: none;
}

.info-col-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.info-col-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

/* ---- Options Panel ---- */
.options-card {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    padding: 18px 20px;
    margin-bottom: 16px;
}

.options-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 14px;
}

.options-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 0.5px solid var(--ios-separator);
}

.options-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.options-row label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.options-row select {
    background: var(--ios-bg);
    border: 0.5px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    min-width: 120px;
}

.options-row input[type=text],
.options-row input[type=number] {
    background: var(--ios-bg);
    border: 0.5px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    outline: none;
    min-width: 120px;
    text-align: right;
}

.options-row input:focus,
.options-row select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.15);
}

/* Quality Slider */
.quality-slider-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
}

.quality-slider {
    -webkit-appearance: none;
    width: 140px;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(to right, var(--blue) 0%, var(--blue) var(--progress, 75%), var(--ios-bg2) var(--progress, 75%), var(--ios-bg2) 100%);
    outline: none;
    cursor: pointer;
}

.quality-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2), 0 0 0 0.5px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

.quality-val {
    font-size: 13px;
    font-weight: 600;
    color: var(--blue);
    min-width: 32px;
}

/* ---- iOS-style Primary Button ---- */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 52px;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    color: white;
    position: relative;
    overflow: hidden;
    transition: all var(--transition);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 14px 14px 0 0;
}

.btn-primary:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.btn-primary:active {
    transform: translateY(0);
    filter: brightness(0.95);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-blue {
    background: linear-gradient(145deg, #409eff, #007aff, #0055d4);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.35);
}

.btn-indigo {
    background: linear-gradient(145deg, #7e80e6, #5856d6, #3634a3);
    box-shadow: 0 4px 12px rgba(88, 86, 214, 0.35);
}

.btn-green {
    background: linear-gradient(145deg, #5de079, #34c759, #248a3d);
    box-shadow: 0 4px 12px rgba(52, 199, 89, 0.35);
}

.btn-orange {
    background: linear-gradient(145deg, #ffb142, #ff9500, #cc7700);
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.35);
}

.btn-red {
    background: linear-gradient(145deg, #ff6961, #ff3b30, #c0392b);
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.35);
}

.btn-pink {
    background: linear-gradient(145deg, #ff638a, #ff2d55, #d60041);
    box-shadow: 0 4px 12px rgba(255, 45, 85, 0.35);
}

.btn-teal {
    background: linear-gradient(145deg, #7eddff, #5ac8fa, #0071a4);
    box-shadow: 0 4px 12px rgba(90, 200, 250, 0.35);
}

.btn-purple {
    background: linear-gradient(145deg, #c56cee, #af52de, #8944b2);
    box-shadow: 0 4px 12px rgba(175, 82, 222, 0.35);
}

.action-note {
    text-align: center;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 10px;
}

/* ---- Progress Sheet ---- */
.progress-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    pointer-events: none;
    transition: background 0.3s;
}

.progress-overlay.open {
    background: rgba(0, 0, 0, 0.5);
    pointer-events: all;
}

.progress-sheet {
    background: white;
    border-radius: 28px 28px 0 0;
    padding: 12px 28px 48px;
    width: 100%;
    max-width: 600px;
    transform: translateY(110%);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 -4px 40px rgba(0, 0, 0, 0.12);
}

.progress-overlay.open .progress-sheet {
    transform: translateY(0);
}

.progress-handle {
    width: 36px;
    height: 4px;
    background: var(--ios-separator);
    border-radius: 2px;
    margin: 0 auto 24px;
}

.progress-status-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-icon);
    position: relative;
    overflow: hidden;
}

.progress-status-icon::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.3), transparent);
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    position: relative;
    z-index: 1;
}

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

.progress-title {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.progress-subtitle {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.progress-bar-bg {
    height: 6px;
    background: var(--ios-bg2);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #5856d6, #007aff);
    transition: width 0.3s ease;
}

.progress-pct {
    text-align: right;
    font-size: 12px;
    font-weight: 600;
    color: var(--blue);
}

/* ---- How to use steps ---- */
.how-to-card {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    padding: 20px 20px;
    margin-top: 24px;
}

.how-to-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.step-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.step-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.step-num {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: linear-gradient(145deg, #7e80e6, #5856d6);
    color: white;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(88, 86, 214, 0.3);
}

.step-text {
    font-size: 13.5px;
    color: var(--text-primary);
    line-height: 1.5;
    padding-top: 2px;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .tool-panel {
        padding: 0 12px;
    }

    .tool-hero {
        padding: 20px 16px 16px;
        gap: 14px;
    }

    .tool-hero-icon {
        width: 52px;
        height: 52px;
        border-radius: 13px;
    }

    .tool-hero-text h1 {
        font-size: 20px;
    }

    .file-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
        padding: 12px;
    }

    .info-summary {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .info-col {
        border-right: none;
        border-bottom: 0.5px solid var(--ios-separator);
        padding: 8px 0;
    }

    .info-col:last-child {
        border-bottom: none;
    }

    .options-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .options-row input[type=text],
    .options-row input[type=number],
    .options-row select {
        width: 100%;
        text-align: left;
    }

    .progress-sheet {
        padding: 12px 20px 32px;
    }
}