/**
 * Document Trainer Styles
 * Version: 3.0.0
 *
 * (c) Copyright 2025-2026 Ofni, LLC and David McElroy. All rights reserved.
 *
 * Change History:
 * - v3.0.0 (2026-03-14 14:02 CDT): Phase 2 — Full-page modal, OCR bounding boxes, selection, sidebar, verification
 * - v2.0.0 (2026-03-14 13:47 CDT): Correction UI, input, buttons, method preview
 * - v1.0.0 (2026-03-14 13:32 CDT): Training panel, badge stack, confidence colors
 */

/* Training Panel — right badge strip */
.trainer-panel {
    position: fixed;
    right: 0;
    top: 73px;
    bottom: 0;
    width: 52px;
    background: #f8fafc;
    border-left: 1px solid #e2e8f0;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    gap: 6px;
    overflow-y: auto;
}

.trainer-panel.open { transform: translateX(0); }

/* Badge stack */
.trainer-badge {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    border: 2px solid transparent;
}

.trainer-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.trainer-badge-icon { font-size: 14px; line-height: 1; }

.trainer-badge-label {
    font-size: 6px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1;
    margin-top: 2px;
    text-align: center;
    max-width: 36px;
    overflow: hidden;
    white-space: nowrap;
}

.trainer-badge.high { background: #d1fae5; border-color: #34d399; color: #065f46; }
.trainer-badge.medium { background: #fef3c7; border-color: #fbbf24; color: #92400e; }
.trainer-badge.missing { background: #fee2e2; border-color: #f87171; color: #991b1b; }

/* Training Modal */
.trainer-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20000;
}

.trainer-modal-content {
    background: #fff;
    width: 95%;
    max-width: 1200px;
    height: 90vh;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 70px -12px rgba(0, 0, 0, 0.6);
}

.trainer-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.trainer-modal-title {
    font-size: 15px;
    font-weight: 900;
    color: #1e293b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.trainer-modal-current {
    display: block;
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}

.trainer-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #94a3b8;
    line-height: 1;
}

.trainer-modal-close:hover { color: #ef4444; }

.trainer-modal-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Page container with OCR overlay */
.trainer-modal-page {
    flex: 1;
    overflow: auto;
    background: #1e293b;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
}

.trainer-page-wrap {
    position: relative;
    display: inline-block;
    max-width: 100%;
    max-height: 100%;
}

.trainer-modal-img {
    display: block;
    max-width: 100%;
    max-height: calc(90vh - 80px);
    object-fit: contain;
    user-select: none;
}

.trainer-box-layer,
.trainer-select-layer {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10;
    pointer-events: none;
}

.trainer-box-layer { pointer-events: none; }
.trainer-box { pointer-events: auto; }

.trainer-select-layer {
    z-index: 11;
    cursor: crosshair;
    pointer-events: auto;
}

/* Individual OCR bounding box */
.trainer-box {
    position: absolute;
    border: 1px solid rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.05);
    cursor: pointer;
    transition: all 0.1s;
    z-index: 12;
}

.trainer-box:hover {
    border-color: rgba(59, 130, 246, 0.7);
    background: rgba(59, 130, 246, 0.15);
}

.trainer-box.selected {
    border-color: #2563eb;
    background: rgba(37, 99, 235, 0.25);
    box-shadow: 0 0 0 1px #2563eb;
}

/* Rectangle selection rubber band */
.trainer-rect-select {
    position: absolute;
    border: 2px dashed #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    pointer-events: none;
    z-index: 20;
}

/* Sidebar */
.trainer-modal-sidebar {
    width: 300px;
    flex-shrink: 0;
    background: #f8fafc;
    border-left: 1px solid #e2e8f0;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.trainer-sidebar-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
}

.trainer-sidebar-label {
    font-size: 10px;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.trainer-selected-text {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    word-break: break-word;
}

.trainer-method-empty {
    font-size: 11px;
    color: #94a3b8;
    font-style: italic;
}

.trainer-method-type {
    font-size: 11px;
    font-weight: 900;
    color: #2563eb;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.trainer-preview-json {
    font-size: 10px;
    font-family: ui-monospace, SFMono-Regular, monospace;
    background: #1e293b;
    color: #e2e8f0;
    padding: 8px;
    border-radius: 6px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.5;
    margin: 0;
}

/* Verification */
.trainer-verify {
    font-size: 12px;
    font-weight: 600;
    padding: 8px;
    border-radius: 6px;
}

.trainer-verify-ok { background: #f0fdf4; color: #065f46; }
.trainer-verify-warn { background: #fffbeb; color: #92400e; }
.trainer-verify-fail { background: #fef2f2; color: #991b1b; }

/* Save button */
.trainer-btn-save {
    padding: 12px;
    font-size: 13px;
    font-weight: 800;
    background: #059669;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    margin-top: auto;
}

.trainer-btn-save:hover { background: #047857; }
.trainer-btn-save:disabled { background: #cbd5e1; cursor: not-allowed; }
