/* ═══════════════════════════════════════════════════════════════
   DEC PAGE READER — Upload & AI extraction styling
   ═══════════════════════════════════════════════════════════════ */

/* ─── Header ─── */
.dpr-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}

.dpr-header h2 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  margin: 0;
}

.dpr-header-actions {
  display: flex;
  gap: var(--space-2);
}

/* ─── Main Layout ─── */
.dpr-main {
  padding: var(--space-6);
}

/* ─── Upload Zone ─── */
.dpr-upload-section {
  margin-bottom: var(--space-6);
}

.dpr-upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-8);
  background: var(--bg-surface);
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-default);
}

.dpr-upload-zone:hover {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.dpr-upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-muted);
  transform: scale(1.01);
  box-shadow: 0 0 24px var(--accent-muted);
}

.dpr-upload-icon {
  font-size: 48px;
  margin-bottom: var(--space-4);
  opacity: 0.7;
}

.dpr-upload-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.dpr-upload-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ─── Progress ─── */
.dpr-upload-progress {
  padding: var(--space-6);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.dpr-progress-bar {
  height: 8px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-3);
}

.dpr-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width var(--duration-normal) var(--ease-out);
}

.dpr-progress-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-align: center;
}

/* ─── Viewer ─── */
.dpr-viewer {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: var(--space-6);
}

.dpr-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
}

.dpr-viewer-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
}

.dpr-viewer-icon {
  font-size: var(--text-xl);
}

.dpr-viewer-actions {
  display: flex;
  gap: var(--space-2);
}

/* ─── Split View ─── */
.dpr-split-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 500px;
}

@media (max-width: 1024px) {
  .dpr-split-view {
    grid-template-columns: 1fr;
  }
}

/* ─── Preview Pane ─── */
.dpr-preview-pane {
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
}

@media (max-width: 1024px) {
  .dpr-preview-pane {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    max-height: 400px;
  }
}

.dpr-preview-header {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.dpr-preview-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  overflow: auto;
}

.dpr-preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.dpr-preview-placeholder-icon {
  font-size: 48px;
  opacity: 0.3;
}

.dpr-pdf-iframe {
  width: 100%;
  height: 100%;
  min-height: 500px;
  border: none;
}

.dpr-img-preview {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* ─── Data Pane ─── */
.dpr-data-pane {
  display: flex;
  flex-direction: column;
}

.dpr-data-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.dpr-confidence {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  text-transform: none;
}

.dpr-confidence-label {
  color: var(--text-muted);
}

.dpr-confidence-value {
  font-weight: var(--weight-bold);
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
}

.dpr-confidence-value.high {
  background: var(--success-muted);
  color: var(--success);
}

.dpr-confidence-value.medium {
  background: var(--warning-muted);
  color: var(--warning);
}

.dpr-confidence-value.low {
  background: var(--error-muted);
  color: var(--error);
}

.dpr-data-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
}

/* ─── Loading & Error States ─── */
.dpr-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-8);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.dpr-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-default);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: dpr-spin 0.8s linear infinite;
}

@keyframes dpr-spin {
  to { transform: rotate(360deg); }
}

.dpr-empty {
  text-align: center;
  padding: var(--space-8);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.dpr-error {
  padding: var(--space-4);
  background: var(--error-muted);
  color: var(--error);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}

/* ─── Extracted Fields ─── */
.dpr-fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.dpr-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.dpr-section-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.dpr-section-icon {
  font-size: var(--text-base);
}

.dpr-section-fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  padding: var(--space-4);
}

@media (max-width: 768px) {
  .dpr-section-fields {
    grid-template-columns: 1fr;
  }
}

.dpr-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.dpr-field:has(textarea) {
  grid-column: 1 / -1;
}

.dpr-field label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
}

.dpr-field-icon {
  font-size: var(--text-sm);
}

.dpr-field input,
.dpr-field textarea {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.dpr-field input:focus,
.dpr-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
  outline: none;
}

/* ─── Vehicles ─── */
.dpr-vehicles-list {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.dpr-vehicle-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.dpr-vehicle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-overlay);
  border-bottom: 1px solid var(--border-subtle);
}

.dpr-vehicle-num {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
}

.dpr-vehicle-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: var(--text-lg);
  cursor: pointer;
  padding: 0 var(--space-2);
  line-height: 1;
  transition: color var(--duration-fast);
}

.dpr-vehicle-remove:hover {
  color: var(--error);
}

.dpr-vehicle-fields {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  padding: var(--space-3);
}

@media (max-width: 768px) {
  .dpr-vehicle-fields {
    grid-template-columns: repeat(2, 1fr);
  }
}

.dpr-add-vehicle {
  margin: 0 var(--space-4) var(--space-4);
}

/* ─── Coverages Table ─── */
.dpr-coverages-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.dpr-coverages-table th {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.dpr-coverages-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}

.dpr-coverages-table tr:last-child td {
  border-bottom: none;
}

.dpr-cov-input {
  width: 100%;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
}

.dpr-cov-input:focus {
  border-color: var(--accent);
  outline: none;
}

/* ─── Viewer Footer ─── */
.dpr-viewer-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
}

/* ─── Recent Extractions ─── */
.dpr-recent {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.dpr-recent-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
}

.dpr-recent-header h3 {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  margin: 0;
}

.dpr-recent-list {
  max-height: 400px;
  overflow-y: auto;
}

.dpr-recent-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--duration-fast);
}

.dpr-recent-card:hover {
  background: var(--bg-hover);
}

.dpr-recent-card:last-child {
  border-bottom: none;
}

.dpr-recent-icon {
  font-size: var(--text-xl);
  opacity: 0.7;
}

.dpr-recent-info {
  flex: 1;
  min-width: 0;
}

.dpr-recent-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dpr-recent-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.dpr-recent-carrier {
  color: var(--text-secondary);
}

.dpr-recent-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
}

.dpr-recent-premium {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--success);
}
