/* Hex Table Styles */

.hex-table-container {
  overflow: auto;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-3);
  box-shadow: var(--shadow);
}

.hex-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
  font-size: 12px;
}

.hex-table th,
.hex-table td {
  padding: 6px 8px;
  text-align: center;
  border: 1px solid var(--border-subtle);
  min-width: 32px;
}

.hex-table thead th {
  background: var(--accent-bg);
  color: var(--accent-text);
  font-weight: 500;
  position: sticky;
  top: 0;
  z-index: 10;
  border-color: var(--accent-border);
}

.hex-table tbody tr {
  transition: background 0.1s;
}

.hex-table tbody tr:nth-child(even) {
  background: var(--bg-ui);
}

.hex-table tbody tr:hover {
  background: var(--bg-hover);
}

/* Row Header (block number) */
.hex-table .row-header {
  background: var(--bg-ui);
  color: var(--text-muted);
  font-weight: 500;
  text-align: right;
  position: sticky;
  left: 0;
  z-index: 5;
  border-right: 1px solid var(--border-ui);
}

/* Row Header - clickable for Classic cards */
.hex-table.classic .row-header {
  cursor: pointer;
  transition: background 0.15s;
}

.hex-table.classic .row-header:hover {
  background: var(--accent-bg);
  color: var(--accent-text);
}

/* Editable Cell */
.hex-table td.editable {
  cursor: text;
  transition: background 0.15s;
}

.hex-table td.editable:hover {
  background: var(--accent-bg);
}

.hex-table td.editable:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: var(--bg-base);
}

/* Cell States */
.hex-table td.modified {
  background: var(--warning-bg);
  color: var(--warning);
  font-weight: 600;
}

.hex-table td.read-only {
  background: var(--bg-ui);
  color: var(--text-muted);
  cursor: not-allowed;
}

.hex-table td.error {
  background: var(--error-bg);
  color: var(--error);
}

.hex-table td.highlight {
  background: var(--success-bg);
  color: var(--success);
}

/* Block Types - Mifare Classic */
.hex-table tr.block-data {
  /* Default data block */
}

.hex-table tr.block-trailer {
  background: rgba(156, 39, 176, 0.1);
}

.hex-table tr.block-trailer td.key-a {
  background: rgba(233, 30, 99, 0.15);
  color: #f06292;
}

.hex-table tr.block-trailer td.access-bits {
  background: rgba(156, 39, 176, 0.15);
  color: #ba68c8;
}

.hex-table tr.block-trailer td.key-b {
  background: rgba(0, 150, 136, 0.15);
  color: #4db6ac;
}

.hex-table tr.block-manufacturer {
  background: var(--warning-bg);
}

/* Block Types - Ultralight */
.hex-table tr.block-uid {
  background: var(--warning-bg);
}

.hex-table tr.block-otp {
  background: rgba(156, 39, 176, 0.1);
}

.hex-table tr.block-config {
  background: rgba(0, 188, 212, 0.1);
}

.hex-table tr.block-password {
  background: var(--error-bg);
}

/* ASCII Column */
.hex-table td.ascii-column {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  letter-spacing: 0.5px;
  text-align: left;
  padding-left: 12px;
  color: var(--text-muted);
  border-left: 2px solid var(--border-ui);
}

/* Sector Separator */
.hex-table tr.sector-start td {
  border-top: 2px solid var(--accent);
}

.hex-table tr.sector-start .row-header {
  background: var(--accent-bg);
}

/* Sector Label */
.hex-table .sector-label {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 3px;
  margin-right: 6px;
  min-width: 24px;
  text-align: center;
}

/* Loading State */
.hex-table td.loading {
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    var(--bg-hover) 10px,
    var(--bg-hover) 20px
  );
  animation: loading-pulse 1s ease-in-out infinite;
}

@keyframes loading-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Selection */
.hex-table td.selected {
  outline: 2px solid var(--accent);
  background: var(--accent-bg);
}

/* Ultralight specific - 4 byte blocks */
.hex-table.ultralight td {
  min-width: 40px;
}

/* Classic specific - 16 byte blocks */
.hex-table.classic td {
  min-width: 28px;
}
