/* Transport Stream Analyzer - Styles */

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

body {
  font-family: "Consolas", "Monaco", "Lucida Console", monospace;
  font-size: 12px;
  background-color: #1e1e1e;
  color: #d4d4d4;
  line-height: 1.3;
}

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

header {
  background-color: #252526;
  padding: 8px 16px;
  border-bottom: 1px solid #333;
  margin-bottom: 12px;
}

h1 {
  font-size: 16px;
  font-weight: 600;
  color: #569cd6;
}

.upload-area {
  border: 2px dashed #404040;
  border-radius: 4px;
  padding: 20px;
  text-align: center;
  background-color: #252526;
  margin-bottom: 16px;
  transition: border-color 0.3s;
}

.upload-area.dragover {
  border-color: #569cd6;
  background-color: #2d2d30;
}

.file-input {
  display: none;
}

.upload-text {
  color: #9cdcfe;
  margin-bottom: 8px;
  font-size: 13px;
}

.upload-button {
  background-color: #0e639c;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 2px;
  cursor: pointer;
  font-size: 11px;
  font-family: inherit;
}

.upload-button:hover {
  background-color: #1177bb;
}

.analysis-container {
  display: none;
  grid-template-columns: 1fr 300px;
  gap: 12px;
  height: calc(100vh - 140px);
}

.main-panel {
  background-color: #252526;
  border: 1px solid #333;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.side-panel {
  background-color: #252526;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 12px;
  overflow-y: auto;
}

.tabs {
  display: flex;
  background-color: #2d2d30;
  border-bottom: 1px solid #333;
}

.tab {
  padding: 6px 12px;
  cursor: pointer;
  border-right: 1px solid #333;
  font-size: 11px;
  background-color: #2d2d30;
  color: #cccccc;
}

.tab.active {
  background-color: #1e1e1e;
  color: #ffffff;
}

.tab:hover:not(.active) {
  background-color: #3e3e42;
}

.tab-content {
  flex: 1;
  padding: 12px;
  overflow: auto;
}

.mosaic-container {
  background-color: #1e1e1e;
  border: 1px solid #404040;
  position: relative;
  overflow: auto;
  min-height: 800px;
  flex: 1;
  height: 800px;
}

.mosaic-legend {
  background-color: #1e1e1e;
  border: 1px solid #404040;
  padding: 12px;
  width: 250px;
  height: 800px;
  overflow-y: auto;
  position: sticky;
  top: 0;
}

.legend-item {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  padding: 4px;
  border-radius: 3px;
  background-color: #2d2d30;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  margin-right: 8px;
  border: 1px solid #404040;
}

.legend-text {
  color: #d4d4d4;
  font-family: "Consolas", "Monaco", monospace;
}

.legend-pid {
  color: #9cdcfe;
  font-weight: bold;
}

.legend-type {
  color: #ce9178;
  margin-left: 8px;
  font-size: 11px;
}

#mosaic-canvas {
  cursor: crosshair;
  image-rendering: pixelated;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.stat-item {
  background-color: #2d2d30;
  padding: 8px;
  border-radius: 2px;
  border: 1px solid #404040;
}

.stat-label {
  font-size: 10px;
  color: #9cdcfe;
  margin-bottom: 2px;
}

.stat-value {
  font-size: 13px;
  color: #dcdcaa;
  font-weight: 600;
}

.pid-list {
  margin-top: 12px;
}

.pid-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px;
  margin: 2px 0;
  background-color: #2d2d30;
  border-radius: 2px;
  font-size: 11px;
}

.pid-info {
  color: #9cdcfe;
}

.pid-count {
  color: #dcdcaa;
  font-weight: 600;
}

.packet-details {
  background-color: #2d2d30;
  padding: 8px;
  border-radius: 2px;
  margin-top: 8px;
  font-size: 11px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  margin: 2px 0;
}

.detail-label {
  color: #9cdcfe;
}

.detail-value {
  color: #dcdcaa;
}

.loading {
  display: none;
  text-align: center;
  color: #9cdcfe;
  padding: 20px;
}

.error {
  background-color: #f14c4c;
  color: white;
  padding: 8px 12px;
  border-radius: 2px;
  margin: 8px 0;
  font-size: 11px;
}

/* Scrollbar styling for dark theme */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #1e1e1e;
}

::-webkit-scrollbar-thumb {
  background: #424242;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #4f4f4f;
}

.analytics-section {
  padding: 12px;
  background-color: #1e1e1e;
  height: 100%;
  overflow-y: auto;
}

/* Slider styling for dark theme */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: #404040;
  border-radius: 2px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: #569cd6;
  border-radius: 50%;
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #569cd6;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.analytics-table {
  margin-bottom: 16px;
}

/* PID Analysis Styles */
.pid-analysis-table {
  margin: 16px 0;
}

.status-good {
  color: #4caf50;
  font-weight: bold;
}

.status-warning {
  color: #ff9800;
  font-weight: bold;
}

.status-error {
  color: #f44336;
  font-weight: bold;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "Consolas", monospace;
  font-size: 10px;
  background-color: #2d2d30;
}

.data-table th,
.data-table td {
  padding: 4px 8px;
  text-align: left;
  border: 1px solid #333;
  color: #cccccc;
}

.data-table th {
  background-color: #0e639c;
  color: white;
  font-weight: bold;
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table tr:nth-child(even) {
  background-color: #252526;
}

.data-table tr:hover {
  background-color: #2d2d30;
}

.data-table td.numeric {
  text-align: right;
  font-family: monospace;
}

.data-table td.warning {
  background-color: #5c2d00;
  color: #ffcc99;
}

.data-table td.error {
  background-color: #5c1515;
  color: #ffcccc;
}

/* VBR Analysis Styles */
.pid-checkbox {
  display: flex;
  align-items: center;
  gap: 4px;
  background-color: #252526;
  padding: 4px 8px;
  border-radius: 3px;
  border: 1px solid #404040;
  font-size: 10px;
  color: #cccccc;
}

.pid-checkbox input[type="checkbox"] {
  margin: 0;
  width: 12px;
  height: 12px;
}

.pid-checkbox:hover {
  background-color: #2d2d30;
  border-color: #569cd6;
}

.vbr-graph-container canvas {
  background-color: #1e1e1e !important;
}

/* PCAP Stream Selector Dialog */
.stream-selector-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.stream-selector-dialog {
  background-color: #252526;
  border: 1px solid #404040;
  border-radius: 8px;
  padding: 24px;
  min-width: 500px;
  max-width: 700px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.stream-list {
  overflow-y: auto;
  max-height: 400px;
  border: 1px solid #333;
  border-radius: 4px;
  background-color: #1e1e1e;
}

.stream-item {
  padding: 12px 16px;
  border-bottom: 1px solid #333;
  cursor: pointer;
  transition: background-color 0.2s;
}

.stream-item:last-child {
  border-bottom: none;
}

.stream-item:hover {
  background-color: #2d2d30;
}

.stream-item.selected {
  background-color: #0e639c;
}

.stream-item.selected:hover {
  background-color: #1177bb;
}

.stream-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.stream-item-title {
  color: #9cdcfe;
  font-size: 12px;
  font-weight: bold;
}

.stream-item-packets {
  color: #4ec9b0;
  font-size: 11px;
}

.stream-item-details {
  color: #808080;
  font-size: 10px;
}

.stream-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.stream-btn-cancel {
  background-color: #3c3c3c;
  color: #cccccc;
}

.stream-btn-cancel:hover {
  background-color: #4c4c4c;
}

.stream-btn-select {
  background-color: #0e639c;
  color: white;
}

.stream-btn-select:hover:not(:disabled) {
  background-color: #1177bb;
}

.stream-btn-select:disabled {
  background-color: #3c3c3c;
  color: #666666;
  cursor: not-allowed;
}

/* Stream Tabs (for multi-stream PCAP files) */
.stream-tabs {
  display: flex;
  align-items: center;
  background-color: #1e1e1e;
  padding: 6px 12px;
  border-bottom: 1px solid #404040;
  gap: 8px;
}

.stream-tabs-label {
  color: #9cdcfe;
  font-size: 11px;
  font-weight: bold;
  white-space: nowrap;
}

.stream-tabs-container {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.stream-tab {
  padding: 4px 10px;
  background-color: #2d2d30;
  border: 1px solid #404040;
  border-radius: 3px;
  cursor: pointer;
  font-size: 10px;
  color: #cccccc;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 120px;
}

.stream-tab:hover {
  background-color: #3e3e42;
  border-color: #569cd6;
}

.stream-tab.active {
  background-color: #0e639c;
  border-color: #0e639c;
  color: white;
}

.stream-tab-title {
  font-weight: bold;
  margin-bottom: 2px;
}

.stream-tab-info {
  font-size: 9px;
  opacity: 0.8;
}

.stream-tab-packets {
  font-size: 9px;
  color: #4ec9b0;
}

.stream-tab.active .stream-tab-packets {
  color: #a0e0d0;
}
