/* KIIRO Explorer - Consolidated stylesheet (copy icon fixes included) */

:root{
  --bg: #071026;
  --panel: #0b1220;
  --card: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  --muted: #9aa6bf;
  --accent: #2dd4bf;
  --text: #e6f0ff;
  --glass: rgba(255,255,255,0.03);
  --table-row-alt: rgba(255,255,255,0.01);
  --table-border: rgba(255,255,255,0.03);
  --copy-btn-bg: rgba(255,255,255,0.02);
  --copy-btn-border: rgba(255,255,255,0.04);
  --success: #16a34a;
}

/* Basic reset */
* { box-sizing: border-box; }
html,body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  background: linear-gradient(180deg, #071026 0%, #07182b 100%);
  color: var(--text);
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  padding: 28px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.04);
  padding: 18px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(2,6,23,0.6);
}

/* Header */
.site-header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.brand { display:flex; align-items:center; gap:12px; }
.site-logo {
  width:56px;
  height:56px;
  border-radius:10px;
  background: var(--glass);
  padding:6px;
  object-fit:contain;
  border: 1px solid rgba(255,255,255,0.04);
}
.title-wrap { line-height:1; }
.site-title {
  margin:0;
  font-size:20px;
  font-weight:700;
  color:var(--text);
  letter-spacing:0.4px;
}

/* Top controls */
.controls-top { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; gap:12px; }
.search-wrap { display:flex; gap:8px; align-items:center; width:100%; }
.search-input {
  background: rgba(255,255,255,0.02);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.03);
  padding:8px 10px;
  border-radius:8px;
  min-width:360px;
  flex: 1 1 auto;
}
.btn {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015));
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.04);
  padding:8px 10px;
  border-radius:8px;
  cursor:pointer;
}
.btn-ghost {
  background: transparent;
  border: 1px dashed rgba(255,255,255,0.03);
}

/* Table */
.table-wrap {
  overflow:auto;
  border-radius:10px;
  border: 1px solid rgba(255,255,255,0.04);
  margin-top:6px;
}
table { width:100%; border-collapse:collapse; min-width:700px; }
thead th {
  text-align:left;
  padding:12px;
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, rgba(6,10,20,0.7), rgba(6,10,20,0.5));
  color: var(--muted);
  font-size:12px;
  border-bottom: 1px solid var(--table-border);
}
tbody td {
  padding:12px;
  border-bottom: 1px solid rgba(255,255,255,0.02);
  vertical-align: top;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Roboto Mono", monospace;
  font-size:13px;
  color: var(--text);
  background: transparent;
}
tbody tr:nth-child(even) td { background: var(--table-row-alt); }

/* Clickable rows */
tbody tr.row-clickable { cursor: pointer; }
tbody tr.row-clickable:hover td { background: rgba(45,212,191,0.03); }

/* helpers */
.no-wrap { white-space: nowrap; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(2,6,23,0.7);
  z-index: 1200;
}
.modal-overlay.open { display:flex; }
.modal {
  width: min(1000px, 96%);
  max-height: 86vh;
  overflow: auto;
  background: linear-gradient(180deg, #0b1220, #071026);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.04);
  box-shadow: 0 12px 60px rgba(2,6,23,0.7);
  padding: 12px;
  transform: translateY(-8px);
  opacity: 0;
  transition: transform 200ms ease, opacity 160ms ease;
}
.modal.open { transform: translateY(0); opacity: 1; }
.modal-header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  padding-bottom:8px;
  margin-bottom:8px;
}
.modal-title { margin:0; font-size:16px; color:var(--text); }
.modal-close { background:transparent; border:none; color:var(--muted); font-size:18px; cursor:pointer; }
.modal-body { padding:6px 2px 12px 2px; color:var(--text); }
.modal-footer { display:flex; justify-content:flex-end; padding-top:8px; border-top:1px solid rgba(255,255,255,0.02); margin-top:8px; }

/* Targets inner table */
.targets-table { width:100%; border-collapse:collapse; margin-top:6px; }
.targets-table thead th {
  text-align:left;
  padding:10px;
  background: linear-gradient(180deg, rgba(6,10,20,0.7), rgba(6,10,20,0.5));
  color: var(--muted);
  font-size:12px;
  border-bottom: 1px solid var(--table-border);
}
.targets-table th, .targets-table td {
  padding:10px;
  border-bottom: 1px solid rgba(255,255,255,0.02);
  text-align:left;
  font-family:monospace;
  font-size:13px;
  color:var(--text);
}
.targets-table tbody tr:nth-child(even) td { background: var(--table-row-alt); }

/* Copy button (icon) */
.copy-btn {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  margin-left:8px;
  padding:6px;
  width:32px;
  height:28px;
  font-size:12px;
  border-radius:6px;
  border:1px solid var(--copy-btn-border);
  background: var(--copy-btn-bg);
  color: var(--text);
  cursor: pointer;
  vertical-align: middle;
}
.copy-btn svg { width:14px; height:14px; fill: var(--muted); display:block; }
.copy-btn:hover svg { fill: var(--text); }
.copy-bubble {
  display:inline-block;
  margin-left:8px;
  padding:4px 8px;
  border-radius:6px;
  background: var(--success);
  color:white;
  font-size:12px;
  opacity:0;
  transform: translateY(-6px);
  transition: opacity 160ms ease, transform 180ms ease;
  vertical-align: middle;
}
.copy-bubble.show { opacity:1; transform: translateY(0); }

/* Bottom controls */
.controls-bottom {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-top:12px;
}
.rows-per label { font-size:13px; color:var(--muted); }
.pager { display:flex; gap:8px; align-items:center; color:var(--muted); }
.page-input { width:72px; padding:6px 8px; border-radius:6px; border:1px solid rgba(255,255,255,0.03); background:transparent; color:var(--text); }

/* Info and footer */
.info { margin-top:10px; color:var(--muted); font-size:13px; }
.site-footer { margin-top:14px; border-top:1px solid rgba(255,255,255,0.02); padding-top:12px; color:var(--muted); font-size:13px; text-align:center; }

/* Responsive rules */
@media (max-width: 900px) {
  .container { padding: 14px; }
  .site-logo { width:46px; height:46px; padding:5px; }
  .site-title { font-size:18px; }
  .search-input { min-width: 180px; padding:7px 8px; }
  .btn { padding:7px 8px; font-size:14px; }
  thead th { padding:10px; font-size:11px; }
  tbody td { padding:10px; font-size:13px; }
  .modal { width: 96%; padding:10px; }
  .modal-title { font-size:15px; }
  .targets-table th, .targets-table td { padding:8px; font-size:13px; }
}

@media (max-width: 600px) {
  body { padding: 14px; }
  .container { border-radius:10px; padding:12px; }
  .site-logo { width:40px; height:40px; }
  .site-title { font-size:16px; }
  .search-input { min-width: 120px; padding:6px 8px; font-size:14px; }
  .btn { padding:6px 8px; font-size:13px; border-radius:6px; }
  thead th { padding:8px; font-size:11px; }
  tbody td { padding:8px; font-size:12px; }
  table { min-width: 100%; }

  /* Hide block_time_iso and request_time_iso columns on mobile */
  thead th:nth-child(4), tbody td:nth-child(4),
  thead th:nth-child(5), tbody td:nth-child(5) { display: none; }

  .controls-bottom { display:flex; flex-direction:column; gap:8px; align-items:stretch; }
  .pager { justify-content:flex-start; flex-wrap:wrap; gap:6px; }
  .rows-per { text-align:right; align-self:flex-end; }

  /* Modal becomes full-screen sheet and slides up */
  .modal {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    box-shadow: none;
    padding: 12px;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 280ms cubic-bezier(.22,.9,.3,1), opacity 180ms ease;
    opacity: 0;
  }
  .modal.open { transform: translateY(0); opacity: 1; }
  .modal-body { overflow:auto; padding: 8px 0; }
  .modal-footer { border-top: none; margin-top: 8px; padding-top: 8px; }
  .modal-header { padding-bottom:6px; margin-bottom:6px; }
  .modal-close { font-size:20px; }
  .copy-btn { padding:5px; width:32px; height:28px; }
  .copy-bubble { font-size:12px; padding:4px 6px; }
}

@media (max-width: 420px) {
  .site-title { font-size:14px; }
  .search-input { font-size:13px; }
  .btn { font-size:13px; padding:6px 7px; }
  thead th { font-size:11px; padding:7px; }
  tbody td { font-size:12px; padding:7px; }
  .page-input { width:56px; padding:6px 6px; }
  .targets-table th, .targets-table td { padding:6px; font-size:12px; }
}

/* JSON-like cell */
.json-cell { white-space: pre-wrap; font-family: ui-monospace, monospace; font-size:13px; background: rgba(255,255,255,0.01); padding:6px; border-radius:6px; border:1px solid rgba(255,255,255,0.02); color:var(--text); }