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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0a0a1a;
  color: #e0e0e0;
  overflow: hidden;
}

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10, 10, 26, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, #00d4ff, #7b2ff7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.bmc-header-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #ffdd00;
  text-decoration: none;
  font-size: 0.75rem;
  opacity: 0.7;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.bmc-header-link:hover {
  opacity: 1;
}

.bmc-icon {
  width: 18px;
  height: 18px;
}

.header nav {
  display: flex;
  gap: 16px;
}

.header nav a {
  color: #aaa;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.header nav a:hover {
  color: #fff;
}

/* Category bar with scroll indicators */
.category-bar-wrapper {
  position: fixed;
  top: 52px;
  left: 0;
  right: 0;
  z-index: 99;
}

.category-bar {
  background: rgba(10, 10, 26, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 8px 16px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.category-bar::-webkit-scrollbar {
  height: 4px;
}

.category-bar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
}

.scroll-fade {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40px;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.scroll-fade.visible {
  opacity: 1;
}

.scroll-fade-left {
  left: 0;
  background: linear-gradient(to right, rgba(10, 10, 26, 0.95), transparent);
}

.scroll-fade-right {
  right: 0;
  background: linear-gradient(to left, rgba(10, 10, 26, 0.95), transparent);
}

.category-tab {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: #aaa;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.category-tab:hover {
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.category-tab.active {
  background: rgba(0, 212, 255, 0.15);
  border-color: #00d4ff;
  color: #00d4ff;
}

/* Canvas */
#bouncer-canvas {
  display: block;
  cursor: default;
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  top: 92px;
  left: 0;
  right: 0;
  bottom: 40px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0a0a1a;
  transition: opacity 0.4s;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #00d4ff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  margin-top: 14px;
  font-size: 0.9rem;
  color: #666;
}

/* Tooltip (desktop hover) */
.tooltip {
  position: fixed;
  z-index: 200;
  background: rgba(20, 20, 40, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 10px 14px;
  pointer-events: none;
  max-width: 300px;
  opacity: 0;
  transition: opacity 0.15s;
  backdrop-filter: blur(10px);
}

.tooltip.visible {
  opacity: 1;
}

.tooltip .tt-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
  margin-bottom: 4px;
}

.tooltip .tt-desc {
  font-size: 0.8rem;
  color: #aaa;
  line-height: 1.3;
}

.tooltip .tt-meta {
  font-size: 0.7rem;
  color: #666;
  margin-top: 6px;
}

/* Detail panel (click an icon) */
.detail-panel {
  position: fixed;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 150;
  background: rgba(20, 20, 40, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 20px 24px;
  width: 380px;
  max-width: 90vw;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  backdrop-filter: blur(12px);
}

.detail-panel.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.dp-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.dp-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
  flex: 1;
}

.dp-close {
  background: none;
  border: none;
  color: #666;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0 0 0 12px;
  line-height: 1;
}

.dp-close:hover {
  color: #fff;
}

.dp-desc {
  font-size: 0.85rem;
  color: #aaa;
  line-height: 1.4;
  margin-bottom: 12px;
}

.dp-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.dp-extras {
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
  color: #666;
  margin-bottom: 16px;
}

.dp-status {
  font-size: 0.75rem;
  padding: 2px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
}

.dp-status.alive { background: rgba(76, 175, 80, 0.15); color: #4caf50; }
.dp-status.dead { background: rgba(244, 67, 54, 0.15); color: #f44336; }
.dp-status.unknown { background: rgba(255, 255, 255, 0.08); color: #888; }

.dp-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: contain;
  flex-shrink: 0;
}

.dp-header {
  gap: 12px;
}

.dp-actions {
  display: flex;
  gap: 8px;
}

.dp-actions .btn {
  font-size: 0.85rem;
  text-decoration: none;
  text-align: center;
}

/* Stats bar */
.stats-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10, 10, 26, 0.9);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #666;
}

.stats-bar .stats-left {
  display: flex;
  gap: 20px;
}

.stats-bar .stat-value {
  color: #00d4ff;
  font-weight: 600;
}

.bmc-link {
  color: #ffdd00;
  text-decoration: none;
  font-size: 0.8rem;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.bmc-link:hover {
  opacity: 1;
}

/* Search page styles */
.search-page {
  overflow: auto;
  min-height: 100vh;
}

.search-page .header {
  position: sticky;
}

.search-container {
  max-width: 1200px;
  margin: 80px auto 40px;
  padding: 0 24px;
}

.search-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.search-controls input,
.search-controls select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #e0e0e0;
  padding: 10px 16px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-controls input:focus,
.search-controls select:focus {
  border-color: #00d4ff;
}

.search-controls input {
  flex: 1;
  min-width: 200px;
}

.search-controls select {
  min-width: 160px;
}

/* API table */
.api-table {
  width: 100%;
  border-collapse: collapse;
}

.api-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.api-table td {
  padding: 12px;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.api-table tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.api-table a {
  color: #00d4ff;
  text-decoration: none;
}

.api-table a:hover {
  text-decoration: underline;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

.status-dot.alive { background: #4caf50; }
.status-dot.dead { background: #f44336; }
.status-dot.unknown { background: #666; }

/* Table header with info icon */
.th-inner {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.info-btn {
  position: relative;
  color: #555;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.2s;
  display: inline-flex;
  text-transform: none;
}

.info-btn:hover {
  color: #00d4ff;
}

.info-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 20, 40, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.8rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #ccc;
  line-height: 1.4;
  width: 220px;
  white-space: normal;
  z-index: 200;
  pointer-events: auto;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.08);
  color: #aaa;
}

.badge.auth-apikey { background: rgba(255, 193, 7, 0.15); color: #ffc107; }
.badge.auth-oauth { background: rgba(156, 39, 176, 0.15); color: #ce93d8; }

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  padding-bottom: 24px;
}

.pagination button {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #aaa;
  padding: 8px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
  border-color: #00d4ff;
  color: #00d4ff;
}

.pagination button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pagination .page-info {
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  color: #666;
}

/* Report modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: #1a1a2e;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
}

.modal h3 {
  font-size: 1.1rem;
  margin-bottom: 16px;
}

.modal label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  cursor: pointer;
  font-size: 0.9rem;
  color: #ccc;
}

.modal textarea {
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 0.85rem;
  resize: vertical;
  min-height: 60px;
  outline: none;
}

.modal textarea:focus {
  border-color: #00d4ff;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  justify-content: flex-end;
}

.btn {
  padding: 8px 18px;
  border-radius: 6px;
  border: none;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: #00d4ff;
  color: #0a0a1a;
  font-weight: 600;
}

.btn-primary:hover {
  background: #33ddff;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #aaa;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-danger {
  background: rgba(244, 67, 54, 0.15);
  color: #f44336;
}

.btn-danger:hover {
  background: rgba(244, 67, 54, 0.25);
}

/* Admin page */
.admin-container {
  max-width: 900px;
  margin: 80px auto 40px;
  padding: 0 24px;
}

.flagged-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}

.flagged-card h3 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.flagged-card .report-list {
  margin: 12px 0;
  font-size: 0.8rem;
  color: #999;
}

.flagged-card .report-item {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.flagged-card .actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* Search page layout */
.search-layout {
  display: flex;
  gap: 24px;
}

.search-main {
  flex: 1;
  min-width: 0;
}

/* Ad placements — hidden until AdSense approved */
.ad-banner {
  display: none;
}

.ad-banner.has-ad {
  display: block;
  position: fixed;
  top: 92px;
  left: 0;
  right: 0;
  z-index: 98;
  background: rgba(10, 10, 26, 0.95);
  text-align: center;
  padding: 4px 0;
  max-height: 100px;
  overflow: hidden;
}

.ad-detail {
  display: none;
}

.ad-detail:has(ins[data-ad-status="filled"]) {
  display: block;
  margin-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 10px;
}

.ad-cell {
  padding: 0 !important;
}

.ad-row {
  display: none;
}

.ad-row:has(ins[data-ad-status="filled"]) {
  display: table-row;
}

.ad-row:has(ins[data-ad-status="filled"]) .ad-cell {
  padding: 8px 12px !important;
  background: rgba(255, 255, 255, 0.01);
}

.ad-row:hover {
  background: transparent !important;
}

.search-sidebar {
  width: 200px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  align-self: flex-start;
  display: none;
}

.search-sidebar.has-ad {
  display: block;
}

.sidebar-ad {
  min-height: 250px;
}

/* Mobile responsive */
@media (min-width: 1024px) {
  .search-sidebar.has-ad {
    display: block;
  }
}

@media (max-width: 768px) {
  .header {
    padding: 10px 16px;
  }

  .header h1 {
    font-size: 1.1rem;
  }

  .header nav {
    gap: 12px;
  }

  .header nav a {
    font-size: 0.8rem;
  }

  .tooltip {
    display: none;
  }

  .detail-panel {
    bottom: 50px;
    width: 95vw;
    padding: 16px;
  }

  .search-controls {
    flex-direction: column;
  }

  .api-table th:nth-child(2),
  .api-table td:nth-child(2) {
    display: none;
  }

  .stats-bar {
    padding: 8px 16px;
    font-size: 0.75rem;
  }

  .bmc-header-link {
    display: none;
  }

  .ad-banner {
    max-height: 60px;
  }
}

@media (hover: none) {
  .tooltip {
    display: none;
  }
}
