/* ── Variables ──────────────────────────────────────────────────────────────── */
:root {
  --teal:        #0F8290;
  --teal-dark:   #0a6570;
  --teal-light:  #e6f4f5;
  --yellow:      #FAB94D;
  --yellow-dark: #e0a030;
  --black:       #1a1a1a;
  --white:       #ffffff;
  --gray-50:     #f9fafb;
  --gray-100:    #f3f4f6;
  --gray-200:    #e5e7eb;
  --gray-400:    #9ca3af;
  --gray-600:    #4b5563;
  --gray-800:    #1f2937;
  --font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius:      6px;
  --shadow:      0 1px 3px rgba(0,0,0,0.10);
  --shadow-md:   0 4px 14px rgba(0,0,0,0.14);
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base ───────────────────────────────────────────────────────────────────── */
body {
  font-family: var(--font);
  color: var(--black);
  background: var(--gray-50);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
header {
  background: var(--teal);
  color: var(--white);
  padding: 0.9rem 2rem;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.subtitle {
  font-size: 0.8rem;
  opacity: 0.8;
  margin-top: 2px;
}
.header-meta {
  font-size: 0.78rem;
  opacity: 0.7;
  white-space: nowrap;
}

header a {
  color: #fef3c7;
  text-decoration-color: rgba(254, 243, 199, 0.65);
}

header a:visited {
  color: #fde68a;
  text-decoration-color: rgba(253, 230, 138, 0.7);
}

header a:hover,
header a:focus-visible {
  color: #ffffff;
  text-decoration-color: #ffffff;
}

/* ── Main ───────────────────────────────────────────────────────────────────── */
main {
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  padding: 1.25rem 2rem;
}

/* ── Filter bar ─────────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.search-box input {
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 0.45rem 0.75rem;
  font-size: 0.88rem;
  font-family: var(--font);
  width: 260px;
  outline: none;
  transition: border-color 0.15s;
  background: white;
}
.search-box input:focus { border-color: var(--teal); }

.btn-filter, .btn-clear {
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-filter {
  background: var(--teal);
  color: var(--white);
  border: 1.5px solid var(--teal);
}
.btn-filter:hover, .btn-filter.active { background: var(--teal-dark); border-color: var(--teal-dark); }
.btn-clear {
  background: white;
  color: var(--teal);
  border: 1.5px solid var(--teal);
}
.btn-clear:hover { background: var(--teal-light); }

.hidden { display: none !important; }

/* ── Filter chips ───────────────────────────────────────────────────────────── */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--teal-light);
  border: 1px solid var(--teal);
  color: var(--teal-dark);
  border-radius: 20px;
  padding: 0.18rem 0.55rem;
  font-size: 0.76rem;
  font-weight: 500;
}
.chip button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--teal-dark);
  font-size: 1.05rem;
  line-height: 1;
  padding: 0;
  margin-left: 1px;
  opacity: 0.7;
}
.chip button:hover { opacity: 1; }

/* ── Filter panel ───────────────────────────────────────────────────────────── */
.filter-panel {
  background: white;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 0.75rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.25rem;
  box-shadow: var(--shadow);
}
.filter-group h3 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-600);
  margin-bottom: 0.5rem;
  font-weight: 600;
}
.filter-options {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.filter-options label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.83rem;
  cursor: pointer;
  line-height: 1.3;
}
.filter-options input[type="checkbox"] {
  accent-color: var(--teal);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Results count ──────────────────────────────────────────────────────────── */
.results-info {
  font-size: 0.78rem;
  color: var(--gray-600);
  margin-bottom: 0.4rem;
}

/* ── Table ──────────────────────────────────────────────────────────────────── */
.table-wrapper {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
thead th {
  background: var(--teal);
  color: white;
  padding: 0.7rem 0.9rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 0;
}
thead th.sortable {
  cursor: pointer;
  user-select: none;
}
thead th.sortable:hover { background: var(--teal-dark); }
.sort-icon { opacity: 0.5; font-size: 0.7rem; margin-left: 2px; }
thead th.sort-asc .sort-icon,
thead th.sort-desc .sort-icon { opacity: 1; }
thead th.sort-asc .sort-icon::after   { content: ' ↑'; }
thead th.sort-desc .sort-icon::after  { content: ' ↓'; }

tbody tr {
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background 0.1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--teal-light); }
tbody td {
  padding: 0.55rem 0.9rem;
  font-size: 0.85rem;
  vertical-align: middle;
}

.col-icon { width: 52px; }
.authenticator-icon {
  width: 34px;
  height: 34px;
  object-fit: contain;
  display: block;
}
.no-icon {
  width: 34px;
  height: 34px;
  background: var(--gray-100);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.device-description { font-weight: 500; line-height: 1.3; }
.device-id {
  font-size: 0.7rem;
  color: var(--gray-400);
  font-family: monospace;
  margin-top: 1px;
}

/* Protocol tag */
.protocol-tag {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  background: var(--gray-100);
  border-radius: 4px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--gray-800);
  letter-spacing: 0.03em;
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 0.14rem 0.5rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.status-FIDO_CERTIFIED,
.status-FIDO_CERTIFIED_L1,
.status-FIDO_CERTIFIED_L1plus,
.status-FIDO_CERTIFIED_L1_PLUS {
  background: #f3d9b1;
  color: #5b3a16;
}

.status-FIDO_CERTIFIED_L2,
.status-FIDO_CERTIFIED_L2plus,
.status-FIDO_CERTIFIED_L2_PLUS {
  background: #e5e7eb;
  color: #374151;
}

.status-FIDO_CERTIFIED_L3,
.status-FIDO_CERTIFIED_L3plus,
.status-FIDO_CERTIFIED_L3_PLUS {
  background: #fde68a;
  color: #713f12;
}

.status-NOT_FIDO_CERTIFIED { background: #fee2e2; color: #991b1b; }
.status-REVOKED            { background: #fecaca; color: #7f1d1d; }

/* Emoji badge cells */
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}
.badge {
  position: relative;
  display: inline-block;
  cursor: default;
  font-size: 1.05rem;
  line-height: 1;
}
.badge-tooltip {
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-800);
  color: white;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 0.7rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
  z-index: 200;
}
.badge-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--gray-800);
}
.badge:hover .badge-tooltip { opacity: 1; }
.no-badges { color: var(--gray-400); font-size: 0.8rem; }

/* Fixed grid layout for extensions and options */
.fixed-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), 1fr);
  gap: 4px;
  width: 100%;
}
.grid-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  min-height: 32px;
  width: 100%;
  position: relative;
  border-radius: 4px;
}
.grid-cell.has-item { background: transparent; }
.grid-cell.is-empty {
  background: var(--gray-100);
  opacity: 0.4;
}
.grid-cell.proprietary-container {
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 2px;
}
.badge.proprietary {
  position: relative;
  display: inline-block;
  cursor: default;
  font-size: 1.05rem;
  line-height: 1;
}

/* Compact bars for table-side capability comparison */
.cap-bars {
  display: inline-flex;
  align-items: center;
  gap: 0;
  white-space: nowrap;
}
.cap-bar {
  width: 8px;
  height: 16px;
  position: relative;
  display: inline-block;
}
.cap-bar::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0;
  width: 4px;
  height: 16px;
  border-radius: 1px;
  background: var(--gray-200);
}
.cap-bar.present::before { background: #16a34a; }
.cap-bar.absent::before { background: var(--gray-200); }
.cap-bar.proprietary::before { background: #f59e0b; }

/* Empty / loading states */
.loading, .empty {
  text-align: center;
  color: var(--gray-400);
  padding: 3.5rem 1rem !important;
  font-size: 0.88rem;
}

/* ── Modal ──────────────────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.48);
  backdrop-filter: blur(2px);
}
.modal-content {
  position: relative;
  background: white;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.28);
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1;
}
.modal-header {
  background: var(--teal);
  color: white;
  padding: 1.2rem 1.5rem;
  border-radius: 10px 10px 0 0;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  position: sticky;
  top: 0;
}
.modal-icon {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex-shrink: 0;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 4px;
}
.modal-icon.no-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.modal-title h2 {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
}
.modal-title .modal-id {
  font-size: 0.74rem;
  opacity: 0.72;
  margin-top: 4px;
  font-family: monospace;
}
.modal-close {
  margin-left: auto;
  background: none;
  border: none;
  color: white;
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.75;
  padding: 0;
  flex-shrink: 0;
}
.modal-close:hover { opacity: 1; }
.modal-body { padding: 1.4rem 1.5rem; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem 1.5rem;
  margin-bottom: 1.4rem;
}
.detail-item label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  margin-bottom: 2px;
}
.detail-item span { font-size: 0.88rem; font-weight: 500; }

.detail-section { margin-bottom: 1.1rem; }
.detail-section h3 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-600);
  margin-bottom: 0.55rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--gray-200);
  font-weight: 600;
}
.detail-badges { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.detail-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.55rem;
  border-radius: 20px;
  font-size: 0.8rem;
  background: var(--teal-light);
  border: 1px solid var(--teal);
  color: var(--teal-dark);
}
.detail-badge .icon { font-size: 0.95rem; }
.option-value {
  font-size: 0.7rem;
  font-family: monospace;
  background: var(--teal);
  color: white;
  padding: 1px 5px;
  border-radius: 3px;
}

/* ── Footer ─────────────────────────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 0.9rem 2rem;
  font-size: 0.72rem;
  color: var(--gray-400);
  border-top: 1px solid var(--gray-200);
  background: white;
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  main { padding: 0.9rem 1rem; }
  header { padding: 0.75rem 1rem; }
  .header-content { flex-direction: column; align-items: flex-start; gap: 0.2rem; }
  .header-meta { display: none; }
  .search-box input { width: 100%; }
  .detail-grid { grid-template-columns: 1fr; }
  thead th { top: 70px; }
}
