/* ═══════════════════════════════════════════
   PDF Splitter Tool — Stylesheet v1.1
   Brand: #ff6a59 / #fff3d6 / #f5f5fa / #292931
═══════════════════════════════════════════ */

/* ── Variables ── */
.pst-wrap {
    --clr-primary:    #ff6a59;
    --clr-primary-dk: #e85544;
    --clr-bg-warm:    #fff3d6;
    --clr-surface:    #f5f5fa;
    --clr-text:       #292931;
    --clr-muted:      #7a7a8a;
    --clr-border:     #e6e6f0;
    --clr-white:      #ffffff;
    --radius:         14px;
    --shadow:         0 4px 16px rgba(41, 41, 49, 0.08);
    --shadow-sm:      0 2px 6px rgba(41, 41, 49, 0.06);

    max-width: 660px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--clr-text);
}

/* ─── Cards ─── */
.pst-card {
    background: var(--clr-white);
    border: 1.5px solid var(--clr-border);
    border-radius: var(--radius);
    padding: 32px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

/* ─── Upload Zone ─── */
.pst-upload-zone {
    text-align: center;
    border: 2.5px dashed #d0cfe8;
    background: var(--clr-surface);
    cursor: pointer;
    transition: border-color .2s, background .2s;
    padding: 48px 32px;
}
.pst-upload-zone:hover,
.pst-upload-zone.drag-over {
    border-color: var(--clr-primary);
    background: var(--clr-bg-warm);
}
.pst-upload-icon {
    font-size: 52px;
    margin-bottom: 12px;
    display: block;
}
.pst-upload-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--clr-text);
    margin: 0 0 4px;
}
.pst-upload-sub {
    font-size: 14px;
    color: var(--clr-muted);
    margin: 0 0 16px;
}
.pst-upload-hint {
    font-size: 12px;
    color: var(--clr-muted);
    margin: 16px 0 0;
    background: var(--clr-white);
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--clr-border);
}

/* ─── File Pill ─── */
.pst-file-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--clr-bg-warm);
    border: 1.5px solid #f5d98a;
    border-radius: 10px;
    padding: 10px 16px;
    margin-bottom: 24px;
    font-size: 14px;
}
.pst-file-pill .pill-name {
    font-weight: 600;
    color: var(--clr-text);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pst-file-pill .pill-size {
    color: var(--clr-muted);
    font-size: 13px;
    white-space: nowrap;
}

/* ─── Mode Tabs ─── */
.pst-tabs {
    display: flex;
    gap: 0;
    background: var(--clr-surface);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 24px;
    border: 1.5px solid var(--clr-border);
}
.pst-tab {
    flex: 1;
    padding: 9px 16px;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--clr-muted);
    cursor: pointer;
    transition: all .15s;
}
.pst-tab.active {
    background: var(--clr-white);
    color: var(--clr-primary);
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

/* ─── Section Label ─── */
.pst-section-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--clr-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin: 0 0 14px;
}

/* ─── Chunk Grid ─── */
.pst-chunk-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}
.pst-chunk-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 76px;
    height: 72px;
    border: 2px solid var(--clr-border);
    border-radius: 12px;
    background: var(--clr-surface);
    cursor: pointer;
    transition: all .15s;
    padding: 0;
}
.pst-chunk-btn:hover {
    border-color: var(--clr-primary);
    background: var(--clr-bg-warm);
}
.pst-chunk-btn.active {
    border-color: var(--clr-primary);
    background: var(--clr-primary);
    box-shadow: 0 4px 12px rgba(255, 106, 89, 0.35);
}
.pst-chunk-num {
    font-size: 22px;
    font-weight: 800;
    color: var(--clr-text);
    line-height: 1;
}
.pst-chunk-btn.active .pst-chunk-num {
    color: var(--clr-white);
}
.pst-chunk-word {
    font-size: 11px;
    color: var(--clr-muted);
    margin-top: 3px;
    font-weight: 500;
}
.pst-chunk-btn.active .pst-chunk-word {
    color: rgba(255,255,255,.85);
}

/* Custom input */
.pst-chunk-custom-wrap {
    display: flex;
    align-items: center;
}
.pst-chunk-custom-wrap input {
    width: 76px;
    height: 72px;
    text-align: center;
    border: 2px solid var(--clr-border);
    border-radius: 12px;
    background: var(--clr-surface);
    font-size: 15px;
    font-weight: 600;
    color: var(--clr-text);
    outline: none;
    transition: border-color .15s;
}
.pst-chunk-custom-wrap input:focus {
    border-color: var(--clr-primary);
    background: var(--clr-bg-warm);
}
.pst-chunk-custom-wrap input::placeholder {
    font-size: 12px;
    color: var(--clr-muted);
    font-weight: 400;
}

/* ─── Math Preview Box ─── */
.pst-math-box {
    background: var(--clr-bg-warm);
    border: 1.5px solid #f5d98a;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 4px;
    text-align: center;
}
.pst-math-text {
    font-size: 15px;
    color: var(--clr-text);
    line-height: 1.5;
}
.pst-math-text strong {
    color: var(--clr-primary);
    font-size: 18px;
}

/* ─── Range Input ─── */
.pst-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--clr-border);
    border-radius: 10px;
    background: var(--clr-surface);
    font-size: 15px;
    color: var(--clr-text);
    box-sizing: border-box;
    outline: none;
    transition: border-color .15s, background .15s;
}
.pst-input:focus {
    border-color: var(--clr-primary);
    background: var(--clr-bg-warm);
}
.pst-input-hint {
    font-size: 12px;
    color: var(--clr-muted);
    margin: 6px 0 0;
}

/* ─── Buttons ─── */
.pst-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 22px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: transform .1s, box-shadow .15s, opacity .15s;
    white-space: nowrap;
}
.pst-btn:hover {
    transform: translateY(-1px);
    opacity: .92;
}
.pst-btn:active {
    transform: translateY(0);
}
.pst-btn-primary {
    background: var(--clr-primary);
    color: var(--clr-white);
    box-shadow: 0 4px 12px rgba(255, 106, 89, 0.30);
}
.pst-btn-primary:hover {
    box-shadow: 0 6px 18px rgba(255, 106, 89, 0.40);
}
.pst-btn-outline {
    background: var(--clr-white);
    color: var(--clr-primary);
    border: 2px solid var(--clr-primary);
}
.pst-btn-ghost {
    background: var(--clr-surface);
    color: var(--clr-text);
    border: 1.5px solid var(--clr-border);
}

.pst-split-btn {
    width: 100%;
    margin-top: 24px;
    padding: 15px 22px;
    font-size: 16px;
    border-radius: 12px;
}

/* ─── Loader ─── */
.pst-loader-wrap {
    text-align: center;
    padding: 48px 24px;
}
.pst-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--clr-bg-warm);
    border-top-color: var(--clr-primary);
    border-radius: 50%;
    animation: pst-spin .75s linear infinite;
    margin: 0 auto 18px;
}
@keyframes pst-spin { to { transform: rotate(360deg); } }
.pst-loader-text {
    font-size: 15px;
    color: var(--clr-muted);
    margin: 0;
}

/* ─── Results ─── */
.pst-results-card {}
.pst-results-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.pst-check { font-size: 28px; }
.pst-results-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--clr-text);
}

.pst-file-list {
    border: 1.5px solid var(--clr-border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
}
.pst-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    border-bottom: 1px solid var(--clr-border);
    background: var(--clr-white);
    transition: background .1s;
    gap: 12px;
}
.pst-file-item:last-child { border-bottom: none; }
.pst-file-item:hover { background: var(--clr-surface); }
.pst-file-item-name {
    font-size: 14px;
    color: var(--clr-text);
    font-weight: 500;
    flex: 1;
}
.pst-file-item .pst-btn {
    padding: 7px 14px;
    font-size: 13px;
    border-radius: 8px;
    flex-shrink: 0;
}

.pst-results-footer {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ─── Error Box ─── */
.pst-error-box {
    background: #fff0ef;
    border: 1.5px solid #ffb8b2;
    color: #c0392b;
    border-radius: 10px;
    padding: 14px 18px;
    font-size: 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

/* ─── Responsive ─── */
@media (max-width: 500px) {
    .pst-card            { padding: 20px; }
    .pst-upload-zone     { padding: 36px 20px; }
    .pst-chunk-btn,
    .pst-chunk-custom-wrap input { width: 64px; height: 64px; }
    .pst-chunk-num       { font-size: 18px; }
    .pst-tabs            { flex-direction: column; }
    .pst-results-footer  { flex-direction: column; }
    .pst-btn             { width: 100%; }
}

/* ─── Progress Modal ─── */
#pstProgressModal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pst-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 15, 30, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.pst-modal-box {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 20px;
    padding: 44px 48px 40px;
    text-align: center;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
    min-width: 280px;
    max-width: 360px;
    width: 90vw;
    animation: pst-modal-pop .25s cubic-bezier(.34,1.56,.64,1) both;
}

@keyframes pst-modal-pop {
    from { transform: scale(.85); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.pst-modal-spinner {
    width: 64px;
    height: 64px;
    margin: 0 auto 24px;
    position: relative;
}

.pst-modal-arc {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 5px solid #f0f0f8;
    border-top-color: var(--clr-primary, #6c63ff);
    border-right-color: var(--clr-primary, #6c63ff);
    animation: pst-spin .85s linear infinite;
}

.pst-modal-title {
    margin: 0 0 8px;
    font-size: 17px;
    font-weight: 700;
    color: var(--clr-text, #1a1a2e);
    line-height: 1.3;
}

.pst-modal-sub {
    margin: 0;
    font-size: 13px;
    color: var(--clr-muted, #8a8aa0);
}

/* ─── Modal Success Tick ─── */
.pst-modal-tick {
    width: 64px;
    height: 64px;
    margin: 0 auto 24px;
}

.pst-modal-tick svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.pst-tick-circle {
    stroke-dasharray: 157;
    stroke-dashoffset: 157;
    animation: pst-tick-circle .45s ease-out forwards;
    transform-origin: center;
    transform: rotate(-90deg);
}

.pst-tick-check {
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
    animation: pst-tick-check .35s ease-out .35s forwards;
}

@keyframes pst-tick-circle {
    to { stroke-dashoffset: 0; }
}

@keyframes pst-tick-check {
    to { stroke-dashoffset: 0; }
}

#pstModalSub {
    transition: opacity .2s;
}
