/* MeshCore Packet Knife - Shared Styles */

/* Reset & Base */
* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  margin: 0 auto;
  padding: 20px;
  background: #f5f5f5;
  color: #333;
}

h1 {
  margin-bottom: 20px;
  font-size: 1.5em;
}

/* Subtitle text under h1 */
.subtitle {
  margin-top: -15px;
  margin-bottom: 20px;
  font-size: 13px;
  color: #666;
}

/* Typography helpers */
.mono { font-family: monospace; }
.error { color: #c00; }
.success { color: #080; }
.warning { color: #a50; }
.muted { color: #666; }

/* Form elements */
label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
}

textarea,
input[type="text"] {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: monospace;
  font-size: 14px;
}

textarea {
  height: 80px;
  resize: vertical;
}

input[type="number"] {
  width: 60px;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}

.input-group {
  margin-bottom: 15px;
}

/* Inline input row (label + input side by side) */
.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-row label {
  font-size: 13px;
  white-space: nowrap;
  margin-bottom: 0;
}

/* Buttons */
button {
  padding: 10px 16px;
  background: #5b8fb9;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

button:hover:not(:disabled) { background: #4a7a9e; }
button:disabled { background: #a0b8c8; cursor: not-allowed; }
button.running { background: #c45b5b; }
button.running:hover { background: #a84a4a; }

.btn-small {
  padding: 2px 8px;
  font-size: 12px;
}

.btn-inline {
  padding: 2px 8px;
  font-size: 12px;
  margin-left: 8px;
  vertical-align: middle;
}

/* Small action buttons (in tables, etc.) */
.action-btn {
  padding: 4px 10px;
  font-size: 12px;
  background: #5b8fb9;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
}

.action-btn:hover { background: #4a7a9e; }
.action-btn.skip-btn { background: #8b6b4a; }
.action-btn.skip-btn:hover { background: #7a5d40; }

.action-btns {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

/* Status pill/badge */
.status-pill {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 3px;
  background: #e8e8e8;
}

.status-pill.success { background: #d4edda; color: #155724; }
.status-pill.warning { background: #fff3cd; color: #856404; }
.status-pill.error { background: #f8d7da; color: #721c24; }

/* Checkbox row (for filter options) */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  font-size: 13px;
}

.checkbox-row input[type="checkbox"] {
  cursor: pointer;
}

.checkbox-row input[type="checkbox"]:disabled {
  cursor: not-allowed;
}

.checkbox-row input[type="checkbox"]:disabled + span {
  color: #999;
}

/* Options panel (filter options, settings) */
.options-panel {
  margin-bottom: 15px;
  padding: 10px 15px;
  background: #fafafa;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* Info box (green-tinted, for helpful info) */
.info-box {
  margin-top: 20px;
  padding: 10px 15px;
  background: #e8f4e8;
  border: 1px solid #b8d4b8;
  border-radius: 4px;
  font-size: 13px;
}

.info-box-title {
  font-weight: 500;
  margin-bottom: 8px;
}

.info-box a.btn {
  display: inline-block;
  padding: 4px 10px;
  background: #5b8fb9;
  color: white;
  text-decoration: none;
  border-radius: 3px;
  font-weight: 500;
  margin-right: 10px;
}

.info-box a.btn:hover {
  background: #4a7a9e;
}

/* Alert box (red-tinted, for warnings/errors) */
.alert-box {
  padding: 15px 20px;
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  color: #721c24;
  margin-bottom: 20px;
}

/* Status bar (queue status display) */
.status-bar {
  display: flex;
  gap: 20px;
  align-items: center;
  padding: 10px 15px;
  background: #e8e8e8;
  border-radius: 4px;
  margin-bottom: 20px;
  font-size: 13px;
  flex-wrap: wrap;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.status-label { color: #666; }
.status-value { font-weight: 500; font-family: monospace; }
.status-value.success { color: #080; }
.status-value.warning { color: #a50; }

/* Status breakdown */
.status-breakdown {
  padding: 8px 15px;
  background: #f5f5f5;
  border-radius: 4px;
  margin-bottom: 20px;
  font-size: 12px;
  color: #555;
  line-height: 1.6;
}

.status-breakdown .breakdown-line {
  margin: 2px 0;
}

.status-breakdown .found-pct { color: #080; font-weight: 500; }
.status-breakdown .failed-pct { color: #a50; font-weight: 500; }
.status-breakdown .length-detail { color: #666; }

/* Results table */
.results-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  overflow: hidden;
}

.results-table th,
.results-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #eee;
  font-size: 13px;
}

.results-table th {
  background: #f0f0f0;
  font-weight: 500;
  position: sticky;
  top: 0;
}

.results-table tr:last-child td {
  border-bottom: none;
}

.results-table .mono {
  font-family: monospace;
  word-break: break-all;
}

/* Table status colors */
.status-found { color: #080; font-weight: 500; }
.status-failed { color: #a50; }
.status-pending { color: #666; }
.status-processing { color: #5b8fb9; font-weight: 500; }

.packet-preview {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-cell {
  max-width: 400px;
  word-break: break-word;
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: #666;
}

/* Known keys list */
.known-keys-list {
  font-family: monospace;
  font-size: 12px;
}

.known-key-item {
  margin: 4px 0;
  display: flex;
  gap: 12px;
  align-items: baseline;
  flex-wrap: wrap;
}

.known-room-name {
  font-weight: 600;
  color: #1565c0;
  min-width: 120px;
}

.known-room-key {
  color: #666;
  word-break: break-all;
}

/* Connection status badge */
.connection-status {
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
}

.connection-status.disconnected { background: #f8d7da; color: #721c24; }
.connection-status.connecting { background: #fff3cd; color: #856404; }
.connection-status.connected { background: #d4edda; color: #155724; }

/* Footer */
.footer {
  margin-top: 30px;
  padding: 15px 0;
  border-top: 1px solid #ccc;
  font-size: 12px;
  color: #666;
  line-height: 1.5;
}

.footer a { color: #555; }
