/* ============================================================
   Prepress Pro v7 — Design System + Application
   White · Black · Red accent · Rounded cards · Accessible
   ============================================================ */

.prepress-site {
    --pp-red: #b91c1c;
    --pp-red-dark: #7f1d1d;
    --pp-red-soft: #fef2f2;
    --pp-ink: #111827;
    --pp-gray: #6b7280;
    --pp-line: #e5e7eb;
    --pp-bg-soft: #f9fafb;
    --pp-radius: 14px;
    --pp-shadow: 0 1px 3px rgba(17, 24, 39, .07), 0 8px 24px rgba(17, 24, 39, .06);
    --pp-shadow-lg: 0 4px 12px rgba(17, 24, 39, .08), 0 16px 48px rgba(17, 24, 39, .1);

    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
    color: var(--pp-ink);
    background: #fff;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
.prepress-site *, .prepress-site *::before, .prepress-site *::after { box-sizing: border-box; }
.prepress-site h1, .prepress-site h2, .prepress-site h3, .prepress-site h4 {
    color: var(--pp-ink); line-height: 1.2; margin: 0 0 .5em; font-weight: 800;
    letter-spacing: -0.02em;
}
.prepress-site p { color: var(--pp-gray); margin: 0 0 1em; }
.prepress-site a { color: var(--pp-red); }
.prepress-site img, .prepress-site svg { max-width: 100%; height: auto; }

/* Motion respect */
@media (prefers-reduced-motion: reduce) {
    .prepress-site * { animation: none !important; transition: none !important; }
}

/* ---------------- Navigation ---------------- */
.pp-nav {
    display: flex; align-items: center; justify-content: space-between;
    gap: 20px; padding: 16px 28px; max-width: 1200px; margin: 0 auto;
    border-bottom: 1px solid var(--pp-line);
}
.pp-logo {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 1.25em; font-weight: 700; color: var(--pp-ink) !important;
    text-decoration: none !important;
}
.pp-logo strong { color: var(--pp-red); }
.pp-logo-mark { display: inline-flex; width: 26px; height: 26px; color: var(--pp-red); }
.pp-logo-mark svg { width: 100%; height: 100%; }
.pp-nav-links { display: flex; align-items: center; gap: 22px; }
.pp-nav-link {
    color: var(--pp-ink) !important; text-decoration: none !important;
    font-weight: 600; font-size: .95em; padding: 6px 2px;
    border-bottom: 2px solid transparent; transition: border-color .15s;
}
.pp-nav-link:hover { border-bottom-color: var(--pp-red); }
.pp-nav-toggle { display: none; background: none; border: none; font-size: 1.5em; cursor: pointer; }

@media (max-width: 860px) {
    .pp-nav-toggle { display: block; }
    .pp-nav-links {
        display: none; position: absolute; left: 0; right: 0; top: 62px;
        background: #fff; flex-direction: column; padding: 20px;
        border-bottom: 1px solid var(--pp-line); z-index: 50;
        box-shadow: var(--pp-shadow);
    }
    .pp-nav { position: relative; }
    .pp-nav-links.open { display: flex; }
}

/* ---------------- Buttons ---------------- */
.prepress-site .pp-btn {
    display: inline-block; padding: 11px 22px; border-radius: 10px;
    font-weight: 700; font-size: .95em; cursor: pointer; border: 2px solid transparent;
    text-decoration: none !important; transition: all .18s; line-height: 1.3;
    -webkit-appearance: none; appearance: none;
}
.prepress-site .pp-btn-lg { padding: 14px 30px; font-size: 1.05em; }
.prepress-site .pp-btn-primary {
    background: var(--pp-red) !important; color: #fff !important; border-color: var(--pp-red);
}
.prepress-site .pp-btn-primary:hover {
    background: var(--pp-red-dark) !important; border-color: var(--pp-red-dark);
    transform: translateY(-2px); box-shadow: 0 8px 20px rgba(185, 28, 28, .3);
}
.prepress-site .pp-btn-outline {
    background: #fff !important; color: var(--pp-ink) !important; border-color: var(--pp-line);
}
.prepress-site .pp-btn-outline:hover { border-color: var(--pp-red); color: var(--pp-red) !important; }
.prepress-site .pp-btn-white { background: #fff !important; color: var(--pp-red) !important; }
.prepress-site .pp-btn-white:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.2); }
.prepress-site .pp-btn:focus-visible { outline: 3px solid #fca5a5; outline-offset: 2px; }
.prepress-site .pp-btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }

/* ---------------- Cards / layout primitives ---------------- */
.pp-section { max-width: 1200px; margin: 0 auto; padding: 72px 28px; }
.pp-section-gray { background: var(--pp-bg-soft); max-width: none; }
.pp-section-gray > * { max-width: 1200px; margin-left: auto; margin-right: auto; }
.pp-section-title { text-align: center; font-size: 2em; margin-bottom: 44px; }
.pp-narrow { max-width: 760px; }
.pp-center { text-align: center; margin-top: 44px; }

.pp-grid-3 {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px;
}
.pp-card {
    background: #fff; border: 1px solid var(--pp-line); border-radius: var(--pp-radius);
    padding: 28px; box-shadow: var(--pp-shadow); transition: transform .2s, box-shadow .2s;
}
.pp-card:hover { transform: translateY(-4px); box-shadow: var(--pp-shadow-lg); }
.pp-card h3 { font-size: 1.15em; margin: 14px 0 8px; }
.pp-card p { font-size: .95em; margin: 0; }
.pp-card-icon {
    display: inline-flex; width: 46px; height: 46px; padding: 10px;
    background: var(--pp-red-soft); color: var(--pp-red); border-radius: 12px;
}
.pp-card-icon svg { width: 100%; height: 100%; }

/* ---------------- App shell ---------------- */
.pp-app { max-width: 1100px; margin: 0 auto; padding: 44px 28px 80px; min-height: 60vh; }
.pp-app-head { margin-bottom: 28px; }
.pp-app-head h1 { font-size: 1.8em; }
.pp-status-pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 14px; border-radius: 20px; font-size: .82em; font-weight: 700;
    background: var(--pp-bg-soft); border: 1px solid var(--pp-line);
}
.pp-status-pill.online  { color: #059669; border-color: #a7f3d0; background: #ecfdf5; }
.pp-status-pill.offline { color: var(--pp-red); border-color: #fecaca; background: var(--pp-red-soft); }
.pp-status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* Upload zone */
.pp-upload-zone {
    border: 2px dashed var(--pp-line); border-radius: var(--pp-radius);
    padding: 56px 24px; text-align: center; cursor: pointer;
    background: var(--pp-bg-soft); transition: all .2s; margin-bottom: 28px;
}
.pp-upload-zone:hover, .pp-upload-zone.dragover {
    border-color: var(--pp-red); background: var(--pp-red-soft); transform: translateY(-2px);
}
.pp-upload-zone:focus-visible { outline: 3px solid #fca5a5; outline-offset: 3px; }
.pp-upload-icon {
    display: inline-flex; width: 56px; height: 56px; padding: 14px;
    background: #fff; color: var(--pp-red); border-radius: 16px;
    border: 1px solid var(--pp-line); margin-bottom: 14px;
}
.pp-upload-icon svg { width: 100%; height: 100%; }
.pp-upload-zone p { font-weight: 700; color: var(--pp-ink); margin: 0 0 4px; font-size: 1.1em; }
.pp-upload-zone small { color: var(--pp-gray); }
#ppFileInput { display: none; }

/* Job cards */
.pp-job {
    background: #fff; border: 1px solid var(--pp-line); border-radius: var(--pp-radius);
    padding: 24px; margin-bottom: 20px; box-shadow: var(--pp-shadow);
    animation: pp-rise .35s ease;
}
@keyframes pp-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.pp-job.processing { border-left: 4px solid var(--pp-red); }
.pp-job.done       { border-left: 4px solid #10b981; }
.pp-job.failed     { border-left: 4px solid var(--pp-red-dark); }
.pp-job-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; align-items: center; }
.pp-job-file { font-weight: 700; word-break: break-all; }
.pp-job-type { font-size: .75em; font-weight: 700; color: var(--pp-gray); text-transform: uppercase; letter-spacing: .5px; }

.pp-progress { display: flex; flex-direction: column; gap: 10px; }
.pp-stage { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--pp-red); font-size: .95em; }
.pp-spinner {
    width: 18px; height: 18px; flex-shrink: 0; border-radius: 50%;
    border: 3px solid var(--pp-line); border-top-color: var(--pp-red);
    animation: pp-spin .8s linear infinite;
}
@keyframes pp-spin { to { transform: rotate(360deg); } }
.pp-track { height: 10px; background: var(--pp-bg-soft); border-radius: 6px; overflow: hidden; }
.pp-fill {
    height: 100%; width: 0; border-radius: 6px;
    background: linear-gradient(90deg, var(--pp-red-dark), var(--pp-red));
    transition: width .5s ease;
}
.pp-pct { font-size: .8em; font-weight: 700; color: var(--pp-gray); text-align: right; }

/* Result dashboard inside job card */
.pp-verdict {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    border-radius: 12px; padding: 18px; border: 1px solid var(--pp-line); margin-bottom: 16px;
}
.pp-verdict.pass { background: #ecfdf5; border-color: #a7f3d0; }
.pp-verdict.warn { background: #fffbeb; border-color: #fde68a; }
.pp-verdict.fail { background: var(--pp-red-soft); border-color: #fecaca; }
.pp-verdict-icon { font-size: 1.7em; }
.pp-verdict-text { font-weight: 800; font-size: 1.1em; }
.pp-verdict-sub  { font-size: .85em; color: var(--pp-gray); }
.pp-score {
    margin-left: auto; font-size: 1.8em; font-weight: 800; flex-shrink: 0;
    background: #fff; border: 2px solid var(--pp-line); border-radius: 12px; padding: 6px 16px;
}
.pp-score span { font-size: .45em; color: var(--pp-gray); }
.pp-score.good { border-color: #10b981; color: #059669; }
.pp-score.mid  { border-color: #f59e0b; color: #b45309; }
.pp-score.bad  { border-color: var(--pp-red); color: var(--pp-red); }

.pp-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pp-chip {
    background: var(--pp-bg-soft); border: 1px solid var(--pp-line);
    padding: 6px 14px; border-radius: 20px; font-size: .85em; font-weight: 700;
}
.pp-checks { display: flex; flex-direction: column; gap: 8px; }
.pp-check { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; font-size: .92em; align-items: flex-start; }
.pp-check-label { font-weight: 700; }
.pp-check-msg { color: var(--pp-gray); line-height: 1.5; }
.pp-check.pass    { background: #f0fdf4; border-left: 3px solid #10b981; }
.pp-check.warning { background: #fffbeb; border-left: 3px solid #f59e0b; }
.pp-check.fail    { background: var(--pp-red-soft); border-left: 3px solid var(--pp-red); }

.pp-detail-list { background: var(--pp-bg-soft); border-radius: 10px; padding: 6px 14px; margin-top: 8px; }
.pp-detail-row {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 8px 0; border-bottom: 1px solid var(--pp-line); font-size: .88em;
}
.pp-detail-row:last-child { border: none; }
.pp-ok  { color: #059669; font-weight: 700; }
.pp-mid { color: #b45309; font-weight: 700; }
.pp-bad { color: var(--pp-red); font-weight: 700; }

.pp-recbox {
    background: var(--pp-red-soft); border-left: 3px solid var(--pp-red);
    border-radius: 10px; padding: 14px 16px; margin-top: 16px; font-size: .92em;
}
.pp-job-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.pp-job h4 { margin: 18px 0 6px; font-size: 1em; }

/* ---------------- Dashboard ---------------- */
.pp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-bottom: 28px; }
.pp-stat {
    background: #fff; border: 1px solid var(--pp-line); border-radius: var(--pp-radius);
    padding: 20px 22px; box-shadow: var(--pp-shadow);
}
.pp-stat-value { font-size: 1.9em; font-weight: 800; color: var(--pp-ink); }
.pp-stat-label { font-size: .82em; color: var(--pp-gray); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.pp-stat-note { font-size: .78em; color: var(--pp-gray); margin-top: 4px; }

.pp-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--pp-radius); overflow: hidden; box-shadow: var(--pp-shadow); border: 1px solid var(--pp-line); }
.pp-table th, .pp-table td { padding: 13px 16px; text-align: left; font-size: .9em; border-bottom: 1px solid var(--pp-line); }
.pp-table th { background: var(--pp-bg-soft); font-weight: 700; font-size: .78em; text-transform: uppercase; letter-spacing: .5px; color: var(--pp-gray); }
.pp-table tr:last-child td { border-bottom: none; }
.pp-badge-status { padding: 3px 12px; border-radius: 14px; font-size: .8em; font-weight: 700; }
.pp-badge-status.completed  { background: #ecfdf5; color: #059669; }
.pp-badge-status.processing, .pp-badge-status.queued { background: #fffbeb; color: #b45309; }
.pp-badge-status.failed     { background: var(--pp-red-soft); color: var(--pp-red); }

.pp-placeholder-card {
    background: var(--pp-bg-soft); border: 1px dashed var(--pp-line); border-radius: var(--pp-radius);
    padding: 22px; text-align: center; color: var(--pp-gray);
}
.pp-dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 900px) { .pp-dash-grid { grid-template-columns: 1fr; } }

/* ---------------- Toasts ---------------- */
#ppToasts { position: fixed; bottom: 24px; right: 24px; z-index: 99999; display: flex; flex-direction: column; gap: 10px; }
.pp-toast {
    background: var(--pp-ink); color: #fff; padding: 12px 20px; border-radius: 10px;
    font-size: .92em; font-weight: 600; opacity: 0; transform: translateY(12px);
    transition: all .3s ease; max-width: 340px; box-shadow: var(--pp-shadow-lg);
}
.pp-toast.show { opacity: 1; transform: none; }
.pp-toast.ok  { background: #059669; }
.pp-toast.err { background: var(--pp-red); }

/* ---------------- Before/After slider (restoration results) ---------------- */
.pp-ba { margin: 6px 0 4px; }
.pp-ba-stage {
    position: relative; overflow: hidden; border-radius: 12px;
    background: #0b0f19; aspect-ratio: 16/10; cursor: ew-resize; touch-action: none;
}
.pp-ba-img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: contain; user-select: none; -webkit-user-drag: none;
}
.pp-ba-divider {
    position: absolute; top: 0; bottom: 0; left: 50%; width: 3px;
    background: #fff; box-shadow: 0 0 8px rgba(0,0,0,.5);
}
.pp-ba-handle {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    background: var(--pp-red); color: #fff; border-radius: 20px;
    padding: 5px 10px; font-weight: 800; letter-spacing: 2px; font-size: .85em;
}
.pp-ba-tag {
    position: absolute; top: 10px; background: rgba(0,0,0,.65); color: #fff;
    padding: 3px 12px; border-radius: 12px; font-size: .78em; font-weight: 700;
}
.pp-ba-tag-l { left: 10px; }
.pp-ba-tag-r { right: 10px; color: #fca5a5; }
.pp-ba-stage:focus-visible { outline: 3px solid #fca5a5; outline-offset: 2px; }
