/* ═══════════════════════════════════════════
   OCR/VISION STYLES - UI-KIT COMPLIANT
   Based on глубина-mcp-hub-design.html
═══════════════════════════════════════════ */

/* OCR Screen Layout */
#screen-ocr {
  flex-direction: column;
  height: 100%;
}

#screen-ocr.active {
  display: flex;
}

/* OCR Header Section */
.ocr-header {
  padding: 12px 20px 6px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-faint);
}

.ocr-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-primary);
}

/* OCR Upload Section */
.ocr-upload-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-faint);
  background: var(--bg-void);
}

.ocr-upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.ocr-upload-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* File Input Styling */
.ocr-file-browse-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.ocr-file-input-wrapper {
  position: relative;
  flex: 1;
}

.ocr-file-input-display {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  width: 100%;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ocr-file-input-display:hover {
  border-color: var(--border-mid);
}

.ocr-file-input-display.has-file {
  color: var(--text-secondary);
  border-color: var(--border-active);
}

#ocr-file-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.ocr-file-icon {
  color: var(--accent-primary);
  font-size: 14px;
}

/* OCR History Section */
.ocr-history-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ocr-history-header {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-faint);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ocr-history-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.ocr-history-stats {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-disabled);
}

.ocr-history-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* OCR History Item Card */
.ocr-history-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-faint);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  transition: var(--transition);
  position: relative;
}

.ocr-history-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-subtle);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  transition: var(--transition);
}

.ocr-history-item:hover {
  border-color: var(--border-subtle);
}

.ocr-history-item:hover::before {
  background: var(--accent-primary);
  box-shadow: var(--glow-sm);
}

/* OCR Item Header */
.ocr-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 12px;
}

.ocr-item-title {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ocr-item-date {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-disabled);
  flex-shrink: 0;
}

/* OCR Item Meta */
.ocr-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.ocr-item-words {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

/* OCR Item Preview */
.ocr-item-preview {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 10px;
  padding: 8px 10px;
  background: var(--bg-panel);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--border-subtle);
  max-height: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* OCR Item Actions */
.ocr-item-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 10px;
}

/* OCR Modal Styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 25, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.modal-content {
  background: var(--bg-panel);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 
    0 0 0 1px rgba(0,120,200,0.1),
    0 24px 64px rgba(0,0,0,0.6);
  position: relative;
  z-index: 10001;
}

.modal-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
}

.modal-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-faint);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
  letter-spacing: 0.05em;
  font-weight: normal;
}

.modal-close {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  border: none;
  background: transparent;
  transition: var(--transition);
  border-radius: var(--radius-sm);
}

.modal-close:hover {
  color: var(--accent-red);
  background: rgba(255, 51, 85, 0.1);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-faint);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* OCR Result Meta in Modal */
.ocr-result-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-faint);
  border-radius: var(--radius-md);
}

.ocr-result-meta > div {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.ocr-result-meta strong {
  color: var(--text-secondary);
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: 6px;
}

/* OCR Result Text */
.ocr-result-text {
  background: var(--bg-void);
  border: 1px solid var(--border-faint);
  border-radius: var(--radius-md);
  padding: 12px;
  max-height: 400px;
  overflow-y: auto;
}

.ocr-result-text pre {
  margin: 0;
  color: var(--text-primary);
  line-height: 1.6;
}

/* Progress Indicator */
.ocr-progress-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-surface);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
}

.ocr-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-bright));
  transition: width 0.3s ease;
  box-shadow: var(--glow-sm);
}

.ocr-progress-text {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: center;
}

/* Empty State */
.ocr-history-list .empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-disabled);
  font-family: var(--font-mono);
  font-size: 11px;
  font-style: italic;
}
