/* =============================================
   QPH PDF Merge Tool — Stylesheet v1.2
   Primary #ff6a59 | Soft BG #fff3d6
   Surface #f5f5fa  | Dark text #292931
   ============================================= */

:root {
    --qph-primary:    #ff6a59;
    --qph-primary-dk: #e05545;
    --qph-soft-bg:    #fff3d6;
    --qph-surface:    #f5f5fa;
    --qph-dark:       #292931;
    --qph-white:      #ffffff;
    --qph-border:     #e8e4f0;
    --qph-muted:      #7a6e86;
    --qph-success:    #2e9e68;
    --qph-success-bg: #edfbf3;
    --qph-warn-bg:    #fffbeb;
    --qph-warn-bdr:   #f6ad55;
    --qph-warn-txt:   #744210;
    --qph-r-lg: 16px;
    --qph-r-md: 10px;
    --qph-r-sm: 6px;
    --qph-shadow:    0 4px 24px rgba(41,41,49,.10);
    --qph-shadow-sm: 0 2px 8px  rgba(41,41,49,.07);
}

.qph-tool-wrapper {
    max-width: 700px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--qph-dark);
}

/* ── Header ─────────────────────────────────── */
.qph-header {
    background: linear-gradient(135deg, var(--qph-primary) 0%, #ff8f7e 100%);
    border-radius: var(--qph-r-lg);
    padding: 26px 30px 22px;
    margin-bottom: 22px;
    color: #fff;
    box-shadow: var(--qph-shadow);
}
.qph-header-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.qph-header-sub {
    font-size: 0.88rem;
    opacity: .88;
    margin: 0;
}

/* ── Drop Zone ──────────────────────────────── */
.qph-drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 42px 24px;
    border: 2.5px dashed var(--qph-primary);
    border-radius: var(--qph-r-lg);
    background: var(--qph-soft-bg);
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s, box-shadow .2s;
}
.qph-drop-zone:hover,
.qph-drop-zone--active {
    border-color: var(--qph-primary-dk);
    background: #ffe8d6;
    box-shadow: 0 0 0 5px rgba(255,106,89,.10);
}
.qph-drop-icon { color: var(--qph-primary); opacity: .9; filter: drop-shadow(0 2px 6px rgba(255,106,89,.25)); }
.qph-drop-title { font-size: 1.08rem; font-weight: 700; margin: 0; color: var(--qph-dark); }
.qph-drop-sub   { font-size: 0.85rem; color: var(--qph-muted); margin: 0; }

/* ── File List Wrapper ───────────────────────── */
.qph-file-list-wrapper {
    margin-top: 22px;
    background: var(--qph-surface);
    border-radius: var(--qph-r-lg);
    padding: 18px 18px 14px;
    box-shadow: var(--qph-shadow-sm);
}

/* Header row: title + action buttons */
.qph-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.qph-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--qph-dark);
}
.qph-badge {
    background: var(--qph-primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 20px;
    padding: 2px 8px;
    min-width: 20px;
    text-align: center;
}

/* Add More / Clear All mini-buttons */
.qph-list-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.qph-list-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
}
.qph-add-more-btn {
    background: var(--qph-primary);
    color: #fff;
    border-color: var(--qph-primary);
}
.qph-add-more-btn:hover { background: var(--qph-primary-dk); border-color: var(--qph-primary-dk); }
.qph-clear-btn {
    background: transparent;
    color: var(--qph-muted);
    border-color: var(--qph-border);
}
.qph-clear-btn:hover { background: #fff0ee; color: var(--qph-primary); border-color: var(--qph-primary); }

/* File List */
.qph-file-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.qph-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--qph-white);
    border: 1.5px solid var(--qph-border);
    border-radius: var(--qph-r-md);
    padding: 10px 12px;
    font-size: 0.88rem;
    transition: border-color .15s, box-shadow .15s;
}
.qph-file-item:hover {
    border-color: var(--qph-primary);
    box-shadow: var(--qph-shadow-sm);
}
/* Order number badge */
.qph-file-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--qph-soft-bg);
    color: var(--qph-primary);
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.qph-file-icon { color: var(--qph-primary); flex-shrink: 0; opacity: .75; }
.qph-file-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    color: var(--qph-dark);
}
.qph-file-size {
    color: var(--qph-muted);
    font-size: 0.78rem;
    white-space: nowrap;
    flex-shrink: 0;
    background: var(--qph-surface);
    padding: 2px 8px;
    border-radius: 20px;
}
.qph-remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #ccc;
    padding: 4px 5px;
    border-radius: var(--qph-r-sm);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    transition: color .15s, background .15s;
}
.qph-remove-btn:hover { color: var(--qph-primary); background: #fff0ee; }

/* Footer: total size */
.qph-list-footer {
    margin-top: 10px;
    text-align: right;
}
.qph-total-size {
    font-size: 0.8rem;
    color: var(--qph-muted);
}

/* ── Warning ────────────────────────────────── */
.qph-warning {
    margin: 10px 0 0;
    padding: 10px 14px;
    background: var(--qph-warn-bg);
    border-left: 4px solid var(--qph-warn-bdr);
    border-radius: var(--qph-r-sm);
    font-size: 0.86rem;
    color: var(--qph-warn-txt);
}

/* ── Actions ────────────────────────────────── */
.qph-actions {
    margin-top: 22px;
    display: flex;
    justify-content: center;
}

/* ── Buttons ────────────────────────────────── */
.qph-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 30px;
    border-radius: var(--qph-r-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    text-decoration: none;
    transition: opacity .15s, transform .1s, background .18s, box-shadow .18s;
    user-select: none;
    letter-spacing: .01em;
}
.qph-btn:active { transform: scale(.98); }
.qph-btn:disabled { opacity: .38; cursor: not-allowed; pointer-events: none; }

.qph-btn-primary {
    background: var(--qph-primary);
    color: #fff;
    border-color: var(--qph-primary);
    min-width: 190px;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(255,106,89,.35);
}
.qph-btn-primary:hover { background: var(--qph-primary-dk); border-color: var(--qph-primary-dk); box-shadow: 0 6px 22px rgba(255,106,89,.45); }

.qph-btn-outline { background: var(--qph-white); color: var(--qph-primary); border-color: var(--qph-primary); }
.qph-btn-outline:hover { background: var(--qph-soft-bg); }

.qph-btn-success { background: var(--qph-success); color: #fff; border-color: var(--qph-success); box-shadow: 0 4px 16px rgba(46,158,104,.28); }
.qph-btn-success:hover { background: #257a52; border-color: #257a52; }

.qph-btn-ghost { background: transparent; color: var(--qph-muted); border-color: var(--qph-border); }
.qph-btn-ghost:hover { background: var(--qph-surface); color: var(--qph-dark); }

.qph-btn-sm { font-size: 0.88rem; padding: 8px 20px; }

/* ── Spinner ────────────────────────────────── */
.qph-spinner {
    width: 17px; height: 17px;
    border: 2.5px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: qph-spin .7s linear infinite;
}
@keyframes qph-spin { to { transform: rotate(360deg); } }

/* ── Status ─────────────────────────────────── */
.qph-status { margin-top: 18px; padding: 11px 16px; border-radius: var(--qph-r-md); font-size: .9rem; border-left: 4px solid transparent; }
.qph-status--info    { background: #eef3ff; border-color: #4f6ef7; color: #1a2d6e; }
.qph-status--error   { background: #fff0ee; border-color: var(--qph-primary); color: #8b1a0e; }
.qph-status--warning { background: var(--qph-warn-bg); border-color: var(--qph-warn-bdr); color: var(--qph-warn-txt); }

/* ── Download section ───────────────────────── */
.qph-download-wrapper {
    margin-top: 22px;
    padding: 28px 24px;
    background: var(--qph-success-bg);
    border: 1.5px solid #a3e8c8;
    border-radius: var(--qph-r-lg);
    text-align: center;
    box-shadow: var(--qph-shadow-sm);
}
.qph-success-icon {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: #d1f5e3;
    color: var(--qph-success);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 14px;
}
.qph-success-msg  { font-size: 1.08rem; font-weight: 700; margin: 0 0 4px; color: var(--qph-success); }
.qph-merged-info  { font-size: 0.85rem; color: var(--qph-muted); margin: 0 0 18px; }
.qph-download-btns { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }

/* ══════════════════════════════════════════════
   PROGRESS MODAL
   ══════════════════════════════════════════════ */
.qph-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(41,41,49,.56);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
.qph-modal-overlay.qph-modal--open { display: flex; }

.qph-modal {
    background: var(--qph-white);
    border-radius: var(--qph-r-lg);
    padding: 34px 30px 30px;
    width: 90%; max-width: 420px;
    box-shadow: 0 20px 60px rgba(41,41,49,.22);
    text-align: center;
    animation: qph-modal-in .25s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes qph-modal-in {
    from { opacity: 0; transform: scale(.88) translateY(20px); }
    to   { opacity: 1; transform: scale(1)   translateY(0); }
}

/* Modal icon */
.qph-modal-icon {
    width: 62px; height: 62px;
    border-radius: 50%;
    background: var(--qph-soft-bg);
    color: var(--qph-primary);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
    transition: background .3s, color .3s;
}
.qph-modal-icon--success { background: var(--qph-success-bg); color: var(--qph-success); }

.qph-modal-title { font-size: 1.12rem; font-weight: 700; color: var(--qph-dark); margin: 0 0 5px; }
.qph-modal-sub   { font-size: 0.86rem; color: var(--qph-muted); margin: 0 0 22px; min-height: 1.3em; }

/* Progress bar */
.qph-progress-track {
    background: var(--qph-surface);
    border-radius: 99px;
    height: 9px;
    overflow: hidden;
    margin-bottom: 8px;
}
.qph-progress-bar {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--qph-primary) 0%, #ff8f7e 100%);
    transition: width .35s ease;
    width: 0%;
    position: relative; overflow: hidden;
}
.qph-progress-bar::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.35) 50%, transparent 100%);
    animation: qph-shimmer 1.4s infinite;
}
@keyframes qph-shimmer { from { transform: translateX(-100%); } to { transform: translateX(200%); } }

.qph-progress-stats {
    display: flex; justify-content: space-between;
    font-size: .8rem; color: var(--qph-muted);
    margin-bottom: 18px;
}

/* Step list */
.qph-step-list { text-align: left; list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.qph-step-item {
    display: flex; align-items: center; gap: 10px;
    font-size: 0.84rem; color: var(--qph-muted);
    padding: 8px 11px;
    border-radius: var(--qph-r-sm);
    background: var(--qph-surface);
    transition: background .2s, color .2s;
}
.qph-step-item.is-active { color: var(--qph-primary); background: #fff0ee; font-weight: 600; }
.qph-step-item.is-done   { color: var(--qph-success);  background: var(--qph-success-bg); }
.qph-step-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.qph-step-dot {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid currentColor;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: .68rem; font-weight: 700;
}
.is-active .qph-step-dot { background: var(--qph-primary); border-color: var(--qph-primary); color: #fff; animation: qph-pulse-dot 1s ease-in-out infinite; }
.is-done   .qph-step-dot { background: var(--qph-success);  border-color: var(--qph-success);  color: #fff; }
@keyframes qph-pulse-dot {
    0%,100% { box-shadow: 0 0 0 0 rgba(255,106,89,.4); }
    50%     { box-shadow: 0 0 0 6px rgba(255,106,89,0); }
}

/* Action buttons injected into modal after success — full width stacked */
.qph-modal-action-btn {
    width: 100%;
    justify-content: center;
    margin-bottom: 10px;
}
.qph-modal-action-btn:last-child { margin-bottom: 0; }

/* ── Responsive ─────────────────────────────── */
@media (max-width: 480px) {
    .qph-header          { padding: 18px 16px; }
    .qph-drop-zone       { padding: 30px 14px; }
    .qph-btn             { font-size: .95rem; padding: 11px 18px; }
    .qph-file-item       { font-size: .83rem; }
    .qph-modal           { padding: 26px 16px 22px; }
    .qph-list-header     { flex-direction: column; align-items: flex-start; gap: 8px; }
    .qph-download-btns   { flex-direction: column; align-items: stretch; }
    .qph-download-btns .qph-btn { justify-content: center; }
}
