/* ============================================================
   Repair PDF Tool — repair-pdf.css
   Prefix: rp-
   Accent: #8B5CF6  (139, 92, 246)
   ============================================================ */

/* ── Accent override for tool-base shared classes ─────────── */
.rp-section {
    --tool-accent: #8B5CF6;
    --tool-accent-rgb: 139, 92, 246;
    padding: 40px 0 80px;
}

/* ── Section badge ─────────────────────────────────────────── */
.rp-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 18px;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.22);
    border-radius: 50px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #8B5CF6;
    margin-bottom: 12px;
}

.rp-badge i {
    font-size: 0.875rem;
}

/* ── Upload Zone ───────────────────────────────────────────── */
.rp-upload-zone {
    border: 2px dashed rgba(139, 92, 246, 0.32);
    border-radius: 16px;
    background: rgba(139, 92, 246, 0.03);
    padding: 56px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    outline: none;
}

.rp-upload-zone:hover,
.rp-upload-zone:focus-visible {
    border-color: rgba(139, 92, 246, 0.6);
    background: rgba(139, 92, 246, 0.07);
}

.rp-upload-zone.rp-drag-over {
    border-color: #8B5CF6;
    background: rgba(139, 92, 246, 0.1);
}

.rp-upload-icon {
    font-size: 3rem;
    color: #8B5CF6;
    opacity: 0.65;
    margin-bottom: 14px;
    display: block;
}

.rp-upload-title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 6px;
}

.rp-upload-sub {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0 0 10px;
}

.rp-upload-formats {
    font-size: 0.875rem;
    color: var(--text-light);
    margin: 0;
    letter-spacing: 0.01em;
}

/* ── Workspace ─────────────────────────────────────────────── */
.rp-workspace {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── File Info Bar ─────────────────────────────────────────── */
.rp-file-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    background: rgba(139, 92, 246, 0.04);
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 12px;
    flex-wrap: wrap;
}

.rp-file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.rp-file-icon {
    font-size: 1.75rem;
    color: #8B5CF6;
    flex-shrink: 0;
}

.rp-file-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.rp-file-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 360px;
}

.rp-file-meta {
    font-size: 0.8125rem;
    color: var(--text-light);
}

/* ── Options Panel ─────────────────────────────────────────── */
.rp-options-panel {
    background: rgba(139, 92, 246, 0.03);
    border: 1px solid rgba(139, 92, 246, 0.12);
    border-radius: 14px;
    padding: 8px 24px;
    display: flex;
    flex-direction: column;
}

.rp-option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 0;
    flex-wrap: wrap;
}

.rp-option-row--filename {
    align-items: center;
    gap: 12px;
}

.rp-options-divider {
    height: 1px;
    background: rgba(100, 116, 139, 0.1);
}

.rp-option-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.rp-option-label {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.rp-option-hint {
    font-size: 0.8125rem;
    color: var(--text-light);
    line-height: 1.45;
}

/* ── Toggle Switch ─────────────────────────────────────────── */
.rp-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 0;
}

.rp-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.rp-toggle-track {
    position: relative;
    width: 44px;
    height: 24px;
    background: rgba(100, 116, 139, 0.22);
    border-radius: 50px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.rp-toggle input:checked~.rp-toggle-track {
    background: #8B5CF6;
}

.rp-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #FFFFFF;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
    transition: transform 0.2s;
}

.rp-toggle input:checked~.rp-toggle-track .rp-toggle-thumb {
    transform: translateX(20px);
}

.rp-toggle:focus-within .rp-toggle-track {
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

/* ── Output filename ───────────────────────────────────────── */
.rp-output-input-wrap {
    display: flex;
    align-items: center;
    min-width: 200px;
    flex: 1;
    max-width: 320px;
}

.rp-output-input {
    flex: 1;
    height: 38px;
    padding: 0 12px;
    border: 1px solid rgba(100, 116, 139, 0.25);
    border-right: none;
    border-radius: 8px 0 0 8px;
    background: #FFFFFF;
    font-size: 0.9375rem;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s;
    min-width: 0;
}

.rp-output-input:focus {
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.08);
}

.rp-output-ext {
    display: flex;
    align-items: center;
    height: 38px;
    padding: 0 12px;
    background: rgba(100, 116, 139, 0.06);
    border: 1px solid rgba(100, 116, 139, 0.25);
    border-radius: 0 8px 8px 0;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-light);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Action Row ────────────────────────────────────────────── */
.rp-action-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.rp-btn-repair {
    min-width: 160px;
}

/* ── Progress Bar ──────────────────────────────────────────── */
.rp-progress-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rp-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(139, 92, 246, 0.12);
    border-radius: 99px;
    overflow: hidden;
}

.rp-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #8B5CF6, #A78BFA);
    border-radius: 99px;
    transition: width 0.3s ease;
}

.rp-progress-text {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin: 0;
    text-align: center;
}

/* ── Recovery Report Card ──────────────────────────────────── */
.rp-report {
    background: #FFFFFF;
    border: 1px solid rgba(100, 116, 139, 0.15);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.rp-report-header {
    padding: 20px 24px 18px;
    border-bottom: 1px solid rgba(100, 116, 139, 0.1);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.rp-report-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 700;
}

.rp-report-status--success {
    color: #15803D;
}

.rp-report-status--success i {
    font-size: 1.25rem;
    color: #16A34A;
}

.rp-report-status--fail {
    color: #DC2626;
}

.rp-report-status--fail i {
    font-size: 1.25rem;
    color: #DC2626;
}

.rp-report-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.rp-report-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.rp-report-stat i {
    color: #8B5CF6;
}

.rp-report-size-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.rp-report-stat-label {
    font-weight: 600;
    color: var(--text-light);
}

.rp-report-size-orig {
    color: var(--text-secondary);
}

.rp-report-size-arrow {
    color: var(--text-light);
    font-size: 0.75rem;
}

.rp-report-size-new {
    color: #16A34A;
    font-weight: 600;
}

.rp-report-items {
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rp-report-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.875rem;
    padding: 9px 12px;
    border-radius: 8px;
    line-height: 1.4;
}

.rp-report-item i {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.rp-report-item--success {
    background: rgba(22, 163, 74, 0.06);
    color: var(--text-secondary);
}

.rp-report-item--success i {
    color: #16A34A;
}

.rp-report-item--info {
    background: rgba(100, 116, 139, 0.06);
    color: var(--text-secondary);
}

.rp-report-item--info i {
    color: #64748B;
}

.rp-report-item--warning {
    background: rgba(234, 179, 8, 0.08);
    color: var(--text-secondary);
}

.rp-report-item--warning i {
    color: #CA8A04;
}

.rp-report-item--error {
    background: rgba(220, 38, 38, 0.06);
    color: var(--text-secondary);
}

.rp-report-item--error i {
    color: #DC2626;
}

/* ── Page Preview Grid ─────────────────────────────────────── */
.rp-preview-section {
    padding-top: 4px;
}

.rp-preview-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0 14px;
}

.rp-preview-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
}

.rp-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
    padding-bottom: 4px;
}

/* ── Preview Card ──────────────────────────────────────────── */
.rp-preview-card {
    border-radius: 10px;
    background: #FFFFFF;
    border: 1px solid rgba(100, 116, 139, 0.14);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    transition: box-shadow 0.15s, transform 0.1s;
}

.rp-preview-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.rp-preview-thumb {
    position: relative;
    aspect-ratio: 0.707;
    background: #F1F5F9;
    overflow: hidden;
}

.rp-preview-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.rp-preview-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #8B5CF6;
}

.rp-preview-placeholder i {
    font-size: 1.5rem;
    opacity: 0.35;
}

.rp-preview-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(139, 92, 246, 0.2);
    border-top-color: #8B5CF6;
    border-radius: 50%;
    animation: rp-spin 0.7s linear infinite;
}

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

.rp-preview-footer {
    padding: 6px 8px;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-top: 1px solid rgba(100, 116, 139, 0.08);
}

.rp-preview-more {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(139, 92, 246, 0.04);
    border: 1px dashed rgba(139, 92, 246, 0.25);
    padding: 0 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #8B5CF6;
    text-align: center;
    min-height: 80px;
    aspect-ratio: 0.707;
}

/* ── Download Panel ────────────────────────────────────────── */
.rp-download-panel {
    display: flex;
    justify-content: flex-start;
    padding-top: 4px;
}

.rp-btn-download {
    min-width: 220px;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 640px) {
    .rp-options-panel {
        padding: 4px 16px;
    }

    .rp-option-row {
        flex-wrap: wrap;
        gap: 12px;
    }

    .rp-option-row--filename {
        flex-direction: column;
        align-items: flex-start;
    }

    .rp-output-input-wrap {
        max-width: 100%;
        width: 100%;
    }

    .rp-file-name {
        max-width: 200px;
    }

    .rp-report-header {
        flex-direction: column;
        gap: 12px;
    }

    .rp-report-meta {
        align-items: flex-start;
    }

    .rp-preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 10px;
    }

    .rp-btn-download {
        min-width: unset;
        width: 100%;
    }
}