/* transit-return.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;
}

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

/* ── Layout ── */
main {
  max-width: 1000px;
  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;
}

/* ── Form ── */
.field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: #444;
  margin-bottom: 0.35rem;
}

select, input[type="date"] {
  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, input[type="date"]:focus {
  outline: none;
  border-color: #4a6fa5;
  box-shadow: 0 0 0 3px rgba(74,111,165,0.14);
}

#chartSelect {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: end;
}

#calcBtn {
  background: #4a6fa5;
  color: white;
  border: none;
  padding: 0.55rem 1.25rem;
  border-radius: 5px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
#calcBtn:hover  { background: #3a5a8a; }
#calcBtn:disabled { background: #aaa; cursor: default; }

#fromDateField {
  margin-top: 0.75rem;
}

#calcStatus {
  margin-top: 0.75rem;
  font-size: 0.84rem;
  color: #555;
  min-height: 1.2em;
}
#calcStatus.error { color: #a52020; }

/* ── 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; }

/* ── Mode Tabs ── */
.mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.mode-tab {
  padding: 0.4rem 0.9rem;
  border: 1px solid #d5d5d5;
  border-radius: 20px;
  font-size: 0.82rem;
  cursor: pointer;
  background: white;
  color: #555;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.mode-tab:hover  { border-color: #4a6fa5; color: #4a6fa5; }
.mode-tab.active {
  background: #4a6fa5;
  border-color: #4a6fa5;
  color: white;
}
.mode-tab.active.opp {
  background: #7b3f9c;
  border-color: #7b3f9c;
}
.mode-tab.opp:hover { border-color: #7b3f9c; color: #7b3f9c; }

/* ── Results Table ── */
.return-table-wrap { overflow-x: auto; }

#returnTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

#returnTable thead th {
  padding: 0.4rem 0.75rem;
  border-bottom: 2px solid #e8e8e8;
  white-space: nowrap;
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  font-weight: 600;
}
#returnTable thead th.col-p { color: #1a1a2e; }
#returnTable thead th.col-d { color: #8b0000; }

#returnTable tbody tr:nth-child(even) { background: #fafafa; }
#returnTable tbody tr:hover           { background: #f0f4fa; }

#returnTable td {
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
  white-space: nowrap;
}

.rt-planet {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.rt-sym {
  width: 1.2rem;
  height: 1.2rem;
  color: #555;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rt-sym svg { display: block; }
.rt-name { font-weight: 500; color: #333; }

.rt-date { font-size: 0.84rem; color: #222; }
.rt-gate { font-family: 'SF Mono', 'Consolas', 'Menlo', monospace; font-size: 0.82rem; color: #666; margin-top: 0.15rem; }
.rt-gate-p { color: #1a1a2e; font-weight: 600; }
.rt-gate-d { color: #8b0000; font-weight: 600; }

.col-planet { min-width: 110px; }
.col-p, .col-d { min-width: 160px; }

/* ── Clickable table cells ── */
#returnTable tbody td.col-p,
#returnTable tbody td.col-d { cursor: pointer; }
#returnTable tbody td.col-p:hover,
#returnTable tbody td.col-d:hover { background: #e8eef8 !important; }
#returnTable tbody tr.selected td { background: #eef3fb; }

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

.overlay-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;
}

.overlay-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;
}

#bg-natal svg,
#bg-composite svg,
#bg-return svg {
  width: 100%;
  height: auto;
  display: block;
}

/* ── Bodygraph planet sub-table ── */
.bg-planet-table {
  width: 100%;
  margin-top: 0.6rem;
  border-top: 1px solid #f0f0f0;
  padding-top: 0.4rem;
}

.bg-pt {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
}

.bg-pt th {
  padding: 0.15rem 0.3rem;
  border-bottom: 1px solid #e8e8e8;
  text-align: center;
  font-size: 0.63rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #aaa;
  font-weight: 600;
}
.bg-pt th.bg-pt-th-p { color: #1a1a2e; }
.bg-pt th.bg-pt-th-d { color: #8b0000; }

.bg-pt td {
  padding: 0.15rem 0.3rem;
  border-bottom: 1px solid #f5f5f5;
  vertical-align: middle;
  white-space: nowrap;
}
.bg-pt tr:last-child td { border-bottom: none; }

.bg-pt-planet {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.bg-pt-sym {
  width: 1rem;
  height: 1rem;
  color: #555;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bg-pt-sym svg { display: block; }
.bg-pt-name { color: #444; }

.bg-pt-p {
  text-align: center;
  font-family: 'SF Mono', 'Consolas', 'Menlo', monospace;
  font-weight: 600;
  color: #1a1a2e;
}
.bg-pt-d {
  text-align: center;
  font-family: 'SF Mono', 'Consolas', 'Menlo', monospace;
  font-weight: 600;
  color: #8b0000;
}
.bg-pt-retro    { color: #bbb; font-size: 0.68em; margin-left: 0.1rem; }
.bg-pt-ed       { font-size: 0.68em; font-weight: 700; margin-left: 0.1rem; }
.bg-pt-exalted  { color: #2e7d32; }
.bg-pt-detriment { color: #c75000; }

/* ── Bodygraph channel list (under composite) ── */
.bg-ch-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #aaa;
  font-weight: 600;
  margin-top: 0.6rem;
  margin-bottom: 0.25rem;
}
.bg-ch-label:first-child { margin-top: 0; }

.bg-channels {
  width: 100%;
  margin-top: 0.6rem;
  border-top: 1px solid #f0f0f0;
  padding-top: 0.5rem;
  font-size: 0.78rem;
  line-height: 1.8;
}

.bg-channels .channel-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 3px;
  padding: 0.05rem 0.2rem;
  font-size: 0.76rem;
  color: #555;
}
.bg-channels .center-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
}
.bg-channels .channel-sep { color: #ddd; }

/* ── Responsive ── */
@media (max-width: 900px) {
  header { padding: 0.9rem 1.25rem; }
  .form-row { grid-template-columns: 1fr; }
  #calcBtn { width: 100%; }
}

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

@media (max-width: 480px) {
  header { padding: 0.7rem 1rem; }
  main { padding: 1.25rem 1rem; }
  .card { padding: 1.25rem; }
  .col-p, .col-d { min-width: 130px; }
  #returnTable { font-size: 0.78rem; }
}
