/* Word Reconstruction POC - Styles */

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

:root {
  --primary-color: #4a90e2;
  --success-color: #50c878;
  --error-color: #e74c3c;
  --warning-color: #f39c12;
  --bg-color: #f5f7fa;
  --card-bg: #ffffff;
  --text-primary: #2c3e50;
  --text-secondary: #7f8c8d;
  --border-color: #d5dce3;
  --horizontal-color: #4a90e2;
  --vertical-90-color: #50c878;
  --vertical-270-color: #e74c3c;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 40px 20px;
  background: var(--card-bg);
  border-radius: 12px;
  margin-bottom: 30px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.header-content {
  flex: 1;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  color: var(--primary-color);
  text-align: left;
}

header p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  text-align: left;
}

.header-actions {
  display: flex;
  gap: 15px;
  align-items: center;
}

.review-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.review-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.review-link .icon {
  font-size: 1.25rem;
}

.review-link .badge {
  background: rgba(255, 255, 255, 0.3);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.875rem;
  min-width: 24px;
  text-align: center;
}

/* Upload Section */
.upload-section {
  margin-bottom: 20px;
}

.upload-area {
  background: var(--card-bg);
  border: 3px dashed var(--border-color);
  border-radius: 12px;
  padding: 60px 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.upload-area:hover {
  border-color: var(--primary-color);
  background: #f8fafc;
}

.upload-area.dragover {
  border-color: var(--primary-color);
  background: #e8f4ff;
}

.upload-content svg {
  color: var(--primary-color);
  margin-bottom: 20px;
}

.upload-content p {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.upload-content small {
  color: var(--text-secondary);
}

.file-info {
  background: var(--card-bg);
  padding: 15px 20px;
  border-radius: 8px;
  margin-top: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#fileName {
  font-weight: 600;
}

#fileSize {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Options Section */
.options-section {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.options-section label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 1rem;
}

.options-section input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  margin-right: 10px;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-export {
  padding: 15px 40px;
  font-size: 1.1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 auto;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  width: 100%;
  max-width: 300px;
}

.btn-primary:hover:not(:disabled) {
  background: #357abd;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--text-secondary);
  color: white;
  width: 100%;
  max-width: 300px;
  margin-top: 15px;
}

.btn-secondary:hover {
  background: #5a6c7d;
}

.btn-export {
  background: var(--success-color);
  color: white;
  padding: 10px 20px;
  font-size: 0.95rem;
}

.btn-export:hover {
  background: #3dab63;
}

/* Loader */
.loader {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Error Section */
.error-section {
  background: #ffebee;
  border: 1px solid var(--error-color);
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
}

.error-section h3 {
  color: var(--error-color);
  margin-bottom: 10px;
}

#errorContent {
  color: #c62828;
}

/* Status Section */
.status-section {
  background: var(--card-bg);
  padding: 30px;
  border-radius: 12px;
  margin: 20px 0;
  text-align: center;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  margin: 20px 0;
}

.progress-fill {
  height: 100%;
  background: var(--primary-color);
  width: 0%;
  transition: width 0.3s ease;
  animation: progress-animation 1.5s ease-in-out infinite;
}

@keyframes progress-animation {
  0% {
    width: 0%;
  }
  50% {
    width: 70%;
  }
  100% {
    width: 100%;
  }
}

/* Results Section */
.results-section {
  background: var(--card-bg);
  padding: 30px;
  border-radius: 12px;
  margin-top: 20px;
}

.results-section h2 {
  color: var(--success-color);
  margin-bottom: 25px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 25px;
  border-radius: 12px;
  color: white;
  text-align: center;
}

.stat-card:nth-child(2) {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-card:nth-child(3) {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-card:nth-child(4) {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.stat-label {
  font-size: 0.9rem;
  opacity: 0.9;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
}

/* Orientation Breakdown */
.orientation-breakdown {
  background: #f8fafc;
  padding: 25px;
  border-radius: 12px;
  margin-bottom: 30px;
}

.orientation-breakdown h3 {
  margin-bottom: 20px;
}

.orientation-bars {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.orientation-bar {
  display: flex;
  align-items: center;
  gap: 15px;
}

.bar-label {
  min-width: 180px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.orientation-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
}

.orientation-dot.horizontal {
  background: var(--horizontal-color);
}

.orientation-dot.vertical-90 {
  background: var(--vertical-90-color);
}

.orientation-dot.vertical-270 {
  background: var(--vertical-270-color);
}

.bar-container {
  flex: 1;
  height: 30px;
  background: white;
  border-radius: 15px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.bar-fill {
  height: 100%;
  border-radius: 15px;
  transition: width 0.6s ease-out;
}

.bar-fill.horizontal {
  background: var(--horizontal-color);
}

.bar-fill.vertical-90 {
  background: var(--vertical-90-color);
}

.bar-fill.vertical-270 {
  background: var(--vertical-270-color);
}

.bar-value {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 600;
  font-size: 0.9rem;
}

/* Visualizations Carousel */
.visualizations-section {
  margin-bottom: 30px;
}

.visualizations-section h3 {
  margin-bottom: 20px;
}

.carousel {
  position: relative;
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
}

.carousel-container {
  flex: 1;
  overflow: hidden;
  border-radius: 12px;
  background: #f8fafc;
}

.carousel-track {
  display: flex;
  transition: transform 0.4s ease;
}

.carousel-item {
  min-width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  gap: 12px;
}

.carousel-item .viz-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-color);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  padding: 8px 16px;
  border-radius: 20px;
  border: 2px solid #667eea;
  text-align: center;
}

.carousel-item img {
  max-width: 100%;
  max-height: 600px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.carousel-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: var(--primary-color);
  color: white;
  font-size: 1.8rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.carousel-btn:hover {
  background: #357abd;
  transform: scale(1.1);
}

.carousel-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.carousel-indicators {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.carousel-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border-color);
  cursor: pointer;
  transition: all 0.3s ease;
}

.carousel-indicator.active {
  background: var(--primary-color);
  width: 30px;
  border-radius: 6px;
}

/* Words Section */
.words-section {
  margin-top: 30px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}

.table-controls {
  display: flex;
  gap: 10px;
}

.filter-select {
  padding: 10px 15px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
}

.table-container {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

thead {
  background: #f8fafc;
  position: sticky;
  top: 0;
}

th {
  padding: 15px;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 2px solid var(--border-color);
}

td {
  padding: 12px 15px;
  border-bottom: 1px solid var(--border-color);
}

tbody tr:hover {
  background: #f8fafc;
}

.word-text {
  font-family: monospace;
  background: #f0f2f5;
  padding: 4px 8px;
  border-radius: 4px;
}

.orientation-badge {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
  display: inline-block;
}

.orientation-badge.horizontal {
  background: var(--horizontal-color);
}

.orientation-badge.vertical-90 {
  background: var(--vertical-90-color);
}

.orientation-badge.vertical-270 {
  background: var(--vertical-270-color);
}

.confidence-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
}

.confidence-high {
  background: #d4edda;
  color: #155724;
}

.confidence-medium {
  background: #fff3cd;
  color: #856404;
}

.confidence-low {
  background: #f8d7da;
  color: #721c24;
}

.table-footer {
  padding: 15px;
  background: #f8fafc;
  border-top: 1px solid var(--border-color);
  border-radius: 0 0 8px 8px;
  color: var(--text-secondary);
}

/* Footer */
footer {
  text-align: center;
  padding: 30px 20px;
  margin-top: 40px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Zoom Modal */
.zoom-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zoom-modal.hidden {
  display: none;
}

.zoom-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  cursor: pointer;
}

.zoom-container {
  position: relative;
  width: 90vw;
  height: 90vh;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.zoom-close {
  position: absolute;
  top: -50px;
  right: 10px;
  background: white;
  border: none;
  font-size: 2.5rem;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  cursor: pointer;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  line-height: 1;
  padding: 0;
  z-index: 10001;
}

.zoom-close:hover {
  background: var(--error-color);
  color: white;
  transform: rotate(90deg) scale(1.1);
}

.zoom-controls {
  position: absolute;
  top: -50px;
  left: 10px;
  display: flex;
  gap: 10px;
  z-index: 10001;
}

.zoom-btn {
  background: white;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.3s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.zoom-btn:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

.zoom-btn:active {
  transform: translateY(0);
}

.zoom-image-wrapper {
  flex: 1;
  width: 100%;
  overflow: hidden;
  background: #1a1a1a;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: default;
}

.zoom-image-wrapper img {
  display: block;
  max-width: none;
  height: auto;
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.zoom-info {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 10001;
  pointer-events: none;
}

/* Text Groups Section */
.text-groups-section {
  margin: 2rem 0;
}

.shape-groups-container,
.outside-shapes-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1rem 0;
}

.shape-group-card,
.outside-shapes-card {
  background: white;
  border: 2px solid #E8ECEF;
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.3s ease;
}

.shape-group-card:hover {
  border-color: #4ECDC4;
  box-shadow: 0 4px 12px rgba(78, 205, 196, 0.15);
}

.shape-group-header,
.outside-shapes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #E8ECEF;
}

.shape-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.shape-icon {
  font-size: 1.5rem;
}

.shape-icon.circle { color: #FF6B6B; }
.shape-icon.rectangle { color: #4ECDC4; }
.shape-icon.polygon { color: #95E1D3; }
.shape-icon.arc { color: #FFE66D; }
.shape-icon.line { color: #38B6FF; }
.shape-icon.polyline { color: #B4A7D6; }
.shape-icon.unknown { color: #95A5A6; }

.shape-type {
  font-weight: 600;
  color: #2C3E50;
  text-transform: capitalize;
}

.shape-id {
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  color: #7F8C8D;
  background: #F8F9FA;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.word-count-badge {
  background: #3498DB;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
}

.page-badge {
  background: #95A5A6;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
}

.shape-group-content,
.outside-shapes-content {
  margin-top: 1rem;
}

.combined-text {
  background: #F8F9FA;
  padding: 1rem;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  line-height: 1.6;
  color: #2C3E50;
  margin-bottom: 1rem;
}

.words-details {
  margin-top: 1rem;
}

.words-details summary {
  cursor: pointer;
  color: #3498DB;
  font-weight: 600;
  padding: 0.5rem;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.words-details summary:hover {
  background: #EBF5FB;
}

.word-list {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.word-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  background: white;
  border: 1px solid #E8ECEF;
  border-radius: 6px;
}

.word-index {
  color: #7F8C8D;
  font-size: 0.85rem;
  min-width: 2rem;
}

.word-item .word-text {
  flex: 1;
  font-weight: 500;
  color: #2C3E50;
}

.word-confidence {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
}

.word-confidence.confidence-high {
  background: #D5F4E6;
  color: #27AE60;
}

.word-confidence.confidence-medium {
  background: #FCF3CF;
  color: #F39C12;
}

.word-confidence.confidence-low {
  background: #FADBD8;
  color: #E74C3C;
}

.empty-message {
  text-align: center;
  color: #95A5A6;
  padding: 2rem;
  font-style: italic;
}

/* ===========================
   ACTOE Component Styles
   =========================== */

/* Validation Warnings */
.warnings-section {
  background: #FEF5E7;
  border: 2px solid #F39C12;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.warnings-section h3 {
  color: #D68910;
  margin-bottom: 1rem;
}

.warnings-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.warning-card {
  background: white;
  border-left: 4px solid #F39C12;
  padding: 1rem;
  border-radius: 6px;
}

.warning-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.warning-type {
  font-weight: 600;
  color: #D68910;
  text-transform: uppercase;
  font-size: 0.85rem;
}

.component-ref {
  background: #F8F9FA;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.85rem;
}

.warning-message {
  color: #7F8C8D;
  line-height: 1.5;
}

/* BOM Section */
.bom-section {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

#bomTable {
  width: 100%;
}

#bomTable thead th {
  background: #F8F9FA;
  font-weight: 600;
  text-align: left;
  padding: 1rem;
  color: #2C3E50;
}

#bomTable tbody td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #E8ECEF;
}

#bomTable tbody tr:hover {
  background: #F8FCFF;
}

.type-badge {
  background: #E8F4FD;
  color: #3498DB;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
}

.quantity-badge {
  background: #50c878;
  color: white;
  padding: 0.2rem 0.5rem;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-left: 0.5rem;
}

#bomTable code {
  background: #F8F9FA;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #7F8C8D;
}

/* Region Statistics Section */
.region-stats-section {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.stat-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.stat-label {
  font-size: 12px;
  opacity: 0.9;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 28px;
  font-weight: bold;
}

/* Components Section */
.components-section {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.components-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.component-card {
  background: white;
  border: 2px solid #E8ECEF;
  border-radius: 10px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.component-card:hover {
  border-color: #3498DB;
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.15);
  transform: translateY(-2px);
}

.component-header {
  background: #F8F9FA;
  padding: 1rem;
  border-bottom: 2px solid #E8ECEF;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.component-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.component-icon {
  font-size: 1.5rem;
}

.component-ref {
  font-weight: 700;
  font-size: 1.1rem;
  color: #2C3E50;
}

.component-type-badge {
  background: #3498DB;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: capitalize;
}

.component-body {
  padding: 1rem;
}

.component-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.info-label {
  color: #7F8C8D;
  font-weight: 500;
}

.info-value {
  color: #2C3E50;
  font-weight: 600;
}

.info-value code {
  background: #F8F9FA;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

.component-words {
  background: #F8F9FA;
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #2C3E50;
}

.component-words strong {
  display: block;
  margin-bottom: 0.25rem;
  color: #7F8C8D;
  font-size: 0.85rem;
}

/* Ambiguous Assignments Section */
.ambiguous-section {
  background: #FFF9E6;
  border: 2px solid #F9E79F;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.ambiguous-section h3 {
  color: #D68910;
  margin-bottom: 1rem;
}

.ambiguous-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.ambiguous-card {
  background: white;
  border-left: 4px solid #F39C12;
  border-radius: 8px;
  padding: 1rem;
  transition: all 0.2s ease;
}

.ambiguous-card:hover {
  box-shadow: 0 4px 12px rgba(243, 156, 18, 0.2);
}

.ambiguous-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.word-badge {
  background: #F8F9FA;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-weight: 600;
  color: #2C3E50;
  font-family: monospace;
}

.probability-badge {
  background: #FCF3CF;
  color: #D68910;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 700;
}

.ambiguous-body {
  font-size: 0.9rem;
  color: #7F8C8D;
}

.ambiguous-info,
.ambiguous-competing {
  margin-bottom: 0.5rem;
}

.ambiguous-info strong,
.ambiguous-competing strong {
  color: #2C3E50;
}

.ambiguous-reason {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #F9E79F;
  font-style: italic;
  font-size: 0.85rem;
}

/* Orphaned Words Section */
.orphans-section {
  background: #EBFAF6;
  border: 2px solid #A8E6CF;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.orphans-section h3 {
  color: #27AE60;
  margin-bottom: 1rem;
}

.orphans-card {
  background: white;
  border-radius: 8px;
  overflow: hidden;
}

.orphans-header {
  background: #F8FCFF;
  padding: 1rem;
  font-weight: 600;
  color: #2C3E50;
  border-bottom: 2px solid #E8ECEF;
}

.orphans-list {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 400px;
  overflow-y: auto;
}

.orphan-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  background: #F8F9FA;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.orphan-item:hover {
  background: #E8F4FD;
}

.orphan-index {
  color: #7F8C8D;
  font-size: 0.85rem;
  min-width: 2rem;
}

.orphan-text {
  flex: 1;
  font-weight: 500;
  color: #2C3E50;
  font-family: monospace;
}

.orphan-confidence {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Component Details Section */
.component-details-section {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.component-details-section details {
  margin-top: 1rem;
}

.component-details-section summary {
  cursor: pointer;
  color: #3498DB;
  font-weight: 600;
  padding: 0.75rem;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.component-details-section summary:hover {
  background: #EBF5FB;
}

.component-details-content {
  margin-top: 1rem;
  background: #F8F9FA;
  border-radius: 6px;
  max-height: 600px;
  overflow: auto;
}

.component-details-content pre {
  margin: 0;
  padding: 1.5rem;
}

.component-details-content code {
  font-family: 'Courier New', Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  color: #2C3E50;
}

/* Responsive */
@media (max-width: 768px) {
  header h1 {
    font-size: 1.8rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .components-container {
    grid-template-columns: 1fr;
  }

  .ambiguous-container {
    grid-template-columns: 1fr;
  }

  #bomTable {
    font-size: 0.85rem;
  }

  #bomTable thead th,
  #bomTable tbody td {
    padding: 0.5rem;
  }

  .component-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

/* Debug Images Section */
.debug-images-section {
  margin: 2rem 0;
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 12px;
}

.section-subtitle {
  display: block;
  font-size: 0.875rem;
  color: #6c757d;
  margin-top: 0.25rem;
  font-weight: normal;
}

.debug-images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.debug-image-card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.debug-image-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.debug-image-header {
  display: flex;
  align-items: center;
  padding: 1rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.debug-step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: bold;
  margin-right: 1rem;
  flex-shrink: 0;
}

.debug-step-info h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.debug-step-info p {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  opacity: 0.9;
}

.debug-image-wrapper {
  position: relative;
  padding: 1rem;
  background: #fff;
  cursor: zoom-in;
}

.debug-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
  border: 1px solid #e9ecef;
}

/* Debug JSON Section */
.debug-json-section {
  margin: 2rem 0;
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 12px;
}

.debug-json-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.debug-json-card {
  display: flex;
  align-items: center;
  padding: 1rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: all 0.2s;
  gap: 1rem;
}

.debug-json-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.debug-json-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.debug-json-info {
  flex: 1;
  min-width: 0;
}

.debug-json-info h4 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #212529;
}

.debug-json-info p {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: #6c757d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.debug-json-download,
.debug-json-view {
  padding: 0.5rem;
  color: #667eea;
  transition: all 0.2s;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.debug-json-download:hover,
.debug-json-view:hover {
  background: #f0f2ff;
  color: #4c51bf;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .debug-images-grid {
    grid-template-columns: 1fr;
  }

  .debug-json-grid {
    grid-template-columns: 1fr;
  }
}

/* Component words display - line-wise and combined */
.component-words {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.words-section,
.combined-text-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.words-list {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 10px;
  max-height: 200px;
  overflow-y: auto;
}

.word-line {
  padding: 4px 8px;
  margin: 2px 0;
  background: white;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  border-left: 3px solid #667eea;
}

.word-line.empty {
  color: #999;
  font-style: italic;
  border-left-color: #ccc;
}

.combined-text-section {
  background: #e8f5e9;
  border: 1px solid #4caf50;
  border-radius: 6px;
  padding: 12px;
}

.combined-text {
  padding: 8px;
  background: white;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  font-weight: 500;
  color: #2e7d32;
  word-wrap: break-word;
}
