/* ═══════════════════════════════════════
   MatchSire — Pedigree Lookup Module CSS
   ═══════════════════════════════════════ */

/* ── Search Input ── */
.pedigree-search-container {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.pedigree-search-wrapper {
  position: relative;
}

.pedigree-search-input {
  width: 100%;
  padding: 0.6rem 1rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: #e8e8e8;
  font-size: 0.85rem;
  font-family: 'Inter', sans-serif;
  transition: all 0.3s ease;
}

.pedigree-search-input:focus {
  outline: none;
  border-color: var(--gold, #d4a843);
  background: rgba(255,255,255,0.08);
  box-shadow: 0 0 0 3px rgba(212,168,67,0.15);
}

.pedigree-search-input::placeholder {
  color: rgba(255,255,255,0.35);
}

/* ── Search Results Dropdown ── */
.pedigree-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #1a1a2e;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.pedigree-search-results.active {
  display: block;
}

.search-result-item {
  padding: 0.6rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  transition: background 0.15s;
}

.search-result-item:hover {
  background: rgba(212,168,67,0.1);
}

.search-result-item:last-child {
  border-bottom: none;
}

.result-name {
  font-size: 0.9rem;
  color: #e8e8e8;
  font-weight: 500;
}

.result-name strong {
  color: var(--gold, #d4a843);
}

.result-meta {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
  flex-wrap: wrap;
}

.result-meta span {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.5);
}

.meta-gait { color: rgba(100,200,255,0.7) !important; }
.meta-year { color: rgba(255,200,100,0.7) !important; }

.search-no-results {
  padding: 1rem;
  text-align: center;
  color: rgba(255,255,255,0.35);
  font-size: 0.85rem;
}

/* ── Auto-filled highlight ── */
.gene-select.auto-filled {
  animation: autoFillFlash 2s ease;
}

@keyframes autoFillFlash {
  0% { border-color: var(--gold, #d4a843); box-shadow: 0 0 0 3px rgba(212,168,67,0.3); }
  100% { border-color: rgba(255,255,255,0.12); box-shadow: none; }
}

/* ── Pedigree Tree Display ── */
.pedigree-display {
  display: none;
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.pedigree-display.active {
  display: block;
}

.pedigree-tree {
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  padding: 1rem;
  border: 1px solid rgba(255,255,255,0.06);
}

.pedigree-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.pedigree-title {
  font-weight: 600;
  color: var(--gold, #d4a843);
  font-size: 0.85rem;
}

.pedigree-earnings {
  font-size: 0.75rem;
  color: #4ade80;
  background: rgba(74,222,128,0.1);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.pedigree-time, .pedigree-record {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.06);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

/* ── Pedigree Grid (right-to-left tree) ── */
.pedigree-grid {
  display: flex;
  flex-direction: row-reverse;
  gap: 2px;
  overflow-x: auto;
  font-size: 0.7rem;
}

.ped-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.ped-cell {
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: -0.02em;
  flex: 1;
}

.ped-male {
  background: rgba(100,150,255,0.08);
  border-left: 2px solid rgba(100,150,255,0.3);
  color: rgba(140,180,255,0.9);
}

.ped-female {
  background: rgba(255,130,180,0.08);
  border-left: 2px solid rgba(255,130,180,0.3);
  color: rgba(255,160,200,0.9);
}

.ped-subject {
  background: rgba(212,168,67,0.15);
  border-left: 2px solid var(--gold, #d4a843);
  color: var(--gold, #d4a843);
  font-weight: 600;
}

.ped-gen1 { font-size: 0.8rem; }
.ped-gen2 { font-size: 0.7rem; }
.ped-gen3 { font-size: 0.65rem; }
.ped-gen4 { font-size: 0.6rem; opacity: 0.8; }

/* ── COI Results ── */
.coi-result-container {
  margin: 1rem 0;
}

.coi-result {
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.coi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.coi-label {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.7);
  font-weight: 500;
}

.coi-value {
  font-size: 1.8rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

.coi-risk {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
  margin-bottom: 0.5rem;
}

.coi-gens {
  font-size: 0.7rem;
  opacity: 0.6;
}

.coi-warning {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  color: #ef4444;
  margin-top: 0.5rem;
}

.coi-ancestors {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.coi-ancestors h4 {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.coi-ancestor-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0;
  font-size: 0.8rem;
}

.coi-ancestor-name {
  color: rgba(255,255,255,0.7);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
}

.coi-ancestor-contribution {
  color: rgba(255,255,255,0.4);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
}

/* ── Extraction Results ── */
.extraction-results {
  display: none;
  margin-top: 1rem;
}

.extraction-results.active {
  display: block;
}

.extracted-section {
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid rgba(255,255,255,0.06);
}

.extracted-section h4 {
  font-size: 0.9rem;
  color: var(--gold, #d4a843);
  margin-bottom: 0.75rem;
}

.extracted-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem;
}

.extracted-item {
  display: flex;
  flex-direction: column;
  padding: 0.5rem;
  background: rgba(255,255,255,0.03);
  border-radius: 6px;
}

.extracted-label {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.2rem;
}

.extracted-value {
  font-size: 0.9rem;
  color: #e8e8e8;
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
}

.btn-apply-genetics {
  margin-top: 1rem;
  padding: 0.6rem 1.5rem;
  background: linear-gradient(135deg, var(--gold, #d4a843), #b8902e);
  border: none;
  border-radius: 8px;
  color: #111;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-apply-genetics:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(212,168,67,0.3);
}

.extraction-loading {
  color: var(--gold, #d4a843);
  text-align: center;
  padding: 1rem;
  font-size: 0.9rem;
}

.extraction-success {
  color: #4ade80;
  text-align: center;
  padding: 0.5rem;
  font-size: 0.85rem;
}

.extraction-error {
  color: #ef4444;
  text-align: center;
  padding: 0.5rem;
  font-size: 0.85rem;
}

.extraction-empty {
  text-align: center;
  color: rgba(255,255,255,0.35);
  padding: 1.5rem;
}

.extraction-note {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.35);
  margin-top: 0.5rem;
  font-style: italic;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .pedigree-grid {
    flex-direction: column;
  }
  
  .ped-col {
    flex-direction: row;
    flex-wrap: wrap;
  }
  
  .ped-cell {
    flex: 1 1 45%;
  }

  .extracted-grid {
    grid-template-columns: 1fr;
  }
}
