/* ============================================================
   Photo Magnets Uploader — pmu-style.css  v4.0.0
   ============================================================ */


/* ── Upload section wrapper ──────────────────────────────── */

#pmu-uploader-section {
    margin: 24px 0 16px;
    padding: 18px 20px;
    background: #fafafa;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
}

.pmu-section-title {
    font-size: 1.05em;
    font-weight: 700;
    margin: 0 0 14px;
    color: #222;
}


/* ── Slots ───────────────────────────────────────────────── */

#pmu-slots-container {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 14px;
}

.pmu-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    width: 96px;
}

.pmu-slot-preview {
    position: relative;
    width: 88px;
    height: 88px;
    border: 2px dashed #c8c8c8;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.pmu-slot-done .pmu-slot-preview {
    border: 2px solid #2e7d32;
    box-shadow: 0 0 0 3px rgba(46,125,50,0.12);
}

.pmu-slot-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pmu-slot-number {
    font-size: 1.6em;
    font-weight: 700;
    color: #ccc;
    user-select: none;
}

.pmu-slot-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    padding: 0;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 11px;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
    transition: background 0.15s;
    z-index: 2;
}

.pmu-slot-remove:hover {
    background: rgba(200,0,0,0.8);
}

.pmu-upload-btn.button {
    font-size: 0.72em !important;
    padding: 5px 8px !important;
    min-height: auto !important;
    width: 88px;
    text-align: center;
}

.pmu-spinner {
    width: 26px;
    height: 26px;
    border: 3px solid #eee;
    border-top-color: #2e7d32;
    border-radius: 50%;
    animation: pmu-spin 0.7s linear infinite;
}

@keyframes pmu-spin { to { transform: rotate(360deg); } }

#pmu-status-message {
    font-size: 0.9em;
    font-weight: 600;
    min-height: 1.4em;
    margin: 4px 0 0;
}

.pmu-status-complete { color: #2e7d32; }
.pmu-status-partial  { color: #666; }

@media (max-width: 480px) {
    .pmu-slot     { width: 80px; }
    .pmu-slot-preview { width: 74px; height: 74px; }
    .pmu-upload-btn.button { width: 74px; font-size: 0.65em !important; }
}


/* ============================================================
   CANVAS EDITOR MODAL
   ============================================================ */

#pmu-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.80);
    z-index: 1000000;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

#pmu-modal.active {
    display: flex;
}

body.pmu-modal-open {
    overflow: hidden;
}

#pmu-modal-inner {
    background: #fff;
    border-radius: 14px;
    padding: 22px 22px 20px;
    width: min( 520px, 100% );
    max-height: 96vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.45);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Header */
#pmu-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

#pmu-modal-header h3 {
    margin: 0 0 4px;
    font-size: 1.1em;
    color: #111;
}

.pmu-crop-hint {
    font-size: 0.82em;
    color: #888;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.pmu-hint-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #222;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
}

.pmu-hint-resize {
    border-radius: 3px;
}

#pmu-modal-close {
    background: #f0f0f0;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
    line-height: 32px;
    text-align: center;
    padding: 0;
}

#pmu-modal-close:hover {
    background: #e0e0e0;
}

/* ── Canvas wrapper — the square magnet area ─────────────── */

#pmu-canvas-wrapper {
    position: relative;
    align-self: center;
    /* Responsive: fills modal width but stays square */
    width: min( 420px, calc( 100vw - 80px ) );
    aspect-ratio: 1 / 1;
    box-shadow:
        0 0 0 2px #bbb,            /* thin border = canvas edge */
        0 4px 18px rgba(0,0,0,0.18);
    border-radius: 4px;
    overflow: hidden;              /* clips image that goes outside canvas */
    background: #fff;
    cursor: move;
}

#pmu-editor-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: inherit;
}

/* "Print area" label — faint, sits below the canvas */
#pmu-canvas-border-label {
    position: absolute;
    bottom: -22px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.72em;
    color: #aaa;
    letter-spacing: 0.04em;
    pointer-events: none;
}

/* ── Zoom controls ───────────────────────────────────────── */

#pmu-zoom-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 2px;
    margin-top: 10px; /* offset for the "Print area" label */
}

.pmu-zoom-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #f5f5f5;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    padding: 0;
}

.pmu-zoom-btn:hover {
    background: #e8e8e8;
}

#pmu-zoom-slider {
    flex: 1;
    accent-color: #2e7d32;
    height: 4px;
    cursor: pointer;
}

/* ── Modal action buttons ────────────────────────────────── */

#pmu-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 2px;
}

#pmu-crop-cancel {
    background: #f2f2f2;
    color: #444;
    border: 1px solid #ddd;
    padding: 9px 22px;
    border-radius: 6px;
    font-size: 0.95em;
    cursor: pointer;
    transition: background 0.15s;
}

#pmu-crop-cancel:hover {
    background: #e8e8e8;
}

#pmu-crop-confirm {
    background: #2e7d32;
    color: #fff;
    border: none;
    padding: 9px 24px;
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}

#pmu-crop-confirm:hover:not(:disabled) {
    background: #1b5e20;
}

#pmu-crop-confirm:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}


/* ============================================================
   ADMIN ORDER PAGE
   ============================================================ */

.pmu-admin-images {
    margin-top: 10px;
    padding: 10px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.pmu-admin-label {
    margin: 0 0 8px;
    font-size: 0.9em;
}

.pmu-admin-meta {
    display: inline-block;
    margin-left: 8px;
    font-size: 0.82em;
    color: #777;
    font-weight: normal;
}

.pmu-admin-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pmu-admin-thumbs a {
    position: relative;
    display: inline-block;
    text-decoration: none;
}

.pmu-admin-thumbs img {
    display: block;
    width: 72px;
    height: 72px;
    object-fit: cover;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.pmu-admin-thumbs a:hover img {
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0,115,170,0.3);
}

.pmu-img-num {
    position: absolute;
    bottom: 3px;
    left: 3px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    line-height: 1.4;
}
