/* Table Styles */
.table-container { margin-top: 15px; }
.table-scroll { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}

.table thead tr {
  background: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
}

.table th,
.table td {
  padding: 8px;
  border: 1px solid #dee2e6;
  text-align: left;
}

.table-row {
  border-bottom: 1px solid #dee2e6;
}

.table-cell {
  padding: 8px;
  border: 1px solid #dee2e6;
}

.table-cell-right {
  padding: 8px;
  text-align: right;
  border: 1px solid #dee2e6;
}

/* Violation Table */
.violation-table-title {
  font-weight: bold;
  margin-bottom: 10px;
  margin-left: 10px;
  color: #e74c3c;
}

.violation-table-hint {
  font-size: 0.95em;
  color: #666;
  margin-bottom: 8px;
}

.violation-table-wrapper {
  overflow: visible;
}

.violation-table {
  width: 100%;
  display: flex;
  flex-direction: column;
  font-size: 0.9em;
  border: 1px solid #dee2e6;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.violation-table-header {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 180px));
  gap: 12px;
  justify-content: flex-start;
  justify-items: start;
  background: #d4edda;
  border-bottom: 1px solid #c3e6cb;
  padding: 12px 18px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  color: #1b4332;
}

.violation-header-cell {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
}

.violation-header-cell.text-right {
  justify-content: flex-start;
  text-align: left;
}

.violation-table-body {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 5px;
  justify-content: flex-start;
  align-items: stretch;
}


.violation-card {
  background: #ffffff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid #e0e0e0;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  flex: 0 0 auto;
}

.violation-card--baro {
  width: 850px;
  max-width: 100%;
}

.violation-card--gps-only {
  width: 525px;
  max-width: 100%;
}

.violation-table section {
  margin: 0;
  padding: 0;
  border-radius: 0px;
}

.violation-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 22px;
  background: #f6f8fb;
  border-bottom: 1px solid #e1e7ef;
}

.violation-card-header-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.violation-card-header-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.violation-card-number {
  font-weight: 700;
  font-size: 1.05em;
  color: #0d47a1;
  background: rgba(13, 71, 161, 0.12);
  border-radius: 999px;
  padding: 4px 12px;
}

.violation-card-title {
  font-weight: 600;
  font-size: 1.05em;
  color: #1d2939;
}

.violation-card-meta {
  font-size: 0.85em;
  font-weight: 500;
  color: #475467;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.violation-card-header-right {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  text-align: right;
  min-width: 220px;
}

.violation-cell-airspace--with-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.violation-cell-airspace--with-header > .airspace-name,
.violation-cell-airspace--with-header > .airspace-meta {
  display: none;
}

.violation-cell-airspace--with-header .violation-card-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 0;
  background: none;
  border: 0;
}

.violation-cell-airspace--with-header .violation-card-header-right {
  margin-left: 0;
  align-items: flex-start;
  text-align: left;
  min-width: 0;
  width: 100%;
}

.violation-cell-airspace--with-header .violation-card-header-right .violation-header-altitudes {
  width: 100%;
}

.violation-cell-airspace--with-header .violation-header-altitudes-flex {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.violation-cell-airspace--with-header .violation-header-altitude-entry {
  grid-template-columns: minmax(50px, auto) minmax(80px, 1fr) minmax(80px, 1fr);
}

.violation-cell-airspace--with-header .violation-header-limits {
  width: 100%;
  margin-top: 4px;
}

.violation-header-altitude-entry-qne .violation-header-altitude-label,
.violation-header-altitude-entry-qne .violation-header-altitude-metric,
.violation-header-altitude-entry-qne .violation-header-altitude-imperial {
  color: #6b7280;
}

.violation-header-altitudes {
  display: none;
  gap: 12px;
}

.violation-card-header-right .violation-header-altitudes {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.violation-header-altitudes-flex {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  column-gap: 14px;
  row-gap: 10px;
  align-items: start;
}

.violation-header-altitude-entry {
  display: grid;
  grid-template-columns: minmax(100px, auto) minmax(110px, 1fr) minmax(110px, 1fr);
  column-gap: 12px;
  align-items: center;
  row-gap: 4px;
}

.violation-header-altitude-entry span {
  display: block;
}

.violation-header-altitude-label {
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #475569;
  font-weight: 600;
}


.violation-header-altitude-metric,
.violation-header-altitude-imperial {
  font-size: 1.05em;
  font-weight: 600;
  justify-self: flex-end;
  text-align: right;
}

.violation-header-altitude-imperial {
  font-weight: 500;
}

.violation-card-header-right .qnh-settings-normal,
.violation-card-header-right .altitude-qne,
.violation-card-header-right .show-on-map-container {
  text-align: right;
  margin: 0;
  grid-column: 1 / -1;
}

.violation-card-header-right .show-on-map-container {
  margin-top: 4px;
  justify-self: end;
}

.violation-card-header-right .qnh-settings-normal {
  color: #6b7280;
  font-size: 0.85em;
}

.violation-card-header-right .altitude-qne {
  font-weight: 600;
  color: #334155;
}

.violation-header-meta {
  font-size: 0.85em;
  color: #55627a;
  align-self: flex-start;
}

.violation-header-qne {
  font-weight: 600;
  color: #0f172a;
}

.violation-header-meta-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.violation-header-meta-column {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.violation-header-map-button {
  margin-top: 4px;
  align-self: flex-start;
}

.violation-header-map-button .show-on-map-btn {
  width: auto;
}

.violation-detail-column {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}

.violation-column-title {
  font-size: 0.75em;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #0f172a;
}

.violation-detail-body {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.violation-detail-body span {
  display: block;
}

.violation-status-wrapper {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.violation-status-wrapper .violation-status-qnh,
.violation-status-wrapper .violation-status-gps {
  min-width: 140px;
}

.violation-status-note {
  margin-top: 6px;
}

.violation-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 180px));
  gap: 18px;
  justify-content: flex-start;
  justify-items: start;
  padding: 24px;
  background: #ffffff;
}

.violation-cell {
  /* display: flex;
  flex-direction: column; */
  gap: 6px;
  align-items: flex-start;
  text-align: left;
}

.violation-cell::before {
  content: none;
}

.violation-cell-right {
  text-align: left;
  align-items: flex-start;
}

.violation-cell-right .time-info-container {
  text-align: left;
}

.violation-cell-airspace .airspace-limits-box {
  margin-top: 6px;
  padding: 10px 12px;
  background: #f5f7fb;
  border: 1px solid #e2e8f0;
}

.violation-cell-airspace .limits-title {
  font-weight: 600;
  margin-bottom: 4px;
  color: #495057;
}

.violation-debug-row {
  background: #f8f9fa;
}

.violation-debug-content {
  font-family: monospace;
  font-size: 0.85em;
  color: #333;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid #dee2e6;
  padding: 12px 14px;
  margin-left: 20px;
  border-left: 4px solid #34495e;
}

@media (max-width: 1024px) {


  .violation-table-header {
    display: none;
  }

  .violation-table-body {
    padding: 12px;
    gap: 16px;
    flex-direction: column;
  }


  .violation-card--gps-only {
    width: 100%;
  }

  .violation-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .violation-cell-airspace--with-header .violation-card-header-right {
    width: 100%;
  }

  .violation-card-meta {
    margin-left: 0;
  }

  .violation-card-header-right {
    margin-left: 0;
    align-items: flex-start;
    text-align: left;
    min-width: auto;
    width: 100%;
  }

  .violation-card-header-right .violation-header-altitudes {
    align-items: flex-start;
  }

  .violation-header-altitude-entry {
    grid-template-columns: minmax(80px, auto) minmax(90px, 1fr);
    row-gap: 4px;
  }

  .violation-header-altitude-entry .violation-header-altitude-imperial {
    grid-column: 1 / -1;
    font-size: 0.95em;
  }

  .violation-header-altitude-entry .violation-header-altitude-metric,
  .violation-header-altitude-entry .violation-header-altitude-imperial {
    justify-self: flex-start;
    text-align: left;
  }

  .violation-header-meta-wrapper {
    align-items: flex-start;
  }

  .violation-header-meta-column {
    align-items: flex-start;
  }

  .violation-header-map-button {
    align-self: flex-start;
  }

  .violation-card-header-right .violation-header-altitudes-flex {
    grid-template-columns: 1fr;
  }

  .violation-row {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 18px;
  }

  .violation-cell {
    gap: 8px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    background: #fdfdfd;
  }

  .violation-cell::before {
    content: attr(data-label);
    display: block;
    font-size: 0.75em;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #6c757d;
    text-transform: uppercase;
    margin-bottom: 6px;
  }

  .violation-cell-right {
    text-align: left;
    align-items: flex-start;
  }

  .violation-cell-right .time-info-container {
    text-align: left;
  }

  .violation-cell-airspace .airspace-limits-box {
    background: transparent;
    border: none;
    padding: 0;
  }

  .violation-debug-row {
    padding: 0 16px 16px;
  }

  .violation-debug-content {
    font-size: 0.8em;
  }

  .isa-debug-flex {
    flex-direction: column;
  }

  .isa-debug-math {
    align-items: flex-start;
    text-align: left;
    margin-left: 0;
  }
}

/* Violation Status Styles */
.violation-status-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
}

.airspace-status-row {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
}

.airspace-status-row .violation-status-qnh,
.airspace-status-row .violation-status-gps {
  flex: 1 1 auto;
}

.violation-status-qnh {
  padding: 6px 8px;
  border-radius: 4px;
  font-weight: bold;
  text-align: center;
  font-size: 0.85em;
  border: 1px solid;
}

.violation-status-gps {
  padding: 4px 6px;
  border-radius: 3px;
  font-weight: bold;
  text-align: center;
  font-size: 0.8em;
  border: 1px solid;
}

.violation-status-qnh.violation {
  background: #ff4444;
  color: white;
  border-color: #cc0000;
}

.violation-status-qnh.no-violation {
  background: #28a745;
  color: white;
  border-color: #1e7e34;
}

.violation-status-qnh.no-data {
  background: #6c757d;
  color: white;
  border-color: #545b62;
}

.violation-status-gps.violation {
  background: #ff6666;
  color: white;
  border-color: #ff3333;
}

.violation-status-gps.no-violation {
  background: #5cb85c;
  color: white;
  border-color: #449d44;
}

.violation-status-note {
  font-size: 0.75em;
  color: #4b5563;
  line-height: 1.3;
}

/* Time Info */
.time-info-container {
  font-size: 0.9em;
  line-height: 1.3;
  margin-top: 6px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.time-info-entry {
  color: #333;
  font-weight: bold;
}

.time-info-exit {
  color: #666;
}

.time-info-duration {
  color: #28a745;
  font-weight: bold;
}

.time-info-points {
  color: #999;
  font-size: 0.85em;
}

/* Altitude Display Classes */
.altitude-display {
  margin-bottom: 4px;
}

.altitude-gps-ok {
  color: #28a745;
  font-weight: bold;
}

.altitude-gps-violation {
  color: #e74c3c;
  font-weight: bold;
}

.altitude-qnh-ok {
  color: #28a745;
  font-weight: bold;
}

.altitude-qnh-violation {
  color: #e74c3c;
  font-weight: bold;
}

.altitude-qnh-neutral {
  color: #666;
  font-weight: bold;
}

.altitude-qne {
  color: #666;
  font-weight: bold;
  margin-top: 8px;
  padding-top: 4px;
  border-top: 1px solid #eee;
}

/* Episode overview table */
.episode-table-container {
  margin-top: 16px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.35);
  color: #f5f5f5;
  font-size: 0.85em;
  max-height: 1000px;
}

.episode-table-container .episode-table-header {
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.episode-table-container .episode-table-header h4 {
  margin: 0;
  font-size: 1em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.episode-table-container .episode-table-header p {
  margin: 0;
  font-size: 0.85em;
  color: rgba(255, 255, 255, 0.75);
}

.episode-table-wrapper {
  overflow-x: auto;
}

.episode-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85em;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 6px;
  overflow: hidden;
}

.episode-table thead tr {
  background: rgba(255, 255, 255, 0.08);
}

.episode-table th,
.episode-table td {
  padding: 6px 8px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}

.episode-table td.numeric,
.episode-table th.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.episode-table td.icon-cell {
  width: 30px;
  text-align: center;
}

.episode-table td.actions {
  width: 32px;
  text-align: center;
}

.episode-table .clickable-point {
  cursor: pointer;
  color: #0d6efd;
  margin-left: 4px;
}

.episode-table tbody tr.selectable {
  cursor: pointer;
  transition: background 0.2s ease;
}

.episode-table tbody tr.selectable:hover {
  background: rgba(255, 255, 255, 0.12);
}

.episode-table tbody tr.straight-row {
  background: rgba(30, 136, 229, 0.08);
}

.episode-table tbody tr.circling-row {
  background: rgba(211, 47, 47, 0.08);
}

.episode-table tbody tr.mixed-row {
  background: rgba(142, 36, 170, 0.08);
}

.episode-table tbody tr.landing-row {
  background: rgba(78, 52, 46, 0.12);
}

.episode-table-empty {
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  text-align: center;
  font-style: italic;
}

/* QNH Settings */
.qnh-settings-fallback {
  color: #856404;
  font-size: 0.8em;
  background: #fff3cd;
  padding: 2px 4px;
  border-radius: 3px;
  border: 1px solid #ffeaa7;
}

.qnh-settings-normal {
  color: #999;
  font-size: 0.8em;
}

/* Violation Depth */
.violation-depth-violation {
  color: #e74c3c;
  font-weight: bold;
}

.violation-depth-ok {
  color: #28a745;
  font-weight: bold;
}

.violation-depth-protected {
  color: #28a745;
}

.violation-type {
  color: #999;
  font-size: 0.75em;
}

/* Debug Info */
.violation-debug {
  color: #999;
  font-size: 0.7em;
}

.violation-debug-warning {
  color: #e74c3c;
  font-size: 0.7em;
  background: #fff3cd;
  padding: 2px;
  border-radius: 2px;
}

.violation-debug-success {
  color: #28a745;
  font-size: 0.7em;
  background: #d4edda;
  padding: 2px;
  border-radius: 2px;
}

.isa-debug-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-start;
}

.isa-debug-details {
  flex: 1 1 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.isa-debug-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.isa-debug-title {
  font-weight: 700;
  font-size: 0.9em;
}

.isa-debug-line {
  font-size: 0.85em;
}

.isa-debug-math {
  flex: 1 1 240px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  text-align: right;
  margin-left: auto;
}

.isa-debug-subtitle {
  font-weight: 600;
  font-size: 0.85em;
}

.isa-debug-mathjax {
  display: block;
}

.isa-debug-result {
  font-weight: 700;
}

.isa-flag-success {
  color: #28a745;
  font-weight: 600;
}

.isa-flag-warning {
  color: #d9480f;
  font-weight: 600;
}

.no-data-text {
  color: #999;
}

.violation-track-heading {
  width: 100%;
  margin: 10px 12px 4px;
  font-weight: 600;
  color: #1d2939;
  display: flex;
  align-items: center;
  gap: 8px;
}

.violation-card-separator {
  width: 100%;
  height: 0;
  border-top: 1px dashed #d0d5dd;
  margin: 12px 8px;
}

.violation-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85em;
}

.violation-badge.badge-danger {
  background: #fee2e2;
  color: #b91c1c;
}

.violation-badge.badge-success {
  background: #dcfce7;
  color: #166534;
}

.violation-badge.badge-secondary {
  background: #e2e8f0;
  color: #1e293b;
}

.violation-badge.badge-muted {
  background: #f1f5f9;
  color: #475467;
}

.violation-card-note {
  margin-top: 6px;
  font-size: 0.85em;
  color: #344054;
}

.violation-table-empty {
  padding: 16px;
  color: #475467;
}

.violation-card-body {
  padding: 16px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.violation-card-section-title {
  font-weight: 600;
  font-size: 0.85em;
  color: #1d2939;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.violation-card-section-content {
  font-size: 0.9em;
  color: #475467;
}
