/*mle-baked*/
/* ═══════════════════════════════════════════════════════════════
   MLE Vision v2.0 — Styles
   OpenEMR-native design tokens
   ═══════════════════════════════════════════════════════════════ */

:root {
    --navy-900: #0f172a;
    --navy-800: #1e293b;
    --navy-700: #334155;
    --navy-600: #475569;
    --surface-0: #ffffff;
    --surface-50: #f8fafc;
    --surface-100: #f1f5f9;
    --surface-200: #e2e8f0;
    --surface-300: #cbd5e1;
    --accent-500: #0369a1;
    --accent-600: #0284c7;
    --accent-700: #0c4a6e;
    --success-500: #16a34a;
    --success-100: #dcfce7;
    --warning-500: #d97706;
    --warning-100: #fef3c7;
    --error-500: #dc2626;
    --error-100: #fee2e2;
    --brand: #00D4FF;
    --radius: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Plus Jakarta Sans', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--surface-50);
    color: var(--navy-800);
    line-height: 1.5;
}

#vision-app {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px;
}

/* ── Header ── */
.vision-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--navy-800);
    color: white;
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.vision-header-left { display: flex; align-items: center; gap: 12px; }
.vision-logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; }
.vision-logo svg { color: var(--brand); }
.vision-version { font-size: 11px; opacity: 0.5; }
.vision-header-right { display: flex; gap: 8px; }

.vision-level-badge, .vision-qa-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(255,255,255,0.15);
}
.vision-qa-badge { background: rgba(0,212,255,0.2); color: var(--brand); }

/* ── Steps ── */
.vision-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 20px;
    padding: 12px 0;
}

.step {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--surface-300);
    font-weight: 500;
}
.step.active { color: var(--accent-500); }
.step.current { color: var(--navy-800); font-weight: 700; }

.step-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--surface-200);
    color: var(--surface-300);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}
.step.active .step-dot { background: var(--accent-500); color: white; }
.step.current .step-dot { background: var(--navy-800); color: white; }

.step-line {
    width: 40px;
    height: 2px;
    background: var(--surface-200);
    margin: 0 8px;
}

/* ── Panels ── */
.vision-panel {
    background: var(--surface-0);
    border-radius: 8px;
    box-shadow: var(--shadow);
    border: 1px solid var(--surface-200);
}

.panel-body { padding: 24px; }

/* ── Type Selector ── */
.type-selector { margin-bottom: 20px; }
.type-selector label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--navy-600);
    margin-bottom: 6px;
}
.type-selector select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--surface-200);
    border-radius: var(--radius);
    font-size: 14px;
    background: var(--surface-0);
    color: var(--navy-800);
}
.type-desc {
    font-size: 12px;
    color: var(--navy-600);
    margin-top: 4px;
}

/* ── Upload Zone ── */
.upload-zone {
    border: 2px dashed var(--surface-300);
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--accent-500);
    background: rgba(3,105,161,0.03);
}

.upload-icon { color: var(--surface-300); margin-bottom: 12px; }
.upload-text { font-size: 15px; font-weight: 600; color: var(--navy-700); margin-bottom: 4px; }
.upload-hint { font-size: 12px; color: var(--navy-600); margin-bottom: 16px; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent-500); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--accent-700); }
.btn-outline { background: transparent; border: 1px solid var(--surface-200); color: var(--navy-700); }
.btn-outline:hover { background: var(--surface-50); }
.btn-camera { background: var(--navy-800); color: white; }
.btn-camera:hover { background: var(--navy-700); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }

/* ── Image Preview ── */
.image-preview {
    text-align: center;
    margin-top: 12px;
}
.image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius);
    border: 1px solid var(--surface-200);
}

/* ── Processing ── */
.processing-body { text-align: center; padding: 60px 24px; }

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--surface-200);
    border-top-color: var(--accent-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.process-status { font-size: 16px; font-weight: 600; color: var(--navy-800); }
.process-detail { font-size: 13px; color: var(--navy-600); margin-top: 4px; }

/* ── Review Layout ── */
.review-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
@media (max-width: 768px) {
    .review-layout { grid-template-columns: 1fr; }
}

.review-image {
    position: sticky;
    top: 16px;
    align-self: start;
}
.review-image img {
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--surface-200);
}

.review-type-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    background: var(--accent-500);
    color: white;
    margin-bottom: 16px;
}

/* ── Patient Search ── */
.patient-search-section { margin-bottom: 20px; }
.patient-search-section > label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--navy-600);
    margin-bottom: 6px;
}
.patient-search-row { display: flex; gap: 8px; }
.patient-search-row input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--surface-200);
    border-radius: var(--radius);
    font-size: 13px;
}

.patient-results { margin-top: 8px; max-height: 200px; overflow-y: auto; }
.patient-result-item {
    padding: 8px 12px;
    border: 1px solid var(--surface-200);
    border-radius: var(--radius);
    margin-bottom: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
}
.patient-result-item:hover { background: var(--surface-50); }
.patient-meta { color: var(--navy-600); font-size: 12px; margin-left: 8px; }

.selected-patient-card {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: var(--success-100);
    border: 1px solid var(--success-500);
    border-radius: var(--radius);
    font-size: 13px;
}
.selected-patient-card strong { color: var(--navy-800); }
.selected-patient-card span { color: var(--navy-600); font-size: 12px; }

.no-results, .loading-text {
    padding: 12px;
    text-align: center;
    font-size: 13px;
    color: var(--navy-600);
}

/* ── Extracted Fields ── */
.extracted-fields { margin-bottom: 20px; }

.field-group {
    margin-bottom: 10px;
}
.field-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--navy-600);
    margin-bottom: 3px;
}
.field-group input, .field-group select, .field-group textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--surface-200);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: inherit;
    background: var(--surface-0);
    color: var(--navy-800);
}
.field-group textarea { resize: vertical; }

.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

/* ── Confidence Dots ── */
.conf-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 4px;
    vertical-align: middle;
}
.conf-high { background: var(--success-500); }
.conf-medium { background: var(--warning-500); }
.conf-none { background: var(--surface-300); }

/* ── Section Titles ── */
.section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--navy-800);
    margin: 20px 0 10px;
    padding-bottom: 4px;
    border-bottom: 2px solid var(--surface-200);
}

/* ── History Table ── */
.history-table {
    font-size: 12px;
    margin-bottom: 12px;
}
.ht-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    padding: 4px 8px;
    border-bottom: 1px solid var(--surface-100);
}
.ht-header { font-weight: 700; background: var(--surface-50); border-radius: var(--radius) var(--radius) 0 0; }

/* ── Consent Section Items ── */
.consent-section-item {
    padding: 8px 12px;
    background: var(--surface-50);
    border: 1px solid var(--surface-200);
    border-radius: var(--radius);
    margin-bottom: 6px;
    font-size: 13px;
}

/* ── OCR Text ── */
.ocr-text {
    background: var(--surface-50);
    border: 1px solid var(--surface-200);
    border-radius: var(--radius);
    padding: 12px;
    font-size: 12px;
    font-family: 'Consolas', 'Courier New', monospace;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ── Insurance Options ── */
.insurance-options {
    margin-bottom: 16px;
    padding: 16px;
    background: var(--surface-50);
    border: 1px solid var(--surface-200);
    border-radius: var(--radius);
}

.tier-warning {
    margin-top: 6px;
    padding: 8px 12px;
    background: var(--warning-100);
    border: 1px solid var(--warning-500);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--warning-500);
}

.subscriber-fields {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--surface-200);
}
.subscriber-fields h4 {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 12px;
}

/* ── Headshot Preview ── */
.headshot-preview {
    margin-top: 16px;
    padding: 12px;
    background: var(--surface-50);
    border: 1px solid var(--surface-200);
    border-radius: 8px;
}
.headshot-preview h4 {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.headshot-container {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.headshot-img-wrap {
    position: relative;
    width: 120px;
    min-height: 140px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid var(--surface-200);
    background: var(--surface-100);
}
.headshot-img-wrap img {
    width: 100%;
    height: auto;
    display: block;
}
.headshot-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--surface-50);
}
.headshot-fallback {
    padding: 10px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}
.headshot-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.headshot-controls .btn {
    font-size: 12px;
    padding: 4px 8px;
    white-space: nowrap;
}
.headshot-candidates {
    margin-top: 10px;
}
.headshot-candidates-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.headshot-candidates-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.headshot-candidate {
    width: 64px;
    height: 64px;
    padding: 0;
    border: 2px solid var(--surface-200);
    border-radius: 6px;
    overflow: hidden;
    background: var(--surface-0);
    cursor: pointer;
}
.headshot-candidate img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.headshot-candidate.selected {
    border-color: var(--navy-800);
    box-shadow: 0 0 0 2px rgba(30, 41, 59, 0.25);
}

/* ── Review Actions ── */
.review-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--surface-200);
}

/* ── Complete ── */
.complete-body { text-align: center; padding: 60px 24px; }
.complete-icon { margin-bottom: 16px; }
.complete-body h3 { font-size: 20px; color: var(--success-500); margin-bottom: 8px; }
.complete-detail { font-size: 13px; color: var(--navy-600); margin-bottom: 24px; }

/* ── Error ── */
.vision-error .panel-body {
    text-align: center;
    padding: 40px 24px;
}
.vision-error h3 { color: var(--error-500); margin-bottom: 8px; }
.vision-error p { color: var(--navy-600); margin-bottom: 20px; }

/* ── Front / Back Upload Zones ── */
.upload-zones-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 0;
}
@media (max-width: 600px) {
    .upload-zones-row { grid-template-columns: 1fr; }
}

.upload-slot { display: flex; flex-direction: column; }

.slot-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--navy-600);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.slot-required { color: var(--error-500); font-weight: 600; margin-left: 4px; text-transform: none; }
.slot-optional { color: var(--navy-600); font-weight: 400; margin-left: 4px; text-transform: none; opacity: 0.7; }

.upload-zone-half {
    padding: 24px 12px;
    flex: 1;
}
.upload-zone-half .upload-icon { margin-bottom: 8px; }
.upload-zone-half .upload-text { font-size: 13px; }
.upload-zone-half .upload-hint { font-size: 11px; margin-bottom: 10px; }

.image-preview-half {
    text-align: center;
    margin-top: 8px;
}
.image-preview-half img {
    max-width: 100%;
    max-height: 180px;
    border-radius: var(--radius);
    border: 1px solid var(--surface-200);
    object-fit: contain;
}

/* ── Process Button Row ── */
.process-row {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--surface-100);
}
.btn-process {
    padding: 12px 32px;
    font-size: 15px;
    gap: 8px;
}

/* ── Keep-on-file Prompt ── */
.keep-file-prompt {
    margin: 16px 0 24px;
    padding: 20px 24px;
    background: var(--surface-50);
    border: 1px solid var(--surface-200);
    border-radius: 8px;
    text-align: center;
}
.keep-file-icon {
    color: var(--accent-500);
    margin-bottom: 10px;
}
.keep-file-prompt h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--navy-800);
    margin-bottom: 6px;
}
.keep-file-prompt p {
    font-size: 13px;
    color: var(--navy-600);
    margin-bottom: 16px;
    line-height: 1.5;
}
.keep-file-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ── PDF Indicator ── */
.pdf-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 20px 12px;
    background: var(--surface-50);
    border: 1px solid var(--surface-200);
    border-radius: var(--radius);
    color: var(--error-500);
    min-height: 80px;
}
.pdf-indicator-lg {
    min-height: 140px;
    padding: 32px 16px;
}
.pdf-name {
    font-size: 11px;
    color: var(--navy-600);
    word-break: break-all;
    text-align: center;
    max-width: 160px;
}
.pdf-note {
    font-size: 11px;
    color: var(--navy-600);
    font-style: italic;
}
