/*
 * Longevity Crosstalk — dark-suite explorer styles (LACA aligned)
 * Works for both the main page and the embeddable longevity-crosstalk-explorer.php
 */

:root {
  --lcx-accent: #ff70c5;
  --lcx-accent-2: #66e2ff;
  --lcx-surface: rgba(18, 6, 42, 0.88);
  --lcx-surface-2: rgba(10, 2, 28, 0.92);
  --lcx-border: rgba(255, 255, 255, 0.12);
  --lcx-border-strong: rgba(255, 255, 255, 0.18);
  --lcx-text: rgba(245, 242, 255, 0.92);
  --lcx-text-muted: rgba(245, 242, 255, 0.62);
  --lcx-text-weak: rgba(245, 242, 255, 0.48);
  --lcx-table-head: #12062a;
  --lcx-radius: 14px;
  --lcx-radius-sm: 10px;
}

.laca-portal.theme-pink {
  --lcx-accent: var(--suite-accent, #ff70c5);
}

/* Shell */
.lcx-shell { margin: 1.25rem 0 2rem; }

/* Toolbar */
.lcx-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
  padding: 0.9rem 1rem;
  background: linear-gradient(180deg, rgba(18, 6, 42, 0.9), rgba(10, 2, 28, 0.92));
  border: 1px solid var(--lcx-border);
  border-radius: var(--lcx-radius);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.03);
}

.lcx-toolbar label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.68rem;
  color: var(--lcx-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.lcx-toolbar select,
.lcx-toolbar input[type="search"] {
  min-height: 40px;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--lcx-border-strong);
  border-radius: var(--lcx-radius-sm);
  background: rgba(5, 0, 15, 0.9);
  color: var(--lcx-text);
  font: 400 0.78rem/1.2 "Azeret Mono", "JetBrains Mono", monospace;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.lcx-toolbar select:hover,
.lcx-toolbar input[type="search"]:hover { border-color: rgba(255, 255, 255, 0.28); }

.lcx-toolbar select:focus,
.lcx-toolbar input[type="search"]:focus {
  border-color: var(--lcx-accent);
  box-shadow: 0 0 0 3px rgba(255, 112, 197, 0.15);
}

.lcx-toolbar input[type="search"] { min-width: 200px; }

/* Legend chips (right after toolbar) */
.lcx-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0 0.25rem;
}
.lcx-chip {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
}
.lcx-chip.sig {
  padding: 0.15rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--lcx-text);
  transition: transform 80ms ease, opacity 120ms ease, box-shadow 120ms ease;
}
.lcx-chip.sig:hover { transform: translateY(-1px); }
.lcx-chip.sig[aria-pressed="true"] {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.14);
}
.lcx-shell[data-sig-filter] .lcx-chip.sig:not([aria-pressed="true"]) {
  opacity: 0.35;
}

/* Status */
.lcx-status {
  margin: 0.75rem 0 0;
  padding: 0.55rem 0.75rem;
  border-radius: var(--lcx-radius-sm);
  background: rgba(10, 2, 28, 0.6);
  color: var(--lcx-text-muted);
  font-size: 0.78rem;
  border: 1px solid var(--lcx-border);
}

/* Network */
.lcx-network {
  margin-top: 0.9rem;
  min-height: 260px;
  border: 1px solid var(--lcx-border);
  border-radius: var(--lcx-radius);
  background: linear-gradient(180deg, rgba(10, 2, 28, 0.6), rgba(5, 0, 15, 0.6));
  padding: 0.6rem;
  overflow: hidden;
}

.lcx-network svg { width: 100%; height: 280px; display: block; }

.lcx-node {
  fill: var(--lcx-accent);
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 1;
  transition: r 120ms ease, filter 120ms ease;
}
.lcx-node:hover { r: 11; filter: drop-shadow(0 0 6px var(--lcx-accent)); }

.lcx-label {
  font-size: 11px;
  fill: var(--lcx-text);
  font-family: "JetBrains Mono", monospace;
  pointer-events: none;
}

.lcx-edge {
  stroke: rgba(255, 112, 197, 0.35);
  stroke-width: 1.5;
  opacity: 0.6;
}

/* Download */
.lcx-download {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.7rem 0 0.4rem;
  padding: 0.35rem 0.55rem;
  color: var(--lcx-accent);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: 8px;
}
.lcx-download:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Table */
.lcx-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.82rem;
  border: 1px solid var(--lcx-border);
  border-radius: var(--lcx-radius);
  overflow: hidden;
  background: rgba(5, 0, 15, 0.6);
}

.lcx-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--lcx-table-head);
  color: var(--lcx-accent);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: 0.7rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--lcx-border-strong);
  text-align: left;
}

.lcx-table tbody td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--lcx-text);
  vertical-align: middle;
}
.lcx-table tbody tr:last-child td { border-bottom: none; }
.lcx-table tbody tr:hover { background: rgba(255, 112, 197, 0.06); }

/* Signal type badges */
.sig {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: var(--lcx-text);
}
.sig-longevity { color: #a5f3fc; border-color: rgba(103, 232, 249, 0.35); background: rgba(103, 232, 249, 0.08); }
.sig-aging     { color: #fda4af; border-color: rgba(251, 113, 133, 0.35); background: rgba(251, 113, 133, 0.08); }
.sig-crosstalk { color: #c4b5fd; border-color: rgba(167, 139, 250, 0.35); background: rgba(167, 139, 250, 0.08); }
.sig-other     { color: var(--lcx-text-muted); }

/* Muted helper */
.lcx-muted { color: var(--lcx-text-weak); font-size: 0.82rem; }

/* Pager */
.lcx-pager {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.82rem;
  flex-wrap: wrap;
  color: var(--lcx-text-muted);
}

.lcx-pager button {
  min-height: 32px;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--lcx-border);
  border-radius: 8px;
  background: rgba(10,2,28,0.7);
  color: var(--lcx-text);
  font: 700 0.78rem/1 "JetBrains Mono", monospace;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}

.lcx-pager button:hover:not(:disabled) {
  border-color: var(--lcx-accent);
  color: #fff;
  background: rgba(255,112,197,0.12);
}

.lcx-pager button:disabled {
  opacity: 0.45;
  cursor: default;
}

.lcx-pager .lcx-pager-info {
  margin: 0 0.5rem;
  color: var(--lcx-text-muted);
}

/* === Legend chips (Signal type quick filters) === */
.lcx-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0 0.25rem;
  align-items: center;
}

.lcx-chip {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
}

.lcx-chip.sig {
  padding: 0.15rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--lcx-text);
  transition: transform 80ms ease, opacity 120ms ease, box-shadow 120ms ease;
}

.lcx-chip.sig:hover {
  transform: translateY(-1px);
}

.lcx-chip.sig[aria-pressed="true"] {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.14);
}

.lcx-shell[data-sig-filter] .lcx-chip.sig:not([aria-pressed="true"]) {
  opacity: 0.35;
}

/* === Mobile & Empty-State Polish (clean single copy) === */

/* 1) Pager: larger tap targets on mobile */
@media (max-width: 720px) {
  .lcx-pager {
    gap: 0.4rem;
    font-size: 0.78rem;
  }
  .lcx-pager button {
    min-height: 40px;
    min-width: 40px;
    padding: 0.35rem 0.7rem;
    font-size: 0.82rem;
    border-radius: 10px;
  }
  .lcx-pager span,
  .lcx-pager .lcx-pager-info {
    width: 100%;
    text-align: center;
    margin: 0.1rem 0;
  }
}

/* 2) Empty state row inside table */
.lcx-empty td {
  padding: 1rem 0.75rem;
  color: var(--lcx-text-weak);
  font-style: italic;
  text-align: center;
  background: rgba(10, 2, 28, 0.4);
}

/* 3) Subtle scroll hint for horizontal overflow */
.lcx-table-wrap {
  position: relative;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* Fade mask on right edge when content overflows (desktop) */
@media (min-width: 721px) {
  .lcx-table-wrap::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 28px;
    pointer-events: none;
    background: linear-gradient(to left, rgba(5,0,15,0.65), transparent);
    opacity: 0;
    transition: opacity 160ms ease;
  }
  .lcx-table-wrap.is-scrollable::after {
    opacity: 1;
  }
}

/* Mobile: stronger visual cue that table can scroll */
@media (max-width: 720px) {
  .lcx-table-wrap {
    border: 1px solid var(--lcx-border);
    border-radius: var(--lcx-radius, 14px);
    background: rgba(5, 0, 15, 0.4);
  }
  .lcx-table-wrap::before {
    content: "← scroll →";
    position: absolute;
    bottom: 4px;
    right: 8px;
    font-size: 10px;
    color: var(--lcx-text-weak);
    opacity: 0.55;
    pointer-events: none;
    z-index: 2;
  }
}


/* Responsive */
@media (max-width: 980px) {
  .lcx-toolbar { gap: 0.5rem; }
  .lcx-toolbar input[type="search"] { min-width: 160px; }
}
@media (max-width: 720px) {
  .lcx-toolbar { flex-direction: column; align-items: stretch; }
  .lcx-toolbar label { width: 100%; }
  .lcx-toolbar select,
  .lcx-toolbar input[type="search"] { width: 100%; }
  .lcx-network svg { height: 240px; }
  .lcx-table { font-size: 0.76rem; }
}

/* Focus + reduced motion */
.lcx-toolbar select:focus-visible,
.lcx-toolbar input:focus-visible,
.lcx-download:focus-visible {
  outline: 2px solid var(--lcx-accent);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .lcx-node,
  .lcx-download,
  .lcx-toolbar select,
  .lcx-toolbar input { transition: none !important; }
}
