/* composites.css */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a1a;
  min-height: 100vh;
}

/* ── Header ── */
header {
  background: #1a1a2e;
  color: white;
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.back-btn {
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.15s;
  flex-shrink: 0;
}
.back-btn:hover { color: white; }

header h1 {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.header-auth {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  font-size: 0.82rem;
}
.header-auth-email {
  color: rgba(255,255,255,0.7);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.header-auth a, .header-auth button {
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}
.header-auth a:hover, .header-auth button:hover { background: rgba(255,255,255,0.22); }

/* ── Layout ── */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Card ── */
.card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 8px rgba(0,0,0,0.04);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}

.card-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #888;
  margin-bottom: 1.25rem;
  font-weight: 600;
}

/* ── Chart color accents ── */
.comp-color-1 { color: #8b0000; }
.comp-color-2 { color: #1a1a2e; }

/* ── Selectors ── */
.comp-selectors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.comp-selector-col {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.comp-selector-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid #d5d5d5;
  border-radius: 5px;
  font-size: 0.9rem;
  color: #1a1a1a;
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: auto;
  -webkit-appearance: auto;
}
select:focus {
  outline: none;
  border-color: #4a6fa5;
  box-shadow: 0 0 0 3px rgba(74,111,165,0.14);
}

/* ── Find toolbar ── */
.find-toolbar {
  border-top: 1px solid #ececec;
  padding-top: 1rem;
  margin-top: 0.25rem;
}

.find-toolbar-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #888;
  margin-bottom: 0.6rem;
}

.find-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.find-btn {
  background: #f5f7fa;
  border: 1px solid #dde0e8;
  border-radius: 4px;
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  color: #444;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s, color 0.14s;
  white-space: nowrap;
}
.find-btn:hover   { background: #eaeef5; border-color: #4a6fa5; color: #1a1a2e; }
.find-btn.active  { background: #1a1a2e; border-color: #1a1a2e; color: #fff; }
.find-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.find-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.find-mode-label {
  font-size: 0.78rem;
  color: #555;
  font-style: italic;
}

.find-nav-btns {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.find-nav-btns button {
  background: #f5f7fa;
  border: 1px solid #dde0e8;
  border-radius: 4px;
  padding: 0.3rem 0.65rem;
  font-size: 0.82rem;
  cursor: pointer;
  color: #333;
  transition: background 0.14s;
}
.find-nav-btns button:hover { background: #eaeef5; }

#findCounter {
  font-size: 0.82rem;
  color: #555;
  min-width: 3.5ch;
  text-align: center;
}

/* ── Status ── */
#compStatus {
  font-size: 0.85rem;
  color: #888;
  text-align: center;
  padding: 1rem 0;
  display: none;
}
#compStatus.active { display: block; }

/* ── 3-Bodygraph grid ── */
.comp-graphs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.comp-graph-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 8px rgba(0,0,0,0.04);
  padding: 1rem 0.75rem 0.75rem;
}

.comp-graph-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #888;
  font-weight: 600;
  margin-bottom: 0.65rem;
  text-align: center;
}
.comp-graph-label.comp-color-1 { color: #8b0000; }
.comp-graph-label.comp-color-2 { color: #1a1a2e; }

#bg1 svg, #bg2 svg, #bgCombined svg {
  width: 100%;
  height: auto;
  display: block;
}

/* ── Planet tables (below bodygraphs) ── */
.comp-planet-table-wrap {
  width: 100%;
  margin-top: 0.6rem;
}

.comp-planet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.comp-planet-table th {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #aaa;
  font-weight: 600;
  padding: 0.2rem 0.3rem;
  border-bottom: 1px solid #eee;
  text-align: center;
}

.comp-planet-table td {
  padding: 0.17rem 0.3rem;
  border-bottom: 1px solid #f5f5f5;
  vertical-align: middle;
  text-align: center;
}

.comp-pt-planet { text-align: left !important; }
.comp-pt-sym { width: 1.3rem; height: 1.3rem; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; }
.comp-pt-sym svg { display: block; }
.comp-pt-gate { font-family: 'SF Mono', 'Consolas', 'Menlo', monospace; font-weight: 600; white-space: nowrap; }
.comp-pt-gate-p   { color: #1a1a2e; }
.comp-pt-gate-d   { color: #8b0000; }
.comp-pt-gate-c2p { color: #1565c0; }
.comp-pt-gate-c2d { color: #2e7d32; }
.comp-pt-dot    { color: #bbb; }
.comp-pt-retro  { font-size: 0.65rem; color: #999; margin-left: 0.1rem; }

.ed-mark      { font-size: 0.65rem; font-weight: 700; margin-left: 0.1rem; }
.ed-exalted   { color: #2e7d32; }
.ed-detriment { color: #c75000; }

.pt-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  border-radius: 3px;
  padding: 0.12rem 0.38rem;
  letter-spacing: 0.04em;
}
.pt-badge-p   { background: #1a1a2e; color: #fff; }
.pt-badge-d   { background: #8b0000; color: #fff; }
.pt-badge-c2p { background: #1565c0; color: #fff; }
.pt-badge-c2d { background: #2e7d32; color: #fff; }

/* ── Results summary ── */
.comp-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #ececec;
}

.comp-overview-item {
  text-align: center;
}

.comp-overview-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #aaa;
  margin-bottom: 0.25rem;
}

.comp-overview-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1a1a1a;
}

/* ── Result sections ── */
.comp-section {
  margin-bottom: 1.25rem;
}
.comp-section:last-child { margin-bottom: 0; }

.comp-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #aaa;
  margin-bottom: 0.5rem;
}

.comp-count {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  background: #f0f2f5;
  border-radius: 3px;
  padding: 0.1rem 0.45rem;
  margin-left: 0.4rem;
  color: #555;
}

/* ── Channel chips ── */
.channel-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  border-radius: 3px;
  padding: 0.05rem 0.2rem;
  font-size: 0.82rem;
  color: #666;
  transition: background 0.12s, color 0.12s;
}
.channel-chip:hover { background: #eef2fa; color: #4a6fa5; }
.channel-sep { color: #ccc; margin: 0 0.1rem; }

.center-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Gate chips ── */
.gate-chip {
  display: inline-block;
  font-size: 0.82rem;
  background: #f5f7fa;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  padding: 0.1rem 0.45rem;
  margin: 0.1rem;
  color: #555;
}

/* ── Lock Overlay ── */
#lockOverlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(240,242,245,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lock-card {
  background: white;
  border-radius: 12px;
  padding: 2.5rem 2rem;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
  max-width: 420px;
  width: 90%;
}
.lock-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.lock-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; color: #1a1a2e; }
.lock-body  { font-size: 0.88rem; color: #555; margin-bottom: 1.5rem; line-height: 1.6; }

.lock-btn-sub {
  display: inline-block;
  background: #2e7d32;
  color: white;
  padding: 0.65rem 1.75rem;
  border-radius: 5px;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
}
.lock-hint { margin-top: 0.85rem; font-size: 0.82rem; color: #aaa; }

/* ── Responsive ── */
@media (max-width: 900px) {
  header { padding: 0.9rem 1.25rem; }
  .header-auth-email { display: none; }
}

@media (max-width: 700px) {
  .comp-graphs { grid-template-columns: 1fr; }
  .comp-graph-col { max-width: 280px; width: 100%; margin: 0 auto; }
  .comp-overview { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 540px) {
  .comp-selectors { grid-template-columns: 1fr; }
  .comp-overview { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  header { padding: 0.7rem 1rem; }
  main   { padding: 1.25rem 1rem; }
  .card  { padding: 1.25rem; }
}
