/* ══════════════════════════════════════════════
   SHARED EDITOR ENGINE STYLES
   Used by both index.html and tools/photo-signature-resizer.html
   so the interactive resizer panel looks/behaves identically
   wherever it's embedded. Relies on the :root custom properties
   (--ink, --accent, --surface2, --green, --red, --amber, etc.)
   already defined on the host page — keep those in sync if you
   add new ones here.
   ══════════════════════════════════════════════ */

/* Used by fileInput/signInput/editorZone/pdfPreview inside #editorPage —
   genuinely part of the editor markup's required styling, not just a
   landing-page utility, so it lives here rather than only on index.html. */
.hidden {
    display: none !important;
}

/* ── EDITOR PAGE ── */

#editorPage {
    display: none;
    min-height: 100vh;
    flex-direction: column;
}

.editor-topbar {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--ink3);
    transition: color 0.2s;
    flex-shrink: 0;
}

.back-btn:hover {
    color: var(--ink);
}

.editor-exam-name {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
}

.editor-exam-specs {
    font-size: 12px;
    color: var(--ink3);
}

.editor-layout {
    display: flex;
    flex: 1;
    min-height: calc(100vh - 56px);
}
/* ── LEFT PANEL ── */

.left-panel {
    width: 280px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    background: white;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}

@media (max-width: 900px) {
    .left-panel {
        display: none;
    }
}

.panel-section {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.panel-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink3);
    margin-bottom: 14px;
}
/* Readiness checker */

.readiness-score {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.score-ring {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    position: relative;
}

.score-ring svg {
    transform: rotate(-90deg);
}

.score-ring .score-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 800;
}

.readiness-label {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
}

.readiness-sub {
    font-size: 11px;
    color: var(--ink3);
    margin-top: 2px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    font-size: 12px;
    border-bottom: 1px solid var(--border);
}

.check-row:last-child {
    border-bottom: none;
}

.check-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
}

.check-icon.pass {
    background: var(--green-soft);
    color: var(--green);
}

.check-icon.fail {
    background: var(--red-soft);
    color: var(--red);
}

.check-icon.warn {
    background: var(--amber-soft);
    color: var(--amber);
}

.check-icon.idle {
    background: var(--surface3);
    color: var(--ink3);
}

.check-label {
    flex: 1;
    color: var(--ink2);
}

.check-value {
    font-size: 11px;
    color: var(--ink3);
    font-weight: 500;
}
/* Spec display */

.spec-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 12px;
    border-bottom: 1px solid var(--border);
}

.spec-row:last-child {
    border-bottom: none;
}

.spec-key {
    color: var(--ink3);
}

.spec-val {
    font-weight: 600;
    color: var(--accent);
    font-family: var(--font-display);
    font-size: 13px;
}
/* Mode tabs */

.mode-tabs {
    display: flex;
    background: var(--surface2);
    border-radius: 10px;
    padding: 3px;
}

.mode-tab {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: none;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--ink3);
}

.mode-tab.active {
    background: white;
    color: var(--accent);
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
/* Download btn */

.download-btn {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.download-btn:hover {
    background: #4338ca;
}

.download-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
/* ── WORKSPACE ── */

.workspace {
    flex: 1;
    background: #f0f0f8;
    background-image: radial-gradient(#d8d8ea 1px, transparent 1px);
    background-size: 22px 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    min-height: 400px;
}
/* Dropzone */

.dropzone {
    background: white;
    border: 2px dashed #c7c7e0;
    border-radius: 24px;
    padding: 64px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    max-width: 480px;
    width: 100%;
}

.dropzone:hover,
.dropzone.drag-over {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.dropzone-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.dropzone h3 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.dropzone p {
    font-size: 13px;
    color: var(--ink3);
    line-height: 1.6;
}

.dropzone-btn {
    margin-top: 20px;
    display: inline-block;
    padding: 10px 24px;
    background: var(--accent);
    color: white;
    border-radius: 10px;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
}

.dropzone-privacy {
    margin-top: 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--green);
}
/* Canvas */

#mainCanvas {
    border-radius: 8px;
    display: block;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    border: 4px solid white;
    max-width: 90vw;
    height: auto;
}
/* Editor toolbar */

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 20px;
}

.tool-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    background: white;
    border: 1px solid var(--border2);
    border-radius: 10px;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--ink);
}

.tool-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.tool-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}
/* ── RIGHT PANEL / MOBILE BOTTOM ── */

.right-panel {
    width: 240px;
    flex-shrink: 0;
    border-left: 1px solid var(--border);
    background: white;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

@media (max-width: 1100px) {
    .right-panel {
        display: none;
    }
}
/* Mobile bottom bar */

.mobile-bar {
    display: none;
    position: sticky;
    bottom: 0;
    z-index: 90;
    background: white;
    border-top: 1px solid var(--border);
    padding: 12px 16px;
    gap: 10px;
}

@media (max-width: 900px) {
    .mobile-bar {
        display: flex;
    }
}
/* ── CROP MODAL ── */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(15, 15, 26, 0.85);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-overlay.open {
    display: flex;
}

.modal-box {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 540px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--ink3);
    line-height: 1;
    padding: 0;
}

.modal-body {
    flex: 1;
    overflow: hidden;
    background: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.modal-body img {
    max-width: 100%;
    max-height: 100%;
}

.modal-footer {
    padding: 16px;
    display: flex;
    gap: 10px;
}

.modal-btn-primary {
    flex: 1;
    padding: 12px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.modal-btn-secondary {
    padding: 12px 20px;
    background: white;
    color: var(--ink);
    border: 1px solid var(--border2);
    border-radius: 10px;
    font-family: var(--font-body);
    font-size: 14px;
    cursor: pointer;
}
/* Background remover options */

.bg-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.bg-opt {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.bg-opt:hover,
.bg-opt.selected {
    border-color: var(--accent);
}

.bg-opt.white {
    background: white;
    box-shadow: inset 0 0 0 1px #ddd;
}

.bg-opt.blue {
    background: #b3d9ff;
}

.bg-opt.lightblue {
    background: #e8f4fd;
}

.bg-opt.gray {
    background: #f0f0f0;
}
/* Toast */

.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--ink);
    color: white;
    padding: 10px 20px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    z-index: 300;
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
/* Share prompt */

.share-prompt {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: white;
    border: 1px solid var(--border2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border-radius: 16px;
    padding: 16px 40px 16px 16px;
    z-index: 250;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
    max-width: 320px;
    width: calc(100% - 32px);
}

.share-prompt.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.share-prompt-text {
    font-size: 13px;
    color: var(--ink);
    line-height: 1.5;
    margin-bottom: 12px;
}

.share-whatsapp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #25d366;
    color: white;
    padding: 10px 16px;
    border-radius: 10px;
    text-decoration: none;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    transition: background 0.2s;
}

.share-whatsapp-btn:hover {
    background: #1ebe5a;
}

.share-prompt-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 18px;
    color: var(--ink3);
    cursor: pointer;
    line-height: 1;
    padding: 6px;
}

@media (max-width: 900px) {
    .share-prompt {
        bottom: 100px;
    }
}
