/* 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: #fff;
    color: #222;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.imgedit-quote-form .panel-heading h4 { color: #222; margin: 0; }

/* Stammkunden-Quick-Upload CTA in the form header. The class is no longer
   used by templates - the button now uses .imgedit-btn-action so it picks
   up the colors from the 'Farben & Buttons' settings tab. The selector is
   kept here as a safety net in case any cached page or third-party use of
   the old class name still exists; it inherits from the new helpers. */
.imgedit-quote-form-cta {
    display: inline-block;
    background: var(--imgedit-btn-action-bg, #575757);
    color: var(--imgedit-btn-action-fg, #ffffff) !important;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    border: 1px solid var(--imgedit-btn-action-bg, #575757);
}
.imgedit-quote-form-cta:hover,
.imgedit-quote-form-cta:focus,
.imgedit-quote-form-cta:active {
    background: var(--imgedit-btn-action-bg, #575757);
    color: var(--imgedit-btn-action-fg, #ffffff) !important;
    text-decoration: none;
    transform: none;
}

.imgedit-service-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}
.imgedit-service-option {
    display: inline-flex;
    align-items: center;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    margin: 0;
    background: #fafafa;
    transition: border-color .15s, background .15s;
    font-weight: normal;
    flex: 1 1 auto;
    justify-content: flex-start;
    white-space: nowrap;
}
.imgedit-service-option:hover { border-color: #285687; background: #f0f5fa; }
.imgedit-service-option input[type="radio"] {
    margin-right: 10px;
    flex-shrink: 0;
}
.imgedit-service-option input[type="radio"]:checked + .imgedit-service-label { color: #285687; font-weight: 600; }
.imgedit-service-label {
    line-height: 1.35;
}

.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); } }

/* Stop the spinner once the row hits a terminal state. Belt-and-braces: JS
   already replaces the spinner DOM node with a thumb or placeholder, but if
   the replacement is delayed (slow canvas decode on huge images) we don't
   want users staring at a spinning icon next to "OK". */
.is-uploaded .imgedit-thumb-loading,
.is-error .imgedit-thumb-loading {
    animation: none;
    border-color: #ccc;
    border-top-color: #ccc;
    opacity: 0.4;
}

.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;
}

.imgedit-format-hint {
    margin-top: 8px;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: #e8f5e9;
    border: 1px solid #b8e0b8;
    border-radius: 4px;
    color: #1e5a2a;
    font-size: 12px;
    line-height: 1.55;
}
.imgedit-format-hint strong { color: #14421c; }
.imgedit-format-hint .imgedit-format-hint-size {
    display: block;
    margin-top: 4px;
    color: #2f6a3a;
}

/* ====== Specs-Row: alle 5 Felder in EINER Zeile ======
   Anzahl | Ausgabeformat | Layer-Check | Fertigstellung | Express-Check
   Dropdown fuer Ausgabeformat + Layer-Check stehen direkt nebeneinander,
   die beiden Checkboxen sind vertikal mittig zur Input-Hoehe ausgerichtet. */
.imgedit-specs-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: stretch;
    margin-top: 8px;
    margin-bottom: 14px;
}
.imgedit-specs-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.imgedit-specs-field label {
    font-weight: 600;
    margin-bottom: 6px;
    white-space: nowrap;
}
.imgedit-specs-field input.form-control,
.imgedit-specs-field select.form-control {
    margin: 0;
}
.imgedit-specs-row > .imgedit-specs-field {
    flex: 1 1 0;
}
/* Checkbox-Felder: Label mittig vertikal innerhalb der Feld-Hoehe */
.imgedit-specs-check {
    justify-content: center;
}
.imgedit-specs-check label {
    margin-bottom: 0 !important;
    display: flex;
    align-items: center;
    gap: 8px;
}
.imgedit-specs-express .imgedit-check-express { margin: 0; }

@media (max-width: 768px) {
    .imgedit-specs-row > .imgedit-specs-field {
        flex: 1 1 100% !important;
        padding-bottom: 0;
    }
}

/* =====================================================================
   File View Toggle (client) - switch between list and grid
   Same rules as admin for consistency
   ===================================================================== */

.imgedit-files-wrap .imgedit-files-grid { display: none; }
.imgedit-files-wrap[data-view="grid"] .imgedit-files-table,
.imgedit-files-wrap[data-view="grid"] .imgedit-files-list { display: none; }
.imgedit-files-wrap[data-view="grid"] .imgedit-files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    padding: 10px 0;
}

.imgedit-view-toggle.active {
    background-color: #337ab7;
    color: #fff;
    border-color: #2e6da4;
}

.imgedit-grid-tile {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f5f7fa;
    border: 1px solid #e4e8f0;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.imgedit-grid-tile:hover {
    border-color: #337ab7;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.imgedit-grid-thumb-link {
    display: block;
    width: 100%;
    height: 100%;
}
.imgedit-grid-thumb {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.imgedit-grid-thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8995a5;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: #eef1f5;
}
.imgedit-grid-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 8px 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 70%, transparent 100%);
    color: #fff;
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
}
.imgedit-grid-tile:hover .imgedit-grid-overlay { opacity: 1; }
.imgedit-grid-name {
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    word-break: break-all;
    white-space: normal;
    max-height: 2.6em;
    overflow: hidden;
    margin-bottom: 3px;
}
.imgedit-grid-meta { font-size: 10px; opacity: 0.9; }

.imgedit-grid-del {
    position: absolute;
    top: 4px;
    right: 4px;
    opacity: 0;
    transition: opacity 0.15s;
    line-height: 1;
    padding: 2px 7px;
    font-size: 12px;
}
.imgedit-grid-tile:hover .imgedit-grid-del { opacity: 1; }

.imgedit-grid-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    font-style: italic;
}
