/* Desktop Processor Layout — Queue sidebar + photos on top + side-by-side fields */

/* ── Processor Layout ────────────────────────────────────────────── */

.processor-layout {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.processor-topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.processor-topbar h2 {
    margin: 0;
    font-size: 18px;
    flex: 1;
}

#processorQueueCount {
    font-size: 13px;
    color: #8E8E93;
    white-space: nowrap;
}

/* ── Two-Column: Queue Sidebar + Main Area ───────────────────────── */

.processor-columns {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 16px;
    flex: 1;
    min-height: 0;
    padding: 16px 0;
}

/* ── Queue Sidebar (left) ────────────────────────────────────────── */

.processor-queue {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.queue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.queue-header h3 {
    margin: 0;
    font-size: 15px;
}

.btn-queue-refresh {
    padding: 4px 10px;
    font-size: 13px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    color: #333;
}

.btn-queue-refresh:hover {
    background: #e5e7eb;
}

.queue-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.queue-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.queue-item:hover {
    border-color: #007AFF;
}

.queue-item.active {
    border-color: #007AFF;
    background: #E3F2FD;
}

.queue-item-thumb {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    flex-shrink: 0;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    overflow: hidden;
}

.queue-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-queue-delete {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: transparent;
    color: #C62828;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.queue-item:hover .btn-queue-delete {
    opacity: 0.6;
}

.btn-queue-delete:hover {
    opacity: 1 !important;
    background: #FFEBEE;
}

.queue-item-info {
    flex: 1;
    min-width: 0;
}

.queue-item-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.queue-item-date {
    font-size: 11px;
    color: #8E8E93;
}

.queue-empty {
    text-align: center;
    color: #8E8E93;
    font-size: 14px;
    padding: 32px 16px;
}

/* ── Main Content Area (right of queue) ──────────────────────────── */

.processor-main {
    overflow-y: auto;
    min-height: 0;
}

/* ── Photos (top of main area — sticky while scrolling) ──────────── */

.processor-photos {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #ffffff;
    padding-bottom: 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid #e5e7eb;
}

.processor-photos img {
    max-width: 100%;
    max-height: 260px;
    border-radius: 8px;
    margin-bottom: 4px;
    margin-right: 8px;
}

.processor-placeholder {
    text-align: center;
    color: #8E8E93;
    font-size: 15px;
    padding: 48px 16px;
}

.processor-photo-count {
    font-size: 13px;
    font-weight: 600;
    color: #1976D2;
    background: #E3F2FD;
    padding: 6px 12px;
    border-radius: 6px;
    margin-bottom: 10px;
}

/* ── Side-by-Side Field Grid: AI Extract | Arrow | Editable Form ── */

.processor-field-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-grid-header {
    display: grid;
    grid-template-columns: 1fr 36px 1fr;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 4px;
}

.field-grid-header span {
    font-size: 13px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.field-grid-header span:first-child {
    color: #1976D2;
}

.field-grid-header span:last-child {
    color: #333;
}

.field-grid-row {
    display: grid;
    grid-template-columns: 1fr 36px 1fr;
    gap: 8px;
    align-items: start;
    padding: 4px 0;
}

.field-grid-ai,
.field-grid-form {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.field-grid-label {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    margin-bottom: 0;
}

/* AI extracted field (left side — readonly, blue background) */
.ai-field-input {
    width: 100%;
    padding: 7px 10px;
    border: 1.5px solid #b3d4fc;
    border-radius: 6px;
    background: #EBF5FF;
    color: #1c1c1e;
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
}

.ai-field-input:focus {
    outline: none;
    border-color: #007AFF;
}

textarea.ai-field-input {
    min-height: 48px;
    resize: vertical;
}

/* Copy arrow button (center column) */
.btn-copy-field {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1.5px solid #007AFF;
    background: #ffffff;
    color: #007AFF;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    margin-top: 16px;
}

.btn-copy-field:hover {
    background: #007AFF;
    color: #ffffff;
}

.btn-copy-field.copied {
    background: #34C759;
    border-color: #34C759;
    color: #ffffff;
}

.btn-copy-field:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Editable form field (right side) */
.field-grid-form input,
.field-grid-form textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    background: #ffffff;
    color: #1c1c1e;
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
}

.field-grid-form input:focus,
.field-grid-form textarea:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.15);
}

.field-grid-form textarea {
    min-height: 48px;
    resize: vertical;
}

/* ── Actions ─────────────────────────────────────────────────────── */

.processor-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    padding-bottom: 24px;
}

.processor-actions .btn-primary {
    flex: 2;
}

.btn-skip {
    flex: 1;
    padding: 12px;
    background: #8E8E93;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-skip:hover {
    background: #636366;
}

.btn-copy-all {
    width: 100%;
    padding: 10px;
    background: #5856D6;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 12px;
}

.btn-copy-all:hover {
    background: #4845B4;
}

.btn-copy-all:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Responsive: stack on smaller screens ─────────────────────────── */

@media (max-width: 1024px) {
    .processor-layout {
        height: auto;
        min-height: 100vh;
    }

    .processor-columns {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .processor-queue {
        max-height: 200px;
    }

    .queue-list {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .queue-item {
        min-width: 180px;
        flex-shrink: 0;
    }

    .field-grid-row {
        grid-template-columns: 1fr 30px 1fr;
    }
}

@media (max-width: 768px) {
    .field-grid-header {
        display: none;
    }

    .field-grid-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .field-grid-row .btn-copy-field {
        width: 100%;
        height: 28px;
        margin-top: 0;
        font-size: 12px;
    }
}
