/**
 * Logbook Scanner Styles - Apple-Inspired Design
 * Clean, minimal aesthetic with focus on content and usability
 */

/* CSS Variables for consistent theming */
:root {
  --spacing-xs: 8px;
  --spacing-sm: 12px;
  --spacing-md: 20px;
  --spacing-lg: 32px;
  --spacing-xl: 48px;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
  
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  
  --color-primary: var(--color-copper);
  --color-success: #34C759;
  --color-warning: #FF9500;
  --color-danger: #FF3B30;
  --color-info: var(--color-copper-soft);
  
  --text-primary: #1d1d1f;
  --text-secondary: #86868b;
  --text-tertiary: #d2d2d7;
  
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f7;
  --bg-tertiary: #fbfbfd;
  
  --border-color: #e5e5e7;
  --border-light: #f0f0f2;
}

/* Main container */
.logbook-scan-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--spacing-lg) var(--spacing-md);
}

/* Upload section */
.upload-section {
  background-color: #f8f9fa;
  border-radius: 8px;
  padding: 30px;
  margin-bottom: 30px;
  border: 2px dashed #dee2e6;
  transition: all 0.3s;
}

.upload-section.drag-over {
  border-color: var(--color-ink);
  background-color: #e9f5ff;
}

.aircraft-selector {
  margin-bottom: 20px;
}

/* Drop zone */
.drop-zone {
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 30px 20px;
}

.drop-zone:hover {
  background-color: #e9ecef;
}

.upload-icon {
  font-size: 3rem;
  color: #6c757d;
  margin-bottom: 15px;
}

.upload-instructions {
  text-align: center;
  margin-bottom: 20px;
}

.file-input {
  display: none;
}

.upload-btn {
  margin-top: 15px;
}

/* File preview */
.preview-container {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: 20px;
}

.file-preview {
  width: 150px;
  height: 200px;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  background-color: #f8f9fa;
}

.file-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.file-preview .file-name {
  position: absolute;
  bottom: 0;
  width: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 5px;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.file-preview .remove-file {
  position: absolute;
  top: 5px;
  right: 5px;
  background-color: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #dc3545;
}

/* Upload progress */
.progress-section {
  margin-top: 20px;
  display: none;
}

/* Extraction results */
.extraction-results {
  margin-top: 30px;
}

.extraction-card {
  border: 1px solid #dee2e6;
  border-radius: 8px;
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Modal customization for logbook display */
/* Override Bootstrap's modal-xl with our own class */
.logbook-extraction-modal .modal-dialog {
  max-width: 98% !important;
  width: 1900px !important;
  margin: 10px auto !important;
}

.logbook-extraction-modal .modal-content {
  height: calc(100vh - 60px) !important;
  max-height: calc(100vh - 60px) !important;
}

.logbook-extraction-modal .modal-body {
  padding: 0 !important;
  overflow: hidden !important;
  height: calc(100vh - 160px) !important;
}

/* For rotated landscape documents */
.logbook-extraction-modal .logbook-image[style*="rotate(90deg)"], 
.logbook-extraction-modal .logbook-image[style*="rotate(270deg)"] {
  max-height: none !important; /* Override max-height constraint for rotated images */
  width: auto !important;      /* Allow width to adjust based on rotation */
  height: 650px !important;    /* Set a fixed height when rotated to landscape */
}

/* Ensure the extraction content has proper layout */
.logbook-extraction-modal .extraction-content {
  display: flex !important;
  padding: 0 !important;
  height: 100% !important;
}

.extraction-header {
  background-color: #f8f9fa;
  padding: 15px;
  font-weight: bold;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.extraction-content {
  display: flex;
  padding: 0;
}

.extraction-image {
  width: 60% !important;
  border-right: 1px solid #dee2e6;
  padding: 5px !important; /* Minimized padding */
  position: relative;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  flex: 3;
}

/* More specific selectors for the modal */
.logbook-extraction-modal .extraction-image {
  width: 60% !important;
  flex: 3 !important;
  padding: 5px !important;
  margin: 0 !important;
  border-right: 1px solid #dee2e6 !important;
}

.image-controls {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
  gap: 5px;
  align-items: center;
}

.image-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 700px;
  max-height: 800px;
  width: 100%;
  box-sizing: border-box; /* Make sure padding is included in width calculation */
  padding: 0; /* Remove any padding that might reduce width */
}

/* More specific selectors for the modal */
.logbook-extraction-modal .image-container {
  min-height: 700px !important;
  height: calc(100vh - 220px) !important; /* Adjust for the modal header, footer and controls */
  max-height: 900px !important;
  width: 100% !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.logbook-image {
  max-width: 100%;
  width: auto; /* Let width adjust naturally */
  height: auto;
  object-fit: contain; /* Use contain to ensure entire image is visible */
  transition: transform 0.2s ease;
  transform-origin: center center; /* Center origin for balanced zoom */
}

.image-container,
.page-image-scroll {
  touch-action: none;
  cursor: grab;
}

.image-container.is-interacting,
.page-image-scroll.is-interacting {
  cursor: grabbing;
}

.image-container.is-interacting .logbook-image,
.page-image-scroll.is-interacting .page-image {
  transition: none !important;
}

/* More specific selectors for the modal */
.logbook-extraction-modal .logbook-image {
  max-width: 100% !important;
  width: 100% !important;
  object-fit: scale-down !important;
}

/* Scrollable image container */
.image-container {
  scrollbar-width: thin;
  scrollbar-color: #6c757d #f8f9fa;
  padding: 20px; /* Add padding to ensure we can scroll to see all edges when zoomed */
  box-sizing: border-box;
}

.image-container::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.image-container::-webkit-scrollbar-track {
  background: #f8f9fa;
  border-radius: 5px;
}

.image-container::-webkit-scrollbar-thumb {
  background: #6c757d;
  border-radius: 5px;
}

.image-container::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.extraction-image.image-error {
  background-color: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.image-error-message {
  color: #6c757d;
  margin-top: 1rem;
  text-align: center;
  font-style: italic;
}

.extraction-data {
  width: 40% !important;
  padding: 15px;
  flex: 2;
}

/* More specific selectors for the modal */
.logbook-extraction-modal .extraction-data {
  width: 40% !important;
  flex: 2 !important;
  padding: 15px !important;
  margin: 0 !important;
  overflow-y: auto !important;
  max-height: 100% !important;
  height: 100% !important;
  background: #fbfbfd;
}

.logbook-extraction-modal .extraction-source-bar {
  position: sticky;
  top: 0;
  z-index: 6;
  background: #fbfbfd;
  padding: 10px 0;
  margin-bottom: 12px;
  border-bottom: 1px solid #e5e5e7;
}

.extraction-field {
  margin-bottom: 15px;
}

.extraction-field label {
  display: block;
  font-weight: bold;
  margin-bottom: 5px;
}

/* Styles for editable fields */
.editable-field {
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  margin-bottom: 8px;
}

.editable-field:focus {
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(184, 85, 30, 0.25);
}

/* Checkbox form field styling */
.form-check {
  padding: 8px;
  border-radius: 4px;
  transition: background-color 0.15s ease-in-out;
}

.form-check:hover {
  background-color: rgba(184, 85, 30, 0.05);
}

.form-check-input:focus {
  border-color: #80bdff;
  box-shadow: 0 0 0 0.25rem rgba(184, 85, 30, 0.25);
}

/* Separator for sections */
.row.mb-2 {
  border-top: 1px solid #e9ecef;
  padding-top: 0.75rem;
  margin-top: 0.5rem;
}

.row.mb-2:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

/* Confidence indicators */
.confidence-indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-left: 5px;
}

.confidence-high {
  background-color: #28a745;
}

.confidence-medium {
  background-color: #ffc107;
}

.confidence-low {
  background-color: #dc3545;
}

/* Finding badges */
.finding-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 12px;
  margin-right: 5px;
  margin-bottom: 5px;
  color: white;
  white-space: nowrap;
  cursor: default;
  transition: all 0.2s ease;
}

/* Sortable column headers */
th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: background-color 0.2s ease;
}

th.sortable:hover {
  background-color: #f8f9fa;
}

th.sortable .sort-icon {
  margin-left: 5px;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

th.sortable.sort-asc .sort-icon:before {
  content: "\f0de"; /* fa-sort-up */
  opacity: 1;
}

th.sortable.sort-desc .sort-icon:before {
  content: "\f0dd"; /* fa-sort-down */
  opacity: 1;
}

/* Make badges with info icon (like Other Findings) look clickable */
.finding-badge i.fa-info-circle {
  margin-left: 3px;
  font-size: 10px;
}

/* Hover effects for finding badges with additional info */
.finding-badge[data-bs-toggle="tooltip"]:hover {
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  transform: translateY(-1px);
}

/* Oil change badge - using a distinctive gold/amber color */
.finding-oil-change {
  background-color: #ffc107;
  color: #212529; /* Darker text for better contrast */
}

/* Propeller strike badge - using an orange-red color */
.finding-prop-strike {
  background-color: #FF4500; /* Orange-red */
  color: white;
}

/* Propeller work badge - using a sky blue color */
.finding-propeller {
  background-color: #00BFFF; /* Deep Sky Blue */
  color: white;
}

/* Component overhaul badge - using a teal color */
.finding-component-overhaul {
  background-color: #20c997;
  color: #212529; /* Darker text for better contrast */
}

/* Flight controls badge - using a reddish orange for visibility */
.finding-flight-controls {
  background-color: #fd7e14;
  color: white;
}

/* Other findings badge - using a purple color to make it stand out */
.finding-other {
  background-color: #6f42c1;
  color: white;
}

/* Traditional Inspections - Blue tones */
.finding-annual {
  background-color: #0d6efd;
  color: white;
}

.finding-100hr {
  background-color: #0dcaf0;
  color: #212529;
}

.finding-airworthiness {
  background-color: #6610f2;
  color: white;
}

.finding-ad {
  background-color: #dc3545;
  color: white;
}

/* Major Work - Orange/Red tones */
.finding-engine, .finding-engine-work {
  background-color: #fd7e14;
  color: white;
}

.finding-engine-change {
  background-color: #ff6b35;
  color: white;
}

.finding-major-repair {
  background-color: #e74c3c;
  color: white;
}

.finding-major-alteration {
  background-color: #c0392b;
  color: white;
}

/* Critical Events - Red/Pink tones */
.finding-bird-strike {
  background-color: #ff1744;
  color: white;
}

.finding-fod {
  background-color: #d50000;
  color: white;
}

.finding-lightning {
  background-color: #ffab00;
  color: #212529;
}

.finding-overspeed {
  background-color: #ff5722;
  color: white;
}

.finding-overtemp {
  background-color: #bf360c;
  color: white;
}

.finding-hard-landing {
  background-color: #e91e63;
  color: white;
}

.finding-tail-strike {
  background-color: #ad1457;
  color: white;
}

/* Damage/Repairs - Purple tones */
.finding-corrosion {
  background-color: #9c27b0;
  color: white;
}

.finding-structural {
  background-color: #673ab7;
  color: white;
}

.finding-cracks {
  background-color: #7b1fa2;
  color: white;
}

.finding-delamination {
  background-color: #8e24aa;
  color: white;
}

.finding-erosion {
  background-color: #6a1b9a;
  color: white;
}

/* System Components - Teal/Green tones */
.finding-rotor {
  background-color: #00acc1;
  color: white;
}

.finding-transmission {
  background-color: #00897b;
  color: white;
}

.finding-landing-gear {
  background-color: #43a047;
  color: white;
}

.finding-fuel {
  background-color: #558b2f;
  color: white;
}

.finding-hydraulics {
  background-color: #1976d2;
  color: white;
}

.finding-pneumatics {
  background-color: #0288d1;
  color: white;
}

.finding-electrical {
  background-color: #fbc02d;
  color: #212529;
}

.finding-avionics {
  background-color: #512da8;
  color: white;
}

.finding-autopilot {
  background-color: #303f9f;
  color: white;
}

.finding-pressurization {
  background-color: #1a237e;
  color: white;
}

.finding-ecs {
  background-color: #01579b;
  color: white;
}

/* Routine Maintenance */
.finding-filter-change {
  background-color: #ffeb3b;
  color: #212529;
}

/* Phase/Progressive - Gray tones */
.finding-phase {
  background-color: #607d8b;
  color: white;
}

.finding-progressive {
  background-color: #546e7a;
  color: white;
}

/* Turbine/Jet Specific - Orange/Brown tones */
.finding-hot-section {
  background-color: #ff6f00;
  color: white;
}

.finding-borescope {
  background-color: #e65100;
  color: white;
}

.finding-turbine-oh {
  background-color: #bf360c;
  color: white;
}

.finding-fuel-nozzles {
  background-color: #ff8f00;
  color: #212529;
}

.finding-igniters {
  background-color: #ff6d00;
  color: white;
}

.finding-apu {
  background-color: #ff3d00;
  color: white;
}

.finding-thrust-reverser {
  background-color: #dd2c00;
  color: white;
}

.finding-egt {
  background-color: #d84315;
  color: white;
}

.finding-itt {
  background-color: #bf360c;
  color: white;
}

/* Helicopter Specific - Cyan/Teal tones */
.finding-main-rotor {
  background-color: #00bcd4;
  color: white;
}

.finding-tail-rotor {
  background-color: #00acc1;
  color: white;
}

.finding-swashplate {
  background-color: #0097a7;
  color: white;
}

.finding-trans-insp {
  background-color: #00838f;
  color: white;
}

.finding-track-balance {
  background-color: #006064;
  color: white;
}

.finding-vibe {
  background-color: #004d40;
  color: white;
}

.finding-mast {
  background-color: #00695c;
  color: white;
}

.finding-gearbox {
  background-color: #00796b;
  color: white;
}

/* Piston Specific - Green tones */
.finding-compression-test {
  background-color: #2e7d32;
  color: white;
}

.finding-magneto {
  background-color: #388e3c;
  color: white;
}

.finding-valve {
  background-color: #43a047;
  color: white;
}

.finding-cylinder {
  background-color: #4caf50;
  color: white;
}

/* Testing/Checks - Indigo tones */
.finding-ndt {
  background-color: #3f51b5;
  color: white;
}

.finding-functional {
  background-color: #5c6bc0;
  color: white;
}

.finding-ops-check {
  background-color: #7986cb;
  color: white;
}

/* Special Programs - Deep Purple tones */
.finding-msg3 {
  background-color: #4527a0;
  color: white;
}

.finding-hums {
  background-color: #512da8;
  color: white;
}

.finding-etops {
  background-color: #5e35b1;
  color: white;
}

.finding-rvsm {
  background-color: #673ab7;
  color: white;
}

/* Life Limited Parts - Dark Red */
.finding-life-limited {
  background-color: #b71c1c;
  color: white;
}

/* Status Flags - Brown tones */
.finding-test-flight {
  background-color: #6d4c41;
  color: white;
}

.finding-ground-run {
  background-color: #5d4037;
  color: white;
}

.finding-deferred {
  background-color: #795548;
  color: white;
}

/* Service Bulletins - Pink tones */
.finding-service-bulletin {
  background-color: #e91e63;
  color: white;
}

/* Flag items (older style, kept for backwards compatibility) */
.flag-item {
  display: inline-block;
  background-color: #dc3545;
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  margin-right: 5px;
  margin-bottom: 5px;
}

/* Logbook pages table */
.logbook-pages-section {
  margin-top: 40px;
}

.logbook-table-container {
  max-height: 600px;
  overflow-x: auto;
  overflow-y: auto;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  width: 100%;
}

.logbook-table {
  width: 100%;
  border-collapse: collapse;
}

.logbook-table th, .logbook-table td {
  padding: 10px 10px;
  border-bottom: 1px solid #dee2e6;
}

.logbook-table th {
  background-color: #f8f9fa;
  font-weight: bold;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 3px rgba(0,0,0,0.1);
}

.logbook-table tbody tr {
  transition: background-color 150ms ease;
}

.logbook-table tbody tr:not(.empty-state):not(.loading-state) {
  cursor: pointer;
}

.logbook-table tbody tr:hover {
  background-color: rgba(184, 85, 30, 0.05);
}

.logbook-table tbody tr:nth-child(even) {
  background-color: #fbfbfd;
}

/* Column width control */
.logbook-table .col-file {
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logbook-table .col-date {
  width: 110px;
}

.logbook-table .col-meter {
  width: 90px;
}

.logbook-table .col-totaltime {
  width: 90px;
}

.logbook-table .col-confidence {
  width: 120px;
}

.logbook-table .col-page {
  width: 90px;
  white-space: nowrap;
}

.logbook-table .col-actions {
  width: 100px;
}

/* Keep actions visible when horizontally scrolling */
.logbook-table th.col-actions,
.logbook-table td.col-actions {
  position: sticky;
  right: 0;
  background: inherit;
  z-index: 2;
  box-shadow: -10px 0 14px rgba(0, 0, 0, 0.06);
}

.logbook-table th.col-actions {
  z-index: 12;
}

.logbook-table .col-select {
  width: 36px;
  text-align: center;
}

.logbook-table .col-status {
  width: 32px;
  text-align: center;
}

.logbook-table .col-summary {
  min-width: 200px;
}

.logbook-table .col-findings {
  width: 220px;
}

.logbook-table .col-ads,
.logbook-table th.col-ads,
.logbook-table td.col-ads {
  width: 120px !important;
  max-width: 120px !important;
}

/* Page reference pill/button */
.page-ref-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #e5e5e7;
  background: #fbfbfd;
  color: #1d1d1f;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: all 150ms;
}

.page-ref-btn:hover {
  border-color: rgba(184, 85, 30, 0.35);
  box-shadow: 0 0 0 3px rgba(184, 85, 30, 0.12);
}

.page-ref-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(184, 85, 30, 0.18);
}

.entry-order-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  margin-left: 6px;
  border-radius: 999px;
  background: rgba(184, 85, 30, 0.1);
  color: var(--color-copper);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

/* Action buttons styling */
.logbook-table .btn-group .btn {
  margin: 3px 0;
}

@media (max-width: 768px) {
  .logbook-table .btn-text {
    display: none;
  }

  /* Mobile: convert main entries table into cards */
  #delete-selected-btn {
    display: none;
  }

  #full-table-view {
    max-height: none;
    overflow-y: visible;
    overflow-x: visible;
    padding: 12px;
    border: 0;
    border-radius: 0;
  }

  #logbook-pages-table thead {
    display: none;
  }

  #logbook-pages-table,
  #logbook-pages-table tbody,
  #logbook-pages-table tr,
  #logbook-pages-table td {
    display: block;
    width: 100%;
  }

  #logbook-pages-table tr {
    margin: 0 0 12px;
    padding: 12px;
    border: 1px solid #e5e5e7;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  }

  #logbook-pages-table td {
    display: grid;
    grid-template-columns: clamp(92px, 34%, 140px) 1fr;
    column-gap: 12px;
    row-gap: 4px;
    align-items: start;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f2;
  }

  #logbook-pages-table td:last-child {
    border-bottom: none;
  }

  #logbook-pages-table td::before {
    content: attr(data-label);
    font-weight: 700;
    color: #86868b;
    font-size: 12px;
    line-height: 1.3;
    margin-top: 2px;
  }

  #logbook-pages-table td.col-status,
  #logbook-pages-table td.col-actions {
    grid-template-columns: 1fr;
    justify-items: end;
  }

  #logbook-pages-table td.col-status::before,
  #logbook-pages-table td.col-actions::before,
  #logbook-pages-table td.col-select::before {
    content: '';
    margin: 0;
  }

  #logbook-pages-table td.col-select {
    display: none;
  }

  #logbook-pages-table td.col-actions {
    position: static;
    right: auto;
    background: transparent;
    box-shadow: none;
  }

  #logbook-pages-table td.col-actions .btn-group {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
  }

  #logbook-pages-table td.col-actions .btn-group .btn {
    margin: 0;
  }

  #logbook-pages-table tr.empty-state,
  #logbook-pages-table tr.loading-state {
    margin: 0;
    padding: 16px 12px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }

  #logbook-pages-table tr.empty-state td,
  #logbook-pages-table tr.loading-state td {
    display: block;
    padding: 0;
    border-bottom: 0;
  }

  #logbook-pages-table tr.empty-state td::before,
  #logbook-pages-table tr.loading-state td::before {
    content: none;
  }

  /* Mobile: page entries table (paginated view) into cards */
  #paginated-view .logbook-table-container {
    max-height: none;
    overflow: visible;
    border: 0;
    border-radius: 0;
    padding: 12px;
  }

  #paginated-view .logbook-table thead,
  #paginated-view .logbook-table tfoot {
    display: none;
  }

  #paginated-view .logbook-table,
  #paginated-view .logbook-table tbody,
  #paginated-view .logbook-table tr,
  #paginated-view .logbook-table td {
    display: block;
    width: 100%;
  }

  #paginated-view #page-entries-table tr {
    margin: 0 0 12px;
    padding: 12px;
    border: 1px solid #e5e5e7;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  }

  #paginated-view #page-entries-table td {
    display: grid;
    grid-template-columns: clamp(92px, 34%, 140px) 1fr;
    column-gap: 12px;
    row-gap: 4px;
    align-items: start;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f2;
  }

  #paginated-view #page-entries-table td:last-child {
    border-bottom: none;
  }

  #paginated-view #page-entries-table td::before {
    content: attr(data-label);
    font-weight: 700;
    color: #86868b;
    font-size: 12px;
    line-height: 1.3;
    margin-top: 2px;
  }

  #paginated-view #page-entries-table td.col-status,
  #paginated-view #page-entries-table td.col-actions {
    grid-template-columns: 1fr;
    justify-items: end;
  }

  #paginated-view #page-entries-table td.col-status::before,
  #paginated-view #page-entries-table td.col-actions::before {
    content: '';
    margin: 0;
  }

  #paginated-view #page-entries-table td.col-actions .btn-group {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
  }

  #paginated-view #page-entries-table td.col-actions .btn-group .btn {
    margin: 0;
  }

  #paginated-view #page-entries-table tr.empty-state {
    margin: 0;
    padding: 16px 12px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }

  #paginated-view #page-entries-table tr.empty-state td {
    display: block;
    padding: 0;
    border-bottom: 0;
  }

  #paginated-view #page-entries-table tr.empty-state td::before {
    content: none;
  }
}

/* Status icons */
.status-icon {
  font-size: 18px;
  transition: all 0.3s ease-in-out;
}

.status-icon.processed {
  color: #198754;
}

.status-icon.processing {
  color: #0dcaf0;
  animation: spin 1.5s linear infinite;
}

.status-icon.failed {
  color: #dc3545;
}

.status-icon.skipped {
  color: #ffc107;
}

.status-icon.uploaded {
  color: #6c757d;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Confidence score meter */
.confidence-meter {
  width: 80px;
  height: 8px;
  background-color: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
  display: inline-block;
  margin-right: 8px;
  vertical-align: middle;
}

.confidence-meter-fill {
  height: 100%;
  background-color: #198754;
  border-radius: 4px;
}

.confidence-meter-fill.high {
  background-color: #198754;
}

.confidence-meter-fill.medium {
  background-color: #ffc107;
}

.confidence-meter-fill.low {
  background-color: #dc3545;
}

/* Verification badge */
.verification-badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.4rem;
  white-space: nowrap;
  display: inline-block;
}

/* Status badges */
.status-badge {
  padding: 5px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
}

.status-uploaded {
  background-color: #e9ecef;
  color: #495057;
}

.status-processing {
  background-color: #cff4fc;
  color: #055160;
}

.status-processed {
  background-color: #d1e7dd;
  color: #0f5132;
}

.status-skipped {
  background-color: #fff3cd;
  color: #664d03;
}

.status-failed {
  background-color: #f8d7da;
  color: #842029;
}

/* Deleting row state */
tr.deleting {
  position: relative;
}

tr.deleting::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.05);
  pointer-events: none;
}

/* Tabs */
.tab-container {
  margin-bottom: 30px;
}

.nav-tabs {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  border-bottom: 1px solid #dee2e6;
}

.nav-tabs li {
  margin-right: 5px;
}

.nav-tabs a {
  display: block;
  padding: 10px 15px;
  text-decoration: none;
  color: #495057;
  border: 1px solid transparent;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
}

.nav-tabs a.active {
  color: var(--color-ink);
  background-color: #fff;
  border-color: #dee2e6 #dee2e6 #fff;
}

.tab-content > div {
  display: none;
  padding: 20px 0;
}

.tab-content > div.active {
  display: block;
}

/* Camera capture section */
.camera-section {
  display: none;
}

#camera-feed {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  display: block;
  border: 1px solid #dee2e6;
  border-radius: 4px;
}

.camera-controls {
  display: flex;
  justify-content: center;
  margin-top: 15px;
  gap: 10px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .extraction-content {
    flex-direction: column;
  }

  .extraction-image, .extraction-data {
    width: 100%;
  }

  .extraction-image {
    border-right: none;
    border-bottom: 1px solid #dee2e6;
  }

  .image-container {
    min-height: 400px;
    max-height: 500px;
  }

  .logbook-image {
    max-height: 450px;
  }

  .nav-tabs {
    flex-wrap: wrap;
  }

  .camera-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
  }

  .image-controls {
    flex-wrap: wrap;
    justify-content: center;
  }

  /* Modal adjustments for tablets */
  .logbook-extraction-modal .modal-dialog {
    max-width: 95% !important;
    width: 95% !important;
    margin: 10px auto !important;
  }
}

/* Mobile-specific adjustments for logbook entry editor */
@media (max-width: 576px) {
  /* Make modal take full width on mobile */
  .logbook-extraction-modal .modal-dialog {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    height: 100vh !important;
  }

  .logbook-extraction-modal .modal-content {
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    border: none !important;
  }

  .logbook-extraction-modal .modal-body {
    height: calc(100vh - 120px) !important;
    padding: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* Stack image and form vertically for better mobile use */
  .logbook-extraction-modal .extraction-content {
    flex-direction: column !important;
    height: auto !important;
    overflow-y: auto !important;
  }

  .logbook-extraction-modal .extraction-image,
  .logbook-extraction-modal .extraction-data {
    width: 100% !important;
    flex: none !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: auto !important;
  }

  /* Adjust image container height for better mobile viewing */
  .logbook-extraction-modal .image-container {
    min-height: 300px !important;
    max-height: 350px !important;
    padding: 5px !important;
  }

  /* Ensure image controls are easy to tap */
  .image-controls .btn {
    padding: 8px 12px !important;
    margin: 5px !important;
    font-size: 1.1rem !important;
  }

  /* Better form layout for small screens */
  .extraction-field {
    margin-bottom: 12px !important;
  }

  .extraction-field label {
    font-size: 0.9rem !important;
    margin-bottom: 4px !important;
  }

  /* Ensure inputs are larger and easier to tap */
  .editable-field,
  .json-field,
  select.form-control,
  textarea.form-control {
    font-size: 16px !important; /* Prevent iOS zoom on focus */
    padding: 10px 8px !important;
    margin-bottom: 5px !important;
  }

  /* Make checkboxes easier to interact with */
  .form-check {
    padding: 10px 8px !important;
  }

  .form-check-input {
    width: 18px !important;
    height: 18px !important;
    margin-top: 3px !important;
  }

  .form-check-label {
    padding-left: 5px !important;
    font-size: 0.9rem !important;
  }

  /* Better spacing for mobile scrolling */
  .extraction-field .row {
    margin-bottom: 10px !important;
  }

  /* Improve modal footer buttons */
  .logbook-extraction-modal .modal-footer {
    flex-wrap: nowrap !important;
    padding: 10px !important;
  }

  .logbook-extraction-modal .modal-footer .btn {
    flex: 1 !important;
    padding: 12px 5px !important;
    font-size: 1rem !important;
  }
}
#aircraft-summary,
#aircraft-summary .markdown-body,
#shared-aircraft-summary,
#shared-aircraft-summary .markdown-body {
  color: #000;
  background-color: #fff;
  padding: var(--spacing-md);
  border-radius: var(--radius-sm);
  overflow-x: visible;
}

#aircraft-summary table,
#shared-aircraft-summary table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
}

#aircraft-summary th,
#aircraft-summary td,
#shared-aircraft-summary th,
#shared-aircraft-summary td {
  background-color: #fff;
  color: #000;
  vertical-align: top;
  min-width: 150px;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}

#aircraft-summary th,
#shared-aircraft-summary th {
  white-space: nowrap;
}

/* Reprocess button */
.reprocess-page-btn {
  color: #fff;
}

/* Search bar */
.logbook-search-input {
  max-width: 300px;
}

/* Pagination controls */
#page-indicator {
  font-weight: bold;
  font-size: 1rem;
}

.page-indicator-wrap {
  text-align: center;
  line-height: 1.2;
}

.page-indicator-sub {
  display: block;
  font-size: 12px;
  color: #86868b;
  margin-top: 2px;
}

.page-header-left {
  min-width: 0;
}

.page-header-sub {
  font-size: 12px;
  color: #86868b;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-strip-wrap {
  background: #fff;
  border: 1px solid #e5e5e7;
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.page-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.page-strip::-webkit-scrollbar {
  height: 8px;
}

.page-strip::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 999px;
}

.page-chip {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #e5e5e7;
  background: #fbfbfd;
  color: #1d1d1f;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  scroll-snap-align: start;
  transition: all 150ms;
}

.page-chip:hover {
  border-color: rgba(184, 85, 30, 0.35);
  box-shadow: 0 0 0 3px rgba(184, 85, 30, 0.12);
}

.page-chip.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.page-chip.status-processing {
  border-color: rgba(90, 200, 250, 0.8);
}

.page-chip.status-failed {
  border-color: rgba(255, 59, 48, 0.8);
}

.page-chip.status-skipped {
  border-color: rgba(255, 149, 0, 0.8);
}

.page-chip.status-processed {
  border-color: rgba(52, 199, 89, 0.8);
}

.page-chip.status-uploaded {
  border-color: rgba(134, 134, 139, 0.55);
}

.page-image-scroll {
  position: relative;
  overflow: hidden;
  max-height: 500px;
  border: 1px solid #dee2e6;
  border-radius: 12px;
  padding: 10px;
  background: #fff;
}

.page-image-loading-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(2px);
  z-index: 4;
  pointer-events: none;
}

.page-image-loading-text {
  font-size: 13px;
  font-weight: 600;
  color: #6c757d;
}

.page-image-scroll.is-loading .page-image-loading-overlay {
  display: flex;
}

.page-image-scroll.is-loading .page-image {
  opacity: 0.35;
  filter: saturate(0.85) blur(0.5px);
}

.page-image {
  transform-origin: center;
  transition: transform 200ms ease;
}

.page-image-overlay {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  z-index: 2;
  pointer-events: none;
  flex-wrap: wrap;
  max-width: calc(100% - 20px);
}

.page-ref-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(6px);
}

.page-ref-file {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  font-weight: 600;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(6px);
}
.logbook-page-image-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #f8f9fa;
  border-radius: 4px;
  padding: 10px;
  min-height: 200px;
}

/* Sticky totals for paginated view */
#page-entries-totals .sticky-totals {
  position: sticky;
  bottom: 0;
  background-color: #f8f9fa;
  z-index: 1;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
}

/* Confidence meter styles */
.confidence-meter {
  display: inline-block;
  width: 60px;
  height: 8px;
  background-color: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
  margin-right: 8px;
  vertical-align: middle;
}

.confidence-meter-fill {
  height: 100%;
  transition: width 0.3s ease;
  border-radius: 4px;
}

.confidence-meter-fill.high {
  background-color: #28a745;
}

.confidence-meter-fill.medium {
  background-color: #ffc107;
}

.confidence-meter-fill.low {
  background-color: #dc3545;
}

/* Verification badge styles */
.verification-badge {
  font-size: 0.75rem;
  padding: 2px 6px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.verification-badge i {
  font-size: 0.75rem;
}

/* Column specific widths for confidence column */
.col-confidence {
  min-width: 120px;
  text-align: center;
}

/* Ensure confidence column content is properly aligned */
.logbook-table td.col-confidence {
  vertical-align: middle;
}

/* Make sure the confidence meter and badge stack properly */
.col-confidence > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/* ========================================
   MAJOR REDESIGN - APPLE-INSPIRED DASHBOARD
   ======================================== */

/* Override container for more compact layout */
.logbook-scan-container {
  max-width: 1440px !important;
  padding: 16px !important;
  overflow-x: hidden;
}

/* Compact Header */
.page-header-compact {
  margin-bottom: 16px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.title-section h1 {
  font-size: 28px;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.title-section .subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}

.legal-notice-compact {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #FFF3E0;
  border-radius: 20px;
  font-size: 12px;
  color: #F57C00;
  cursor: help;
  transition: all 150ms;
  position: relative;
  outline: none;
}

.legal-notice-compact:hover {
  background: #FFE0B2;
}

.legal-notice-compact::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(360px, 90vw);
  background: rgba(0, 0, 0, 0.88);
  color: #fff;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.35;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  z-index: 1000;
  white-space: normal;
}

.legal-notice-compact::before {
  content: "";
  position: absolute;
  top: calc(100% + 2px);
  right: 18px;
  border-width: 6px;
  border-style: solid;
  border-color: transparent transparent rgba(0, 0, 0, 0.88) transparent;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  z-index: 1001;
}

.legal-notice-compact:hover::after,
.legal-notice-compact:hover::before,
.legal-notice-compact:focus::after,
.legal-notice-compact:focus::before,
.legal-notice-compact:focus-visible::after,
.legal-notice-compact:focus-visible::before {
  opacity: 1;
  transform: translateY(0);
}

/* Dashboard Layout */
.dashboard-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Control Bar */
.control-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: white;
  border-radius: 12px;
  border: 1px solid #e5e5e7;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.aircraft-selector-compact {
  display: flex;
  gap: 8px;
  flex: 1;
  max-width: 400px;
}

.form-select-modern {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #e5e5e7;
  border-radius: 8px;
  font-size: 14px;
  background: #fbfbfd;
  transition: all 150ms;
}

.form-select-modern:focus {
  outline: none;
  border-color: var(--color-copper);
  box-shadow: 0 0 0 3px rgba(184, 85, 30, 0.1);
}

.btn-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5e5e7;
  border-radius: 8px;
  background: white;
  color: #86868b;
  transition: all 150ms;
  cursor: pointer;
}

.btn-icon:hover {
  background: var(--color-copper);
  border-color: var(--color-copper);
  color: white;
}

/* Inline Usage Stats */
.usage-stats-inline {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f5f5f7;
  border-radius: 20px;
  font-size: 13px;
}

.stat-pill i {
  color: var(--color-copper);
  font-size: 12px;
}

.stat-pill.warning i {
  color: #FF9500;
}

.stat-label {
  color: #86868b;
  font-weight: 600;
}

.stat-value {
  font-weight: 600;
  color: #1d1d1f;
}

.stat-limit {
  color: #86868b;
}

.stat-badge {
  color: #34C759;
  font-weight: 600;
}

/* Main Content Area */
.main-content-area {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Compact Upload Card */
.upload-card-compact {
  background: white;
  border-radius: 12px;
  border: 1px solid #e5e5e7;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

/* Upload Queue */
.upload-queue-card {
  background: white;
  border-radius: 12px;
  border: 1px solid #e5e5e7;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.upload-queue-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #e5e5e7;
  background: #fbfbfd;
}

.upload-queue-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.upload-queue-header h4 {
  font-size: 14px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0;
}

.upload-queue-batch-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(184, 85, 30, 0.18);
  background: rgba(184, 85, 30, 0.08);
  color: var(--color-copper);
}

.upload-queue-subtitle {
  font-size: 12px;
  color: #86868b;
  margin-top: 4px;
}

.upload-queue-counts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.upload-queue-count-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #e5e5e7;
  background: #f5f5f7;
  font-size: 12px;
  color: #1d1d1f;
  white-space: nowrap;
}

.upload-queue-count-pill .label {
  color: #86868b;
}

.upload-queue-progress {
  padding: 12px 16px 0;
}

.upload-queue-progress-bar {
  height: 6px;
  background: #e5e5e7;
  border-radius: 999px;
  overflow: hidden;
}

.upload-queue-progress-fill {
  height: 100%;
  background: var(--color-copper);
  transition: width 250ms;
}

.upload-queue-progress-text {
  margin-top: 8px;
  font-size: 12px;
  color: #86868b;
}

.upload-queue-body {
  padding: 12px 16px 16px;
}

.upload-queue-message {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e5e5e7;
  background: #f5f5f7;
  font-size: 12px;
  color: #1d1d1f;
}

.upload-queue-message i {
  color: var(--color-copper);
}

.upload-queue-files {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.upload-queue-file {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #e5e5e7;
  border-radius: 10px;
  background: white;
}

.upload-queue-file-name {
  font-size: 13px;
  font-weight: 600;
  color: #1d1d1f;
  word-break: break-word;
}

.upload-queue-file-sub {
  font-size: 12px;
  color: #86868b;
  margin-top: 4px;
}

.upload-queue-file-counts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.upload-queue-file-count {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid #e5e5e7;
  background: #f5f5f7;
  color: #1d1d1f;
  white-space: nowrap;
}

.upload-queue-file-count.processing {
  border-color: rgba(184, 85, 30, 0.25);
  background: rgba(184, 85, 30, 0.08);
  color: #055160;
}

.upload-queue-file-count.done {
  border-color: rgba(52, 199, 89, 0.25);
  background: rgba(52, 199, 89, 0.10);
  color: #0f5132;
}

.upload-queue-file-count.failed {
  border-color: rgba(255, 59, 48, 0.25);
  background: rgba(255, 59, 48, 0.10);
  color: #842029;
}

.upload-queue-file-count.skipped {
  border-color: rgba(134, 104, 139, 0.25);
  background: rgba(134, 104, 139, 0.10);
  color: #4b3751;
}

.upload-queue-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

/* WebSocket + batch filter pills */
.ws-status-pill,
.batch-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #e5e5e7;
  background: #f5f5f7;
  font-size: 12px;
  color: #1d1d1f;
  white-space: nowrap;
}

.ws-status-pill {
  cursor: default;
}

.ws-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FF9500;
}

.ws-status-pill.ws-connected .ws-dot {
  background: #34C759;
}

.ws-status-pill.ws-reconnecting .ws-dot {
  background: #FF9500;
}

.ws-status-pill.ws-disconnected .ws-dot {
  background: #FF3B30;
}

.ws-status-pill.ws-polling .ws-dot {
  background: #0d6efd;
}

.batch-filter-pill i {
  color: var(--color-copper);
}

.batch-filter-clear {
  border: 0;
  background: transparent;
  color: var(--color-copper);
  font-weight: 600;
  padding: 0 2px;
  cursor: pointer;
}

.batch-filter-clear:hover {
  text-decoration: underline;
}

.drop-zone-compact {
  padding: 24px;
  background: #f5f5f7;
  border: 2px dashed #e5e5e7;
  border-radius: 8px;
  margin: 16px;
  cursor: pointer;
  transition: all 150ms;
}

.drop-zone-compact:hover {
  border-color: var(--color-copper);
  background: #fbfbfd;
}

.drop-zone-compact:focus-visible {
  outline: none;
  border-color: rgba(184, 85, 30, 0.6);
  box-shadow: 0 0 0 3px rgba(184, 85, 30, 0.12);
  background: #fbfbfd;
}

.drop-zone-compact.drag-over {
  border-color: var(--color-copper);
  background: rgba(184, 85, 30, 0.05);
}

.drop-content {
  display: flex;
  align-items: center;
  gap: 20px;
}

.upload-icon-compact {
  font-size: 32px;
  color: var(--color-copper);
}

.upload-text {
  flex: 1;
}

.upload-text .primary-text {
  display: block;
  font-size: 15px;
  font-weight: 500;
  color: #1d1d1f;
  margin-bottom: 2px;
}

.upload-text .secondary-text {
  font-size: 13px;
  color: #86868b;
}

.btn-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 20px;
  background: var(--color-copper);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms;
}

.btn-upload:hover:not(:disabled) {
  background: var(--color-ink-soft);
  transform: translateY(-1px);
}

.btn-upload:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-upload.uploading {
  background: #34C759;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.8; }
  100% { opacity: 1; }
}

/* Preview Strip */
.preview-strip {
  display: flex;
  gap: 8px;
  padding: 0 16px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.preview-strip:empty {
  display: none;
}

.preview-strip .file-preview {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

/* Upload Preflight (estimated pages / limits) */
.upload-preflight {
  display: none;
  margin: 0 16px 16px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e5e5e7;
  background: #fbfbfd;
  color: #1d1d1f;
  font-size: 13px;
  line-height: 1.35;
}

.upload-preflight.show {
  display: block;
}

.upload-preflight.warning {
  border-color: #FF9500;
  background: rgba(255, 149, 0, 0.08);
}

.upload-preflight.danger {
  border-color: #FF3B30;
  background: rgba(255, 59, 48, 0.08);
}

.upload-preflight .muted {
  color: #86868b;
}

/* Progress Bar Compact */
.upload-progress-wrap {
  padding: 0 16px 16px;
}

.progress-bar-compact {
  height: 3px;
  background: #e5e5e7;
  position: relative;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--color-copper);
  transition: width 250ms;
}

.progress-status-compact {
  margin-top: 8px;
  font-size: 12px;
  color: #86868b;
}

/* Logbook Section Compact */
.logbook-section-compact {
  background: white;
  border-radius: 12px;
  border: 1px solid #e5e5e7;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid #e5e5e7;
  background: #fbfbfd;
}

.section-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-input-modern {
  padding: 6px 12px;
  border: 1px solid #e5e5e7;
  border-radius: 8px;
  font-size: 13px;
  width: 200px;
  background: white;
  transition: all 150ms;
}

.search-input-modern:focus {
  outline: none;
  border-color: var(--color-copper);
  box-shadow: 0 0 0 3px rgba(184, 85, 30, 0.1);
}

.view-controls {
  display: flex;
  gap: 8px;
}

.btn-icon-text {
  padding: 6px 12px;
  border: 1px solid #e5e5e7;
  border-radius: 8px;
  background: white;
  color: #86868b;
  font-size: 13px;
  cursor: pointer;
  transition: all 150ms;
}

.btn-icon-text:hover {
  background: #f5f5f7;
  color: #1d1d1f;
}

.btn-icon-danger {
  padding: 6px 10px;
  border: 1px solid #e5e5e7;
  border-radius: 8px;
  background: transparent;
  color: #FF3B30;
  font-size: 13px;
  cursor: pointer;
  transition: all 150ms;
}

.btn-icon-danger:hover:not(:disabled) {
  background: #FF3B30;
  border-color: #FF3B30;
  color: white;
}

.btn-icon-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Quick Actions Row */
.quick-actions-row {
  margin-top: 12px;
}

.compile-card {
  max-width: 600px;
}

.action-card {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: white;
  border-radius: 12px;
  border: 1px solid #e5e5e7;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 150ms;
}

.action-card:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
  transform: translateY(-1px);
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--color-copper), var(--color-copper-soft));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  flex-shrink: 0;
}

.card-content {
  flex: 1;
  min-width: 0;
}

.card-content h4 {
  font-size: 16px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0 0 4px 0;
}

.card-content p {
  font-size: 13px;
  color: #86868b;
  margin: 0 0 12px 0;
  line-height: 1.4;
}

/* Summary Section - Full width below actions */
.summary-section {
  background: white;
  border-radius: 12px;
  border: 1px solid #e5e5e7;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  padding: 20px;
  margin-top: 12px;
}

.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e5e5e7;
}

.summary-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0;
}

.summary-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.summary-select {
  min-width: 250px;
  padding: 8px 12px;
  font-size: 14px;
}

.summary-meta {
  font-size: 13px;
  color: #86868b;
  margin: 0 0 16px 0;
}

.summary-content-area {
  background: #fbfbfd;
  border-radius: 8px;
  padding: 24px;
  margin-top: 16px;
  overflow: hidden;
}

.shared-summary-status {
  font-size: 14px;
  color: #86868b;
  margin-bottom: 12px;
}

.summary-content-area .markdown-body {
  font-size: 14px;
  line-height: 1.6;
  color: #1d1d1f;
}

.summary-content-area .table-wrapper,
#aircraft-summary .table-wrapper,
#shared-aircraft-summary .table-wrapper {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  margin: 16px 0;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.summary-actions {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e5e5e7;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Download PDF Button Enhancement */
#download-summary-pdf-btn {
  background: linear-gradient(135deg, var(--color-copper) 0%, var(--color-ink-soft) 100%);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(184, 85, 30, 0.2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#download-summary-pdf-btn:hover {
  background: linear-gradient(135deg, var(--color-ink-soft) 0%, #003EAA 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(184, 85, 30, 0.3);
}

#download-summary-pdf-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(184, 85, 30, 0.2);
}

#download-summary-pdf-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#download-summary-pdf-btn i {
  font-size: 16px;
}

.btn-action {
  padding: 6px 16px;
  background: var(--color-copper);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms;
}

.btn-action:hover:not(:disabled) {
  background: var(--color-ink-soft);
}

.btn-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Card Actions */
.card-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-select-compact {
  padding: 6px 10px;
  border: 1px solid #e5e5e7;
  border-radius: 8px;
  font-size: 13px;
  background: #fbfbfd;
  width: 100%;
}

/* FAQ Section Compact */
.faq-section-compact {
  margin-top: 48px;
  padding: 32px 16px;
  background: #f5f5f7;
  border-top: 1px solid #e5e5e7;
}

.faq-container {
  max-width: 1440px;
  margin: 0 auto;
}

.faq-container h3 {
  font-size: 20px;
  font-weight: 600;
  color: #1d1d1f;
  margin-bottom: 24px;
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.faq-item {
  background: white;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid #e5e5e7;
}

.faq-item h4 {
  font-size: 15px;
  font-weight: 600;
  color: #1d1d1f;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.faq-item h4 i {
  color: var(--color-copper);
  font-size: 14px;
}

.faq-item p {
  font-size: 13px;
  color: #86868b;
  margin: 0;
  line-height: 1.5;
}

/* Responsive */
@media (max-width: 1200px) {
  .summary-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .summary-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .summary-select {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .control-bar {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }
  
  .aircraft-selector-compact {
    max-width: 100%;
  }

  .usage-stats-inline {
    justify-content: flex-start;
  }
  
  .drop-content {
    flex-direction: column;
    text-align: center;
  }

  .section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .header-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .search-input-modern {
    width: 100%;
  }

  .view-controls {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  /* Keep tables readable without horizontal scrolling */
  .logbook-table-container {
    overflow-x: hidden;
  }

  .logbook-table th.col-meter,
  .logbook-table td.col-meter,
  .logbook-table th.col-totaltime,
  .logbook-table td.col-totaltime,
  .logbook-table th.col-confidence,
  .logbook-table td.col-confidence,
  .logbook-table th.col-summary,
  .logbook-table td.col-summary,
  .logbook-table th.col-ads,
  .logbook-table td.col-ads {
    display: none;
  }

  .logbook-table th.col-actions,
  .logbook-table td.col-actions {
    position: static;
    box-shadow: none;
  }
  
  .faq-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 576px) {
  .usage-stats-inline {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .stat-pill {
    width: 100%;
    justify-content: space-between;
  }

  .drop-zone-compact {
    margin: 12px;
    padding: 16px;
  }

  .btn-upload {
    width: 100%;
    padding: 12px 16px;
    justify-content: center;
  }

  .upload-queue-header {
    flex-direction: column;
    align-items: stretch;
  }

  .upload-queue-counts {
    justify-content: flex-start;
  }

  .upload-queue-file {
    flex-direction: column;
  }

  .upload-queue-file-counts {
    justify-content: flex-start;
  }

  .upload-queue-actions {
    flex-direction: column;
    align-items: stretch;
  }
}
