/* MigraDoc custom styles */

.upload-zone {
    border: 2px dashed var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
    margin-bottom: 1rem;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--pico-primary);
    background: var(--pico-primary-focus);
}

.upload-zone input[type="file"] {
    display: none;
}

.doc-preview {
    max-width: 200px;
    max-height: 200px;
    object-fit: contain;
    border-radius: var(--pico-border-radius);
    border: 1px solid var(--pico-muted-border-color);
}

.doc-preview-large {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
}

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-draft { background: #e3e8ef; color: #4a5568; }
.status-ocr_processing { background: #fef3c7; color: #92400e; }
.status-ocr_done { background: #d1fae5; color: #065f46; }
.status-ocr_partial { background: #fef3c7; color: #92400e; }
.status-ocr_failed { background: #fee2e2; color: #991b1b; }
.status-filled { background: #dbeafe; color: #1e40af; }
.status-generated { background: #c7d2fe; color: #3730a3; }
.status-error { background: #fee2e2; color: #991b1b; }

.ocr-empty {
    border-color: #f59e0b !important;
    background-color: #fffbeb !important;
}

.ocr-low-confidence {
    border-color: #f59e0b !important;
    background-color: #fef3c7 !important;
}

/* UVM selector: input+datalist on desktop, select on touch devices */
.uvm-mobile { display: none; }
@media (pointer: coarse) {
    .uvm-desktop { display: none; }
    .uvm-mobile { display: block; }
}

.ocr-low-confidence-text {
    color: #b45309;
    font-weight: 600;
}

.ocr-readonly {
    background-color: #f3f4f6 !important;
    color: #6b7280 !important;
    font-size: 0.85em;
}

.ocr-warning {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 0 var(--pico-border-radius) var(--pico-border-radius) 0;
}

.ocr-error-banner {
    background: #fee2e2;
    border-left: 4px solid #ef4444;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 0 var(--pico-border-radius) var(--pico-border-radius) 0;
}

.ocr-stats {
    font-size: 0.9rem;
    color: var(--pico-muted-color);
    margin-bottom: 1rem;
}

/* Document + fields side-by-side in review */
.doc-fields-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    align-items: start;
}

.doc-image-col {
    position: sticky;
    top: 1rem;
}

.doc-review-img {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: var(--pico-border-radius);
    border: 1px solid var(--pico-muted-border-color);
    cursor: pointer;
    transition: max-height 0.3s;
}

.doc-review-img-full {
    max-height: none !important;
}

@media (max-width: 768px) {
    .doc-fields-grid {
        grid-template-columns: 1fr;
    }
    .doc-image-col {
        position: static;
    }
    .doc-review-img {
        max-height: 250px;
    }
}

.step-indicator {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.step-indicator .step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    background: var(--pico-muted-border-color);
    color: var(--pico-muted-color);
}

.step-indicator .step.active {
    background: var(--pico-primary);
    color: white;
}

.step-indicator .step.done {
    background: var(--pico-ins-color);
    color: white;
}

.step-indicator a.step-link {
    text-decoration: none;
    cursor: pointer;
    opacity: 0.85;
    transition: opacity 0.15s;
}

.step-indicator a.step-link:hover {
    opacity: 1;
    text-decoration: underline;
}

.spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--pico-muted-border-color);
    border-top-color: var(--pico-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.field-group {
    background: var(--pico-card-background-color);
    padding: 1.5rem;
    border-radius: var(--pico-border-radius);
    margin-bottom: 1rem;
}

.field-group h4 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--pico-muted-border-color);
}

.lang-switcher {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.lang-switcher a {
    opacity: 0.6;
}

.lang-switcher a:hover {
    opacity: 1;
}
