/* Image Editing Workflow - Client portal styles */

.imgedit-client-dropzone {
    border: 2px dashed #ccc;
    border-radius: 6px;
    padding: 50px 20px;
    text-align: center;
    color: #777;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    background: #fafafa;
}
.imgedit-client-dropzone.imgedit-dropzone-active,
.imgedit-client-dropzone:hover {
    border-color: #285687;
    background: #f0f5fa;
    color: #285687;
}
.imgedit-client-wrapper .table { margin-bottom: 0; }
.imgedit-client-wrapper .label { font-size: 11px; padding: 3px 7px; }

/* Quote form */
.imgedit-quote-form .panel-heading {
    background: #285687;
    color: #fff;
    border-bottom: 0;
}
.imgedit-quote-form .panel-heading h4 { color: #fff; }

.imgedit-service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
    margin-top: 8px;
}
.imgedit-service-option {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    margin: 0;
    background: #fafafa;
    transition: border-color .15s, background .15s;
    font-weight: normal;
}
.imgedit-service-option:hover { border-color: #285687; background: #f0f5fa; }
.imgedit-service-option input[type="radio"] { margin-right: 10px; }
.imgedit-service-option input[type="radio"]:checked + .imgedit-service-label { color: #285687; font-weight: 600; }

.imgedit-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
    margin-top: 6px;
}
.imgedit-check input[type="checkbox"] { margin: 0; }

.imgedit-check-express {
    background: #fff8e1;
    padding: 10px 14px;
    border-radius: 4px;
    border: 1px solid #ffe082;
}

.imgedit-upload-section h5 {
    font-weight: 600;
    margin-top: 0;
}

/* Triage view */
.imgedit-triage .panel-heading { background:#285687; color:#fff; border-bottom:0; }
.imgedit-triage .panel-heading h4 { color:#fff; }
.imgedit-triage .panel-heading p { color:rgba(255,255,255,.85); }

.imgedit-triage-list { margin-bottom: 20px; }

.imgedit-triage-row {
    display: flex;
    align-items: center;
    padding: 14px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 10px;
    background: #fff;
    gap: 20px;
}

.imgedit-triage-thumb { flex: 1 1 40%; }
.imgedit-triage-filename { font-weight: 600; margin-bottom: 6px; word-break: break-all; }
.imgedit-triage-meta { display: flex; gap: 8px; flex-wrap: wrap; }

.imgedit-complexity-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
}
.imgedit-complexity-badge.level-1 { background: #27ae60; }
.imgedit-complexity-badge.level-2 { background: #2ecc71; }
.imgedit-complexity-badge.level-3 { background: #f39c12; }
.imgedit-complexity-badge.level-4 { background: #e67e22; }
.imgedit-complexity-badge.level-5 { background: #c0392b; }

.imgedit-rec-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}
.imgedit-rec-ai     { background: #e8f5e9; color: #1b5e20; }
.imgedit-rec-manual { background: #fff3e0; color: #6d4c00; }
.imgedit-rec-either { background: #eceff1; color: #37474f; }

.imgedit-triage-options {
    flex: 1 1 55%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.imgedit-opt {
    display: block;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    margin: 0;
    background: #fafafa;
    transition: border-color .15s, background .15s;
    text-align: left;
    font-weight: normal;
}
.imgedit-opt:hover { border-color: #285687; background: #f0f5fa; }
.imgedit-opt input[type="radio"] { margin-right: 8px; vertical-align: middle; }
.imgedit-opt.is-locked { opacity: .5; cursor: not-allowed; }
.imgedit-opt-title { display: inline-block; font-weight: 600; vertical-align: middle; }
.imgedit-opt-subtitle { display: block; font-size: 13px; color: #666; margin-top: 4px; margin-left: 22px; }

.imgedit-opt input:checked ~ .imgedit-opt-title { color: #285687; }

.imgedit-triage-summary {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 16px;
    margin-top: 20px;
}
.imgedit-triage-summary .summary-line {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}
.imgedit-triage-summary .summary-grand {
    font-size: 18px;
    border-top: 2px solid #285687;
    padding-top: 8px;
    margin-top: 4px;
}

@media (max-width: 768px) {
    .imgedit-triage-row { flex-direction: column; align-items: stretch; }
    .imgedit-triage-options { grid-template-columns: 1fr; }
}

/* Upload list with inline thumbnails. Capped height so uploading 100+ files
   doesn't push the rest of the form off-screen. */
.imgedit-upload-list {
    margin-top: 10px;
    max-height: 360px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid transparent;
    border-radius: 4px;
    padding-right: 4px;
}
.imgedit-upload-list:not(:empty) {
    border-color: #e5e7eb;
    background: #fafafa;
    padding: 6px;
}
.imgedit-upload-list::-webkit-scrollbar { width: 10px; }
.imgedit-upload-list::-webkit-scrollbar-track { background: #f3f4f6; border-radius: 4px; }
.imgedit-upload-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.imgedit-upload-list::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.imgedit-upload-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    margin-bottom: 6px;
    background: #fff;
}
.imgedit-upload-item.is-uploading { background: #fff8e1; }
.imgedit-upload-item.is-uploaded  { background: #f1f8e9; }
.imgedit-upload-item.is-error     { background: #ffebee; border-color: #ef9a9a; }

.imgedit-thumb-wrap {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 3px;
    overflow: hidden;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
}
.imgedit-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    cursor: pointer;
    display: block;
    transition: opacity .15s;
}
.imgedit-thumb:hover { opacity: .85; }

.imgedit-thumb-loading {
    width: 18px;
    height: 18px;
    border: 2px solid #bbb;
    border-top-color: #285687;
    border-radius: 50%;
    animation: imgedit-spin 0.8s linear infinite;
}
@keyframes imgedit-spin { to { transform: rotate(360deg); } }

.imgedit-upload-meta {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}
.imgedit-upload-name {
    font-weight: 500;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.imgedit-upload-status {
    font-size: 12px;
    color: #666;
}
.is-error .imgedit-upload-status { color: #c62828; }
.is-uploaded .imgedit-upload-status { color: #2e7d32; }

.imgedit-upload-actions {
    flex: 0 0 auto;
}
.imgedit-delete-btn {
    font-size: 16px;
    line-height: 1;
    padding: 2px 8px;
    color: #c62828;
}
.imgedit-delete-btn:hover { background: #ffebee; color: #b71c1c; }

/* Server-rendered thumbnail rows in order detail view */
.imgedit-file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-bottom: 1px solid #f0f0f0;
}
.imgedit-file-row:last-child { border-bottom: none; }

/* Long file lists get a capped-height scrollable container.
   Applied by wrapping .imgedit-files-block with .imgedit-scroll-container.
   Kicks in above 8 files and caps visible area so 100+ uploads don't
   stretch the page into infinity. */
.imgedit-scroll-container {
    max-height: 440px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background: #fafafa;
    padding: 4px;
}
.imgedit-scroll-container::-webkit-scrollbar {
    width: 10px;
}
.imgedit-scroll-container::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 4px;
}
.imgedit-scroll-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.imgedit-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
.imgedit-scroll-hint {
    font-size: 12px;
    color: #6b7280;
    padding: 4px 8px 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.imgedit-scroll-container > table {
    margin-bottom: 0 !important;
}
.imgedit-scroll-container > table thead th {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
    box-shadow: 0 2px 0 #e5e7eb;
}

.imgedit-server-thumb {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    object-fit: cover;
    border-radius: 3px;
    cursor: pointer;
    background: #eee;
}

/* Lightbox modal */
.imgedit-lightbox {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, .85);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}
.imgedit-lightbox.is-open { display: flex; }
.imgedit-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    box-shadow: 0 4px 30px rgba(0,0,0,.5);
    cursor: default;
}
.imgedit-lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    user-select: none;
}

.imgedit-empty-state {
    padding: 60px 20px;
    background: #fafafa;
    border: 1px dashed #ddd;
    border-radius: 6px;
}
.imgedit-empty-state h3 {
    margin-top: 0;
    font-weight: 300;
    color: #285687;
}
.imgedit-empty-state .btn { margin: 0 5px; }

.imgedit-dashboard-widget .panel-heading {
    background: #285687;
    color: #fff;
    border-bottom: 0;
}
.imgedit-dashboard-widget .panel-heading h4,
.imgedit-dashboard-widget .panel-heading .label {
    color: #fff;
}
.imgedit-dashboard-widget .panel-heading .label {
    background: rgba(255, 255, 255, 0.25);
}
.imgedit-dashboard-widget .btn-lg { margin-right: 5px; margin-bottom: 5px; }

/* ====== Triage bulk action buttons ====== */
.imgedit-triage-bulk {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.imgedit-triage-bulk-bottom {
    margin-top: 12px;
    margin-bottom: 16px;
}
.imgedit-triage-bulk-label {
    font-weight: 600;
    color: #374151;
    margin-right: 8px;
}

/* ====== Triage scroll container ====== */
.imgedit-triage-scroll {
    max-height: 560px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 4px;
    background: #fff;
}
.imgedit-triage-scroll::-webkit-scrollbar { width: 10px; }
.imgedit-triage-scroll::-webkit-scrollbar-track { background: #f3f4f6; border-radius: 4px; }
.imgedit-triage-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.imgedit-triage-scroll::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ====== Scoring overlay ====== */
.imgedit-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 18, 33, 0.78);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
    animation: imgeditOverlayIn 240ms ease-out;
}
@keyframes imgeditOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.imgedit-overlay-card {
    background: #fff;
    border-radius: 10px;
    padding: 36px 44px;
    min-width: 380px;
    max-width: 520px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.imgedit-overlay-spinner {
    width: 56px;
    height: 56px;
    border: 5px solid #e6ecf4;
    border-top-color: #285687;
    border-radius: 50%;
    margin: 0 auto 18px;
    animation: imgeditSpin 0.9s linear infinite;
}
@keyframes imgeditSpin {
    to { transform: rotate(360deg); }
}

.imgedit-overlay-title {
    color: #1f2937;
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 600;
}
.imgedit-overlay-progress {
    color: #4b5563;
    font-size: 15px;
    margin-bottom: 14px;
}
.imgedit-overlay-progress span {
    font-weight: 700;
    color: #285687;
}

.imgedit-overlay-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 18px;
}
.imgedit-overlay-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #285687 0%, #3b7dc3 100%);
    border-radius: 4px;
    transition: width 400ms ease-out;
}

.imgedit-overlay-hint {
    color: #6b7280;
    font-size: 13px;
    margin: 0;
    line-height: 1.5;
}
