/* ── Drop Zone ─────────────────────────────────────────────── */
.photo-drop-zone {
    border: 2px dashed #ced4da;
    border-radius: 10px;
    background: #f8f9fa;
    min-height: 150px;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
        -ms-flex-align: center;
            align-items: center;
    -webkit-box-pack: center;
        -ms-flex-pack: center;
            justify-content: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    position: relative;
    overflow: hidden;
}
.photo-drop-zone:hover,
.photo-drop-zone.drag-over {
    border-color: #007bff;
    background: #e8f0ff;
}
.drop-placeholder { text-align: center; padding: 24px 16px; pointer-events: none; }
.drop-icon { font-size: 36px; margin-bottom: 8px; }
.drop-title { font-weight: 700; font-size: 15px; color: #343a40; margin-bottom: 4px; }
.drop-sub   { font-size: 12px; color: #868e96; }
.drop-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 20px;
    background: #007bff;
    color: #fff;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 700;
    border: none;
    pointer-events: none;
}

/* Preview */
.drop-preview {
    position: relative;
    width: 100%;
    min-height: 150px;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
        -ms-flex-align: center;
            align-items: center;
    -webkit-box-pack: center;
        -ms-flex-pack: center;
            justify-content: center;
    padding: 12px;
}
.drop-preview img {
    max-height: 180px;
    max-width: 100%;
    border-radius: 8px;
    object-fit: contain;
    display: block;
    box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.preview-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.45);
    border-radius: 8px;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
        -ms-flex-align: center;
            align-items: center;
    -webkit-box-pack: center;
        -ms-flex-pack: center;
            justify-content: center;
    gap: 10px;
    opacity: 0;
    transition: opacity .2s;
}
.drop-preview:hover .preview-overlay { opacity: 1; }
.btn-prev-action {
    background: white;
    border: none;
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.btn-prev-action:hover { background: #e9ecef; }
.btn-prev-action.danger { background: #ffe0e0; color: #c0392b; }
.btn-prev-action.danger:hover { background: #ffc0c0; }
.preview-badge {
    position: absolute;
    bottom: 14px;
    right: 14px;
    background: rgba(0,0,0,.6);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
    pointer-events: none;
}
.preview-tick {
    position: absolute;
    top: 14px;
    left: 14px;
    background: #28a745;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
    pointer-events: none;
}

/* Size warning */
.size-alert {
    display: none;
    margin-top: 6px;
    padding: 8px 12px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    font-size: 13px;
    color: #856404;
}

/* ── Modal Backdrop ─────────────────────────────────────────── */
.img-modal-backdrop {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.55);
    z-index: 9999;
    -webkit-box-align: center;
        -ms-flex-align: center;
            align-items: center;
    -webkit-box-pack: center;
        -ms-flex-pack: center;
            justify-content: center;
    padding: 16px;
}
.img-modal-backdrop.open {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}

/* ── Modal Box ──────────────────────────────────────────────── */
.img-modal {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 1024px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
        -ms-flex-direction: column;
            flex-direction: column;
}

/* Header */
.img-modal-header {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
        -ms-flex-align: center;
            align-items: center;
    gap: 10px;
    padding: 16px 20px 12px;
    border-bottom: 1px solid #e9ecef;
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
}
.img-modal-header h5 {
    -webkit-box-flex: 1;
        -ms-flex: 1;
            flex: 1;
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: #212529;
}
.img-modal-close {
    width: 30px; height: 30px;
    border-radius: 50%;
    border: none;
    background: #f1f3f5;
    color: #868e96;
    font-size: 14px;
    cursor: pointer;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
        -ms-flex-align: center;
            align-items: center;
    -webkit-box-pack: center;
        -ms-flex-pack: center;
            justify-content: center;
    transition: all .15s;
    line-height: 1;
    padding: 0;
}
.img-modal-close:hover { background: #ffe0e0; color: #c0392b; }

/* Body */
.img-modal-body { padding: 18px 20px; -webkit-box-flex: 1; -ms-flex: 1; flex: 1; }

/* Side-by-side preview */
.modal-previews {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
        -ms-flex-align: center;
            align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 12px;
    -ms-flex-wrap: wrap;
        flex-wrap: wrap;
}
.modal-preview-box {
    -webkit-box-flex: 1;
        -ms-flex: 1;
            flex: 1;
    min-width: 110px;
    text-align: center;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
        -ms-flex-direction: column;
            flex-direction: column;
    -webkit-box-align: center;
        -ms-flex-align: center;
            align-items: center;
    gap: 6px;
}
.modal-preview-label {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: #868e96;
}
.modal-preview-box img {
    max-height: 140px;
    max-width: 100%;
    border-radius: 6px;
    object-fit: contain;
    border: 1px solid #dee2e6;
    background: #fff;
    width: 100%;
}
.modal-preview-meta {
    font-size: 11px;
    font-weight: 700;
    color: #495057;
    background: #fff;
    padding: 2px 10px;
    border-radius: 20px;
    border: 1px solid #dee2e6;
}
.modal-preview-arrow {
    font-size: 18px;
    color: #adb5bd;
    -ms-flex-negative: 0;
        flex-shrink: 0;
    font-weight: 900;
    -ms-flex-item-align: center;
        align-self: center;
}

/* Controls */
.modal-controls {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
        -ms-flex-direction: column;
            flex-direction: column;
    gap: 16px;
}
.mc-group {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
        -ms-flex-direction: column;
            flex-direction: column;
    gap: 6px;
}
.mc-label {
    font-size: 11px;
    font-weight: 800;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: .5px;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
        -ms-flex-align: center;
            align-items: center;
    gap: 8px;
    margin: 0;
}
.mc-badge {
    font-size: 12px;
    background: #fde8ec;
    color: #c0392b;
    padding: 1px 10px;
    border-radius: 20px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
}
.mc-badge-green {
    font-size: 12px;
    background: #d4edda;
    color: #155724;
    padding: 1px 10px;
    border-radius: 20px;
    font-weight: 700;
}

/* Range */
.mc-range {
    -webkit-appearance: none;
    -moz-appearance: none;
         appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #dee2e6;
    outline: none;
    cursor: pointer;
}
.mc-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,123,255,.4);
    border: 3px solid #fff;
}
.mc-range::-moz-range-thumb {
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: 3px solid #fff;
}
.mc-range-hints {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: justify;
        -ms-flex-pack: justify;
            justify-content: space-between;
    font-size: 10px;
    color: #adb5bd;
    font-weight: 600;
}

/* Number row */
.mc-row {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
        -ms-flex-align: center;
            align-items: center;
    gap: 6px;
}
.mc-num {
    -webkit-box-flex: 1;
        -ms-flex: 1;
            flex: 1;
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 7px 8px;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    outline: none;
    transition: border-color .2s;
    -moz-appearance: textfield;
    width: 100%;
}
.mc-num::-webkit-outer-spin-button,
.mc-num::-webkit-inner-spin-button { -webkit-appearance: none; }
.mc-num:focus { border-color: #007bff; box-shadow: 0 0 0 2px rgba(0,123,255,.15); }
.mc-x { color: #adb5bd; font-weight: 800; font-size: 14px; }
.mc-lock {
    width: 36px; height: 36px;
    border-radius: 6px;
    border: 1px solid #ced4da;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 15px;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
        -ms-flex-align: center;
            align-items: center;
    -webkit-box-pack: center;
        -ms-flex-pack: center;
            justify-content: center;
    transition: all .15s;
    -ms-flex-negative: 0;
        flex-shrink: 0;
    padding: 0;
}
.mc-lock.locked { border-color: #007bff; background: #e8f0ff; }

/* Presets */
.mc-presets {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    gap: 6px;
    -ms-flex-wrap: wrap;
        flex-wrap: wrap;
}
.mc-preset {
    padding: 5px 12px;
    border-radius: 50px;
    border: 1px solid #ced4da;
    background: #fff;
    font-size: 12px;
    font-weight: 700;
    color: #495057;
    cursor: pointer;
    transition: all .15s;
}
.mc-preset:hover { border-color: #007bff; color: #007bff; }
.mc-preset.active { border-color: #007bff; color: #fff; background: #007bff; }

/* Preview btn */
.mc-preview-btn {
    padding: 8px 18px;
    border-radius: 6px;
    border: 1px solid #007bff;
    background: #e8f0ff;
    color: #007bff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
    -ms-flex-item-align: start;
        align-self: flex-start;
}
.mc-preview-btn:hover { background: #007bff; color: #fff; }

/* Footer */
.img-modal-footer {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
        -ms-flex-align: center;
            align-items: center;
    gap: 8px;
    padding: 12px 20px 16px;
    border-top: 1px solid #e9ecef;
    position: -webkit-sticky;
    position: sticky;
    bottom: 0;
    background: #fff;
    -ms-flex-wrap: wrap;
        flex-wrap: wrap;
}
.modal-saving {
    -webkit-box-flex: 1;
        -ms-flex: 1;
            flex: 1;
    font-size: 12px;
    font-weight: 700;
    color: #28a745;
    min-width: 120px;
}
.mc-btn-cancel {
    padding: 8px 20px;
    border-radius: 50px;
    border: 1px solid #ced4da;
    background: #fff;
    font-size: 13px;
    font-weight: 700;
    color: #495057;
    cursor: pointer;
    transition: all .15s;
}
.mc-btn-cancel:hover { border-color: #adb5bd; }
.mc-btn-apply {
    padding: 8px 24px;
    border-radius: 50px;
    border: none;
    background: #007bff;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: all .2s;
    box-shadow: 0 3px 10px rgba(0,123,255,.3);
}
.mc-btn-apply:hover {
    background: #0069d9;
    -webkit-transform: translateY(-1px);
            transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(0,123,255,.4);
}

/* Processing spinner overlay on result img */
.result-loading {
    opacity: .4;
    -webkit-filter: blur(1px);
            filter: blur(1px);
    transition: opacity .3s, -webkit-filter .3s;
    transition: opacity .3s, filter .3s;
    transition: opacity .3s, filter .3s, -webkit-filter .3s;
}