﻿/* ============================================================
   PDF TO JPG
   Compact professional workspace
   Global site styling remains in ../assets/css/main.css
   ============================================================ */
.pdf-tool {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto 60px;
}
/* ============================================================
   UPLOAD
   ============================================================ */
.pdf-upload {
    position: relative;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    text-align: center;
    border: 1px dashed rgba(129,120,255,.38);
    border-radius: 16px;
    background:
        radial-gradient(
            circle at 50% 0%,
            rgba(99,91,255,.09),
            transparent 55%
        ),
        rgba(255,255,255,.025);
    transition:
        border-color .2s ease,
        background .2s ease,
        transform .2s ease;
}
.pdf-upload.drag-active {
    border-color: #8178ff;
    background:
        radial-gradient(
            circle at 50% 0%,
            rgba(99,91,255,.16),
            transparent 60%
        ),
        rgba(99,91,255,.045);
    transform: translateY(-1px);
}
.upload-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    margin-bottom: 14px;
    border-radius: 13px;
    background: rgba(99,91,255,.12);
    border: 1px solid rgba(129,120,255,.25);
    color: #a8a2ff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .04em;
}
.pdf-upload h2 {
    margin: 0 0 7px;
    font-size: 20px;
}
.pdf-upload p {
    margin: 0 0 18px;
    opacity: .68;
    font-size: 14px;
}
.upload-note {
    margin-top: 12px;
    font-size: 12px;
    opacity: .5;
}
/* ============================================================
   APP
   ============================================================ */
.pdf-app {
    margin-top: 18px;
}
.file-bar {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 14px;
    margin-bottom: 12px;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 12px;
    background: rgba(255,255,255,.025);
}
.file-main {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 11px;
}
.file-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: rgba(99,91,255,.12);
    border: 1px solid rgba(129,120,255,.2);
    color: #aaa5ff;
    font-size: 10px;
    font-weight: 800;
}
.file-details {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.file-details strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}
.file-details span {
    font-size: 11px;
    opacity: .5;
}
/* ============================================================
   WORKSPACE
   ============================================================ */
.workspace-grid {
    display: grid;
    grid-template-columns: 235px minmax(0,1fr);
    min-height: 620px;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 14px;
    overflow: hidden;
    background: rgba(255,255,255,.018);
}
/* ============================================================
   PAGES
   ============================================================ */
.pages-panel {
    min-width: 0;
    border-right: 1px solid rgba(255,255,255,.07);
    background: rgba(0,0,0,.12);
}
.panel-header,
.editor-header,
.export-title {
    min-height: 52px;
    padding: 9px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.panel-header strong,
.editor-header strong,
.export-title strong {
    display: block;
    font-size: 13px;
}
.panel-header span,
.editor-header span,
.export-title span {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    opacity: .48;
}
.page-actions {
    display: flex;
    gap: 5px;
}
.mini-btn {
    height: 28px;
    padding: 0 9px;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 7px;
    background: rgba(255,255,255,.035);
    color: inherit;
    font-size: 11px;
    cursor: pointer;
    transition: .18s ease;
}
.mini-btn:hover {
    border-color: rgba(129,120,255,.45);
    background: rgba(99,91,255,.08);
}
.selection-status {
    padding: 8px 12px;
    font-size: 11px;
    opacity: .48;
}
.page-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 8px;
    padding: 10px;
    max-height: 550px;
    overflow-y: auto;
}
.page-thumb {
    position: relative;
    min-width: 0;
    aspect-ratio: 0.72;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 8px;
    background: rgba(255,255,255,.025);
    cursor: pointer;
    overflow: hidden;
    transition: .16s ease;
}
.page-thumb:hover {
    border-color: rgba(129,120,255,.35);
}
.page-thumb.current {
    border-color: rgba(129,120,255,.8);
    box-shadow: 0 0 0 1px rgba(129,120,255,.18);
}
.page-thumb.selected::after {
    content: "✓";
    position: absolute;
    top: 5px;
    right: 5px;
    width: 17px;
    height: 17px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #635bff;
    color: white;
    font-size: 10px;
    font-weight: 800;
}
.page-thumb canvas {
    display: block;
    width: 100%;
    height: auto;
    max-height: 100%;
    object-fit: contain;
}
.page-number {
    position: absolute;
    left: 5px;
    bottom: 5px;
    padding: 3px 5px;
    border-radius: 5px;
    background: rgba(0,0,0,.65);
    font-size: 9px;
    color: rgba(255,255,255,.75);
}
/* ============================================================
   EDITOR
   ============================================================ */
.editor-panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.canvas-wrap {
    position: relative;
    flex: 1;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    overflow: auto;
    background:
        linear-gradient(
            45deg,
            rgba(255,255,255,.018) 25%,
            transparent 25%,
            transparent 75%,
            rgba(255,255,255,.018) 75%
        ),
        linear-gradient(
            45deg,
            rgba(255,255,255,.018) 25%,
            transparent 25%,
            transparent 75%,
            rgba(255,255,255,.018) 75%
        );
    background-position: 0 0, 8px 8px;
    background-size: 16px 16px;
    background-color: rgba(0,0,0,.12);
}
#pdfCanvas {
    display: block;
    max-width: 100%;
    height: auto;
    background: white;
    box-shadow:
        0 12px 35px rgba(0,0,0,.35);
    touch-action: none;
}
.crop-box {
    position: absolute;
    border: 2px solid #8178ff;
    background: rgba(99,91,255,.08);
    box-shadow:
        0 0 0 99999px rgba(0,0,0,.35);
    cursor: move;
    touch-action: none;
}
.crop-box.hidden {
    display: none;
}
.crop-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid white;
    border-radius: 3px;
    background: #635bff;
}
.crop-handle.nw {
    top: -7px;
    left: -7px;
    cursor: nwse-resize;
}
.crop-handle.ne {
    top: -7px;
    right: -7px;
    cursor: nesw-resize;
}
.crop-handle.sw {
    bottom: -7px;
    left: -7px;
    cursor: nesw-resize;
}
.crop-handle.se {
    right: -7px;
    bottom: -7px;
    cursor: nwse-resize;
}
.crop-status {
    min-height: 38px;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    border-top: 1px solid rgba(255,255,255,.06);
    font-size: 11px;
    opacity: .7;
}
.crop-help {
    padding: 0 12px 10px;
    font-size: 10px;
    opacity: .4;
}
/* ============================================================
   EXPORT
   ============================================================ */
.export-panel {
    margin-top: 12px;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255,255,255,.018);
}
.settings-row {
    display: grid;
    grid-template-columns: 1.4fr .7fr .9fr 1.4fr;
    gap: 10px;
    padding: 12px;
}
.setting {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.setting > span {
    font-size: 10px;
    opacity: .5;
}
.setting select,
.setting input[type="text"] {
    width: 100%;
    height: 36px;
    box-sizing: border-box;
    padding: 0 10px;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 7px;
    background: rgba(255,255,255,.035);
    color: inherit;
    outline: none;
}
.setting select:focus,
.setting input[type="text"]:focus {
    border-color: rgba(129,120,255,.6);
}
.range-control {
    height: 36px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.range-control input {
    width: 100%;
}
.range-control strong {
    min-width: 34px;
    font-size: 11px;
    text-align: right;
}
.export-bottom {
    min-height: 55px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid rgba(255,255,255,.06);
}
.export-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 11px;
    opacity: .5;
}
.convert-btn {
    min-width: 180px;
}
.progress-area {
    padding: 10px 12px 12px;
    border-top: 1px solid rgba(255,255,255,.06);
}
.progress-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 7px;
    font-size: 11px;
}
.progress-top span {
    opacity: .55;
}
.progress-track {
    height: 5px;
    overflow: hidden;
    border-radius: 99px;
    background: rgba(255,255,255,.07);
}
.progress-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(
        90deg,
        #635bff,
        #8178ff
    );
    transition: width .2s ease;
}
.result-area {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,.06);
}
.result-header strong {
    display: block;
    font-size: 13px;
}
.result-header span {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    opacity: .5;
}
.download-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 10px;
}
.download-link {
    display: inline-flex;
    align-items: center;
    min-height: 31px;
    padding: 0 10px;
    border: 1px solid rgba(129,120,255,.3);
    border-radius: 7px;
    background: rgba(99,91,255,.08);
    color: inherit;
    text-decoration: none;
    font-size: 11px;
}
/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 850px) {
    .workspace-grid {
        grid-template-columns: 190px minmax(0,1fr);
    }
    .settings-row {
        grid-template-columns: repeat(2,minmax(0,1fr));
    }
}
@media (max-width: 680px) {
    .workspace-grid {
        grid-template-columns: 1fr;
    }
    .pages-panel {
        border-right: 0;
        border-bottom: 1px solid rgba(255,255,255,.07);
    }
    .page-grid {
        grid-template-columns: repeat(5,minmax(0,1fr));
        max-height: 145px;
    }
    .canvas-wrap {
        min-height: 400px;
    }
    .settings-row {
        grid-template-columns: 1fr;
    }
    .export-bottom {
        align-items: stretch;
        flex-direction: column;
    }
    .convert-btn {
        width: 100%;
    }
    .file-bar {
        align-items: flex-start;
    }
}
@media (max-width: 420px) {
    .page-grid {
        grid-template-columns: repeat(4,minmax(0,1fr));
    }
    .pdf-upload {
        min-height: 220px;
        padding: 25px 15px;
    }
}
