/* Pet Photo Pedigree - Custom Styles */

/* Global Dark Theme */
body {
  background: #262626;
  color: #f4f4f4;
  font-family: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
  margin: 0;
  padding: 0;
}

/* Pedigree Tree Container */
#pedigreeTree {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  padding: 1rem;
}

/* Family Tree Container */
.family-tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}



/* Pet Card */
.pet-card {
  background: #393939;
  border: 2px solid #525252;
  border-radius: 4px;
  padding: 1rem;
  width: 200px;
  text-align: center;
  position: relative;
  transition: all 0.3s ease;
  cursor: pointer;
}

.pet-card:hover {
  border-color: #0f62fe;
  box-shadow: 0 4px 12px rgba(15, 98, 254, 0.3);
  transform: translateY(-2px);
}

/* Pet Photo */
.pet-photo {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 0.75rem;
  border: 1px solid #525252;
  background: #262626;
  display: block;
}

/* Pet Photo Error State */
.pet-photo-error {
  width: 150px;
  height: 150px;
  background: linear-gradient(135deg, #393939 0%, #262626 100%);
  border-radius: 4px;
  margin-bottom: 0.75rem;
  border: 1px solid #525252;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  opacity: 0.5;
}

/* Pet Info */
.pet-name {
  font-size: 1.125rem;
  font-weight: 600;
  color: #f4f4f4;
  margin-bottom: 0.25rem;
}

.pet-species {
  font-size: 0.875rem;
  color: #c6c6c6;
  margin-bottom: 0.5rem;
}

.pet-birth {
  font-size: 0.75rem;
  color: #8d8d8d;
}

/* Tree Structure - Complete Redesign */
.pet-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

/* Branch container */
.tree-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 0;
}

/* Vertical line from parent */
.branch-line {
  width: 3px;
  height: 50px;
  background: #0f62fe;
  margin: 0;
}

/* Children row */
.children-row {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-start;
  gap: 3rem;
  position: relative;
  padding-top: 50px;
}

/* Child wrapper with connection lines */
.child-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Vertical line down to each child */
.child-wrapper::before {
  content: '';
  position: absolute;
  width: 3px;
  height: 50px;
  background: #0f62fe;
  top: -50px;
  left: 50%;
  transform: translateX(-1.5px);
}

/* Horizontal connecting line for multiple children */
.children-row::before {
  content: '';
  position: absolute;
  height: 3px;
  background: #0f62fe;
  top: 0;
  left: 0;
  right: 0;
}

/* Single child: no horizontal line needed */
.child-wrapper.single::before {
  top: -50px;
}

/* Adjust line positions for first and last children */
.child-wrapper.first::after,
.child-wrapper.last::after {
  content: '';
  position: absolute;
  height: 3px;
  background: #262626;
  top: -50px;
  width: 50%;
}

.child-wrapper.first::after {
  left: 0;
}

.child-wrapper.last::after {
  right: 0;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .branch-line {
    height: 30px;
  }
  
  .children-row {
    padding-top: 30px;
    gap: 1.5rem;
    flex-wrap: nowrap;
    overflow-x: visible;
  }
  
  .child-wrapper::before {
    height: 30px;
    top: -30px;
    width: 2px;
  }
  
  .children-row::before {
    height: 2px;
  }
}

/* Delete Button */
.delete-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: #da1e28;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.pet-card:hover .delete-btn {
  opacity: 1;
}

.delete-btn:hover {
  background: #ba1b23;
}

/* Responsive Design */
@media (max-width: 768px) {
  /* Allow horizontal scrolling on mobile for wide trees */
  #pedigreeTree {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }

  /* Keep horizontal layout on mobile, enable scrolling */
  .children-container {
    flex-wrap: nowrap !important;
    min-width: min-content;
  }

  .pet-card {
    width: 180px;
    min-width: 180px;
    flex-shrink: 0;
  }

  .pet-card-wrapper {
    flex-shrink: 0;
  }

  .cds--col-lg-6,
  .cds--col-lg-10 {
    width: 100%;
  }
  
  .family-tree {
    padding: 0 0.5rem;
    min-width: min-content;
  }
  
  /* Reduce spacing on mobile */
  .connection-vertical {
    height: 30px;
  }
  
  .pet-photo {
    width: 120px;
    height: 120px;
  }
  
  .pet-photo-error {
    width: 120px;
    height: 120px;
    font-size: 2.5rem;
  }
}

/* Empty State */
.empty-state {
  text-align: center;
  color: #8d8d8d;
  padding: 3rem 1rem;
}

.empty-state svg {
  width: 80px;
  height: 80px;
  margin-bottom: 1rem;
  opacity: 0.5;
}
