/* =========================
   Theme tokens
   ========================= */
:root {
  --bg: #ffffff;
  --fg: #111;
  --search: #fff;
  --link: #000;
  --stroke: #E6E6E6;
  --muted: #8F8F8F;
  --border: #D0D0D0;
  --ring: #2AC9A3;
  --shadow: rgba(0,0,0,0.06);
  --gray: #71717A;
  --btn-dark-bg: #111827;
  --btn-light-bg: #ECECEC;
  --btn-dark-fg: #f9fafb;
  --btn-light-fg: #0D0D0D;  
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #212121;
    --fg: #ffffff;
    --link: #fff;
    --stroke: #3C3C3C;
    --search: #303030;
    --muted: #AFAFAF;
    --border: #3C3C3C;
    --shadow: rgba(0,0,0,0.4);
    --btn-dark-bg: #424242;
    --btn-light-bg: #424242;
    --btn-dark-fg: #e5e7eb;
    --btn-light-fg: #fff;  
  }
}

/* =========================
   Fonts
   ========================= */

@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/JetBrainsMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system,
               Segoe UI, Roboto, Helvetica, Arial,
               Apple Color Emoji, Segoe UI Emoji;
  font-weight: 400;
}

/* =========================
   Header
   ========================= */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 0;
  backdrop-filter: saturate(1.2) blur(4px);
}

.logo { color: var(--fg); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-link {
  color: var(--fg);
  text-decoration: none;
  opacity: .8;
  display: inline-flex;
  align-items: center;
}
.nav-link:hover { opacity: 1; }

.nav-links:has(#accountChip:not([hidden])) #connectBtn { display: none; }
#accountChip[hidden] { display: none !important; }
#connectBtn[hidden] { display: none !important; }

/* =========================
   Buttons
   ========================= */
.btn {
  border: 1px solid var(--border);
  background: var(--btn-light-bg);
  color: #111;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.btn:focus {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.btn-dark {
  background: var(--btn-dark-bg);
  color: var(--btn-dark-fg);
  border-color: #000;
}

/* =========================
   Wallet chip
   ========================= */
.account-chip { position: relative; }

.chip-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  color: #27272A;
  border: 1px solid #E4E4E7;
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo,
               Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
}
.chip-btn:focus {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
.chip-btn .icon { display: inline-flex; width: 20px; height: 20px; }
.chip-btn .icon img { width: 20px; height: 20px; }

/* =========================
   Chip menu
   ========================= */
.menu {
  position: absolute;
  right: 0;
  margin-top: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 20px var(--shadow);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 180px;
  z-index: 10;
}
.menu > button {
  background: none;
  border: 0;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  color: var(--fg);
  border-radius: 8px;
}
.menu > button:hover { background: rgba(128,128,128,0.12); }

.menu-card {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 280px;
}

.menu-title { font-size: 12px; color: var(--muted); }
.menu-identity { display: flex; align-items: center; gap: 12px; }
.menu-identity .avatar { display: none; }
.menu-identity .id-block { display: flex; flex-direction: column; }

.menu-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}
.menu-actions #disconnectBtn.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #27272A;
  color: #FFFFFF;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 500;
}
.menu-actions #disconnectBtn .icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
}
.menu-actions #disconnectBtn .icon img {
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1);
}

.menu-close {
  position: absolute;
  right: 10px;
  top: 8px;
  border: 0;
  background: none;
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
}

.menu[hidden] { display: none; }

/* =========================
   Layout
   ========================= */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 48px 20px;
}

.hero {
  padding: 40px 0 16px;
  text-align: center; /* centers text + inline elements */
}

.search {
  max-width: 768px;   /* your updated width */
  margin: 0 auto;     /* center the block itself */
}
.hero h1 {
  font-size: 36px;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
  font-family: 'Inter', ui-sans-serif;
  font-weight: 600;
}
.sub {
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 18px;
}

/* =========================
   Search
   ========================= */
.search {
  max-width: 768px;
  margin: 48px auto 0; /* top margin 32px, center horizontally */
}

.search-input {
  display: flex;
  align-items: center;
  gap: 10px;

  background: var(--search);
  border: 1px solid var(--border);     /* uniform 1px stroke */
  border-radius: 24px;

  padding: 14px 18px;

  box-shadow: 0 2px 4px rgba(0,0,0,0.04);  /* lighter, softer shadow */
}

.search-input:focus-within {
  border-color: var(--ring);         /* purple focus border */
box-shadow: 0 0 0 2px rgba(42, 201, 163, 0.35);
}


.search-input input::placeholder {
  color: var(--muted);                    /* muted gray placeholder */
}

.search-icon img,
#submitBtn img {
  display: block;        /* removes baseline alignment issues */
  width: 18px;           /* tweak size if needed */
  height: 18px;
}
.search-input input {
  flex: 1;
  font-size: 18px;
  border: 0;
  background: transparent;
  outline: 0;
  color: var(--fg);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo,
               Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.submit-btn {
  margin-left: auto;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 0;
  background: #ECECEC;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.submit-btn:disabled { opacity: .5; cursor: not-allowed; }
.submit-btn img { width: 22px; height: 22px; }

.icon-btn {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
}

.help {
  color: #F87171;
  font-size: 14px;
  min-height: 20px;
  padding: 6px 18px;
  text-align: left;
}

/* =========================
   Results table
   ========================= */
.table-wrap {
  margin-top: 28px;
  border: 0;
  border-radius: 14px;
  overflow: hidden;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}
.results-table thead {
  border-bottom: 1px solid var(--stroke);
}
.results-table thead th {
  font-weight: 500;
  color: var(--muted);
  text-align: left;
  background: transparent;
  padding: 14px 16px;
}
.results-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--stroke);
}
.results-table thead th:last-child {
  text-align: center;
}
.results-table tbody td:last-child button{
  float: right;
}


.sortable { cursor: pointer; user-select: none; }
.sort-caret { opacity: .5; margin-left: 4px; }

/* Status content styling (inner span) */
.status-content {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  font-size: 14px;
}

tr.status .icon { width: 20px; height: 20px;}

/* Status classes applied to tr elements */
tr.status.not-detected .status-content {
  background: transparent;
  color: var(--gray);
}
tr.status.not-detected .icon { 
  -webkit-mask: url('assets/neutral.svg') no-repeat center / contain;
          mask: url('assets/neutral.svg') no-repeat center / contain;
  background: var(--gray);
}

tr.status.not-supported .status-content {
  background: transparent;
  color: var(--gray);
}
tr.status.not-supported .icon {
  -webkit-mask: url('assets/unavailable.svg') no-repeat center / contain;
          mask: url('assets/unavailable.svg') no-repeat center / contain;
  background: var(--gray);
}

tr.status.checking .status-content {
  background: rgba(156,163,175,0.12);
  color: var(--muted);
}
tr.status .spinner {
  width: 10px;
  height: 10px;
  border: 2px solid var(--muted);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* =========================
   Action button
   ========================= */
.action-btn {
  background: var(--btn-light-bg);
  color: var(--btn-light-fg);
  border: 1px solid var(--btn-light-bg);
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.action-btn:disabled { opacity: .5; cursor: not-allowed; }

/* =========================
   Modals
   ========================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--bg);
  color: var(--fg);
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 40px var(--shadow);
  max-width: 520px;
  width: 92%;
  padding: 18px;
}
.modal h2 { margin: 4px 0 10px; }
.modal .actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}
.modal .btn-secondary { background: #f3f4f6; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* =========================
   Footer
   ========================= */
.site-footer {
  max-width: 1000px;
  margin: 24px auto 40px;
  padding: 0 20px;
  text-align: center;   /* centers the footer text */
  font-weight: 300;     /* Regular weight */
}
.updated-at {
  color: var(--muted);
  font-size: 13px;
}

/* =========================
   Address typography
   ========================= */
.chip-addr,
#menuAddrShort,
.addr {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo,
               Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-feature-settings: "zero" 1, "ss01" 1;
}

.btn-dark#connectBtn,
#connectBtn.btn-dark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--btn-dark-bg);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 500;
}
#connectBtn .icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
}
#connectBtn .icon img {
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1);
}

/* =========================
   Chain cell
   ========================= */
.chain-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chain-cell img { width: 20px; height: 20px; }

/* =========================
   Delegation detected styling
   ========================= */
.delegation-detected {
  display: inline-flex;
  align-items: center;
  font-weight: 500;
  gap: 6px;
}

/* =========================
   External link helper
   ========================= */
a.external {
  display: inline-flex;
  align-items: center;
  color: var(--link);            /* brand teal */
  text-decoration: underline;     /* optional: remove underline */
}

a.external:hover {
  color: var(--link);            /* darker teal on hover */
  text-decoration: underline; /* optional: show underline */
}
.site-footer a {
  color: var(--link);              /* black text */
  text-decoration: underline;
}

.site-footer a:hover {
  color: var(--link);              /* stay black on hover */
  text-decoration: underline;
}
a {
  color: var(--link);               /* black */
  text-decoration: underline;     /* optional: remove underline */
}

a:hover {
  color: var(--link);              /* stay black on hover */
  text-decoration: underline; /* optional: underline only on hover */
}

/* Hide all hint blocks everywhere */
.hint,
div.hint {
  display: none !important;
}
/* Language switcher icon that adapts to theme */
.lang-icon{
  width:20px; height:20px; display:inline-block;
  vertical-align:middle; margin-right:6px;

  /* paint the SVG with current theme color */
  background-color: var(--fg);
  -webkit-mask: url('assets/lang-switcher.svg') no-repeat center / contain;
          mask: url('assets/lang-switcher.svg') no-repeat center / contain;
}
/* Delegate/category icon that follows theme */
.meta-icon{
  width:20px; height:20px; display:inline-block;
  vertical-align:middle; opacity:.85;

  background-color: var(--fg);          /* theme-aware color */
  -webkit-mask: var(--icon-url) no-repeat center / contain;
          mask: var(--icon-url) no-repeat center / contain;
}
/* Theme-aware, monochrome chain icon */
.chain-icon{
  width: 24px;
  height: 24px;
  display: inline-block;
  vertical-align: middle;

  /* paint the SVG with theme color */
  background-color: var(--fg);

  /* use the file as a mask */
  -webkit-mask: var(--icon-url) no-repeat center / contain;
          mask: var(--icon-url) no-repeat center / contain;
}

/* Optional: make icons subtler */
/* .chain-icon { background-color: var(--muted); } */  /* ✅ use this instead */
.external-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  vertical-align: middle;

  /* paint with theme color */
  background-color: var(--fg);

  /* use the external-link.svg as a mask */
  -webkit-mask: url("assets/external-link.svg") no-repeat center / contain;
  mask: url("assets/external-link.svg") no-repeat center / contain;
}
/* Wrapper */
.logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

/* Theme-aware Curvegrid logo */
.logo-mark {
  width: 140px;   /* match the old img width */
  height: 24px;   /* match the old img height */
  background-color: var(--fg);

  /* use the SVG file as a mask */
  -webkit-mask: url("assets/curvegrid.svg") no-repeat center / contain;
          mask: url("assets/curvegrid.svg") no-repeat center / contain;
}
/* =========================
   Mobile Styles
   ========================= */
@media (max-width: 768px) {
  /* Language switcher - show only icon on mobile */
  #langSwitch {
    font-size: 0; /* Hide text content */
  }
  
  #langSwitch .lang-icon {
    font-size: 1rem; /* Restore icon size */
  }

  /* =========================
     Container and Layout Adjustments
     ========================= */
  .container {
    padding: 1rem;
  }
  
  .table-wrap {
    border-radius: 0;
    border: none;
    overflow: visible;
  }

  /* =========================
     Table to Cards Transformation
     ========================= */
  .results-table {
    display: block;
  }
  
  
  .results-table thead, .results-table tbody {
    display: block;
  }
  .results-table thead tr {
    display: flex;
    justify-content: space-between;
  }
  .results-table thead th:last-child {
    display: none; /* Hide table headers on mobile */
  }
  
  .results-table tbody tr {
    display: block;
    padding: 10px 6px;
    border-bottom: 1px solid var(--stroke);
  }
  
  .results-table tr:last-child {
    border-bottom: none;
  }
  
  /* First two columns (Chain and Status) on same line */
  .results-table td:nth-child(1),
  .results-table td:nth-child(2) {
    display: inline-flex;
    align-items: center;
    border: none;
    padding: 0.5rem 0;
    margin-right: 1rem;
  }
  
  .results-table td:nth-child(2) {
    margin-right: 0;
    float: right;
  }
  
  /* Actions column on separate line, full width */
  .results-table td:last-child {
    display: flex;
    border: none;
    padding: 10px 0 2px;
    justify-content: stretch;
  }

  .meta-icon, tr.status .icon {
    order: 2;
  }

  .results-table .not-detected td:last-child, .results-table .not-supported td:last-child  {
    display: none; 
  }

  
  .results-table td:last-child button {
    width: 100%;
    padding: 12px 16px;
    min-height: 44px; /* Touch-friendly size */
  }
  
  /* No label needed for actions column - it's self-explanatory */
}

/* Make the whole page use flexbox layout */
html, body {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Main content grows to fill space */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Footer stays pushed to bottom */
.site-footer {
  margin-top: auto;
}
