/* ==========================================================================
   Dog Info Modal - Scoped clone of Noble Kennel styles
   Allows independent styling while matching NK visuals initially
   ========================================================================== */

/* Modal container sizing */
.modal.dog-info-modal {
  position: relative !important;
  width: auto !important;
  max-height: 100% !important;
  max-width: none !important;
  margin-top: calc(var(--header-height, 50px) / 2) !important;
  margin-left: 8vw;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  align-self: flex-start !important;
  overflow-y: auto;
}

.modal.dog-info-modal .modal-content {
  display: block;
  min-width: 70vw;
  height: calc(100% - 16px);
  margin: 8px auto;
  padding: 0.75rem 1rem;
  box-sizing: border-box;

  background: var(--color-grey-300) !important;
  border: 3px solid var(--color-primary-800) !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2) !important;

  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.modal.dog-info-modal .nk-modal-content {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

/* Header (Sir Edward + dialog + reputation) */
.modal.dog-info-modal .nk-header {
  display: flex;
  flex-direction: column;
  background: var(--color-primary-800);
  border-radius: 8px 8px 0 0;
  padding: .75rem 1rem 0 !important;
  color: var(--color-grey-100);
  margin: -16px 0 0 -16px;
  width: calc(100% + 32px);
  border-bottom: 3px solid var(--color-primary-800);
}

.modal.dog-info-modal .nk-header-main {
  display: grid;
  grid-template-columns: 140px 1fr 320px;
  gap: 1rem;
  align-items: center;
  width: 100%;
}

.modal.dog-info-modal .nk-header-left,
.modal.dog-info-modal .nk-header-center,
.modal.dog-info-modal .nk-header-right {
  min-width: 0;
}

.modal.dog-info-modal .sir-edward-avatar {
  width: 90%;
  height: 120px;
  border-radius: 8px;
  background:
    radial-gradient(100px 60px at 50% 30%, rgba(255,255,255,0.15), transparent),
    linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
  display: block;
  position: relative;
  border: 2px solid var(--color-secondary-300);
}

.modal.dog-info-modal .sir-edward-avatar::after {
  content: '';
  background-image: url('../images/siredward.jpg');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  position: absolute;
  inset: 0;
  display: grid;
  opacity: 0.9;
}

.modal.dog-info-modal .nk-header-center h2 {
  margin: 0 0 0.25rem 0;
  color: var(--color-secondary-200);
}

.modal.dog-info-modal .nk-dialog {
  font-size: 0.95rem;
  color: var(--color-grey-100);
  opacity: 0.95;
  line-height: 1.35;
  padding: 0.25rem 0;
}

.modal.dog-info-modal .nk-header-right {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.modal.dog-info-modal .nk-quest,
.modal.dog-info-modal .nk-reputation {
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
}

.modal.dog-info-modal .nk-quest .label,
.modal.dog-info-modal .nk-reputation .label {
  font-size: 0.75rem;
  color: var(--color-grey-200);
  margin-bottom: 0.25rem;
}

.modal.dog-info-modal .nk-quest .value,
.modal.dog-info-modal .nk-reputation .value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-secondary-200);
}

/* Sections */
.modal.dog-info-modal .nk-body {
  /* container block within modal content */
}

.modal.dog-info-modal .nk-section {
  display: none;
}

.modal.dog-info-modal .nk-section.active {
  display: block;
}

/* Wing panels */
.modal.dog-info-modal .nk-wing-panel {
  background: var(--color-white);
  border: 1px solid var(--color-grey-300);
  border-radius: 10px;
  padding: 0.75rem;
}

.modal.dog-info-modal .nk-wing-panel h3 {
  margin: 0 0 0.4rem 0;
  color: var(--color-secondary-300);
}

.modal.dog-info-modal .nk-wing-panel p {
  margin: 0 0 0.5rem 0;
  color: var(--color-grey-700);
}

/* Dog Info specifics */
.modal.dog-info-modal .dog-info-block {
  display: grid;
  gap: 0.5rem;
}

/* Name row: bold, prominent name with gender symbol on the left */
.modal.dog-info-modal .dog-name-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.modal.dog-info-modal .dog-name-row .dog-name {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--color-grey-900);
  line-height: 1.2;
}

/* Fallback row styling */
.modal.dog-info-modal .dog-info-row {
  font-size: 0.95rem;
  color: var(--color-grey-800);
}

@media (max-width: 768px) {
  .modal.dog-info-modal .dog-name-row .dog-name {
    font-size: 1.1rem;
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .modal.dog-info-modal .modal-content {
    width: 98vw;
    height: calc(100% - 8px);
    margin: 4px auto;
    border-radius: 12px;
    padding: 0.5rem;
  }

  .modal.dog-info-modal .nk-header {
    grid-template-columns: 90px 1fr;
    gap: 0.6rem;
  }

  .modal.dog-info-modal .sir-edward-avatar {
    height: 90px;
  }
}

@media (max-width: 480px) {
  /* placeholder for future divergence */
}
/* DogInfo photo in content area (left of details) */
.modal.dog-info-modal .dog-info-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1rem;
  align-items: start;
}

.modal.dog-info-modal .dog-info-layout .dog-photo-frame {
  width: 220px;
  height: 220px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--color-secondary-300);
  background:
    radial-gradient(100px 60px at 50% 30%, rgba(255,255,255,0.15), transparent),
    linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  margin: 0;
}

.modal.dog-info-modal .dog-info-layout .dog-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Responsive adjustments for content-area photo */
@media (max-width: 768px) {
  .modal.dog-info-modal .dog-info-layout {
    grid-template-columns: 1fr;
  }
  .modal.dog-info-modal .dog-info-layout .dog-photo-frame {
    width: 100%;
    height: 180px;
  }
}

@media (max-width: 480px) {
  .modal.dog-info-modal .dog-info-layout .dog-photo-frame {
    width: 100%;
    height: 150px;
  }
}
/* Prominent age row styling */
.modal.dog-info-modal .dog-age-row {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-grey-900);
  line-height: 1.25;
  margin-top: 0.15rem;
}

@media (max-width: 768px) {
  .modal.dog-info-modal .dog-age-row {
    font-size: 1rem;
  }
}
/* Dog Info badges layout */
.modal.dog-info-modal .dog-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin: 0.25rem 0 0.25rem;
}

/* Reproductive status pill (scoped to Dog Info modal) */
.modal.dog-info-modal .reproductive-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid transparent;
  line-height: 1.2;
}

/* Variants */
.modal.dog-info-modal .reproductive-status.heat-soon {
  background: #fffbea;
  color: #744210;
  border-color: #f6e05e;
}

.modal.dog-info-modal .reproductive-status.in-heat {
  background: #ffe5e5;
  color: #9b2c2c;
  border-color: #feb2b2;
}

.modal.dog-info-modal .reproductive-status.pregnant {
  background: #e6fffa;
  color: #234e52;
  border-color: #b2f5ea;
}

/* Ensure senior badge aligns nicely in badges row (style comes from DogRenderer.css) */
.modal.dog-info-modal .senior-badge {
  margin-right: 2px;
}

/* Responsive badge sizing */
@media (max-width: 768px) {
  .modal.dog-info-modal .reproductive-status {
    font-size: 0.78rem;
    padding: 2px 7px;
  }
}
/* Inline badges next to name */
.modal.dog-info-modal .dog-name-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap; /* allow wrap on smaller widths */
}

.modal.dog-info-modal .dog-inline-badges {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-left: 0.25rem; /* slight spacing from name */
}

.modal.dog-info-modal .dog-inline-badges:empty {
  display: none;
}
/* Inline name+badges wrapper so badges are directly after the name */
.modal.dog-info-modal .name-with-badges {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem; /* minimal gap between name and first badge */
  flex-wrap: wrap;
}

/* Tighten spacing: badges appear right next to the name */
.modal.dog-info-modal .dog-inline-badges {
  margin-left: 0;
  gap: 0.3rem;
}
/* Dog Info actions under age - horizontal layout */
.modal.dog-info-modal .dog-info-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0.5rem;
}

/* Ensure action buttons align like dog cards (styles for .action-btn come from DogRenderer.css) */
@media (max-width: 768px) {
  .modal.dog-info-modal .dog-info-actions {
    gap: 0.4rem;
  }
}
/* Center action buttons under age */
.modal.dog-info-modal .dog-info-actions {
  justify-content: center;
  width: 100%;
}
/* Override: keep Train/Compete close together directly under age */
.modal.dog-info-modal .dog-info-block .dog-info-actions {
  justify-content: flex-start !important;
  width: auto !important;
  align-self: flex-start;
  gap: 0.35rem;
  margin-top: 0.35rem;
}
/* Ensure Train/Compete sit tightly under the age, not stretched across the column */
.modal.dog-info-modal .dog-info-block #dog-info-actions {
  display: inline-flex !important;     /* shrink-wrap to buttons */
  justify-content: flex-start !important;
  align-items: center;
  gap: 0.35rem;                        /* keep buttons close together */
  width: auto !important;              /* prevent full-width stretch */
  justify-self: start;                 /* align to left within grid cell */
  align-self: start;                   /* avoid vertical stretch */
  margin-top: 0.35rem;                 /* slight space below age */
}

/* Ensure Dog Info uses the same button base styling as dog cards */
.modal.dog-info-modal .action-btn {
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-height: 36px;
}

.modal.dog-info-modal .action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* Mirror dog card colors explicitly for Train/Compete inside Dog Info */
.modal.dog-info-modal .train-btn {
  background: var(--color-primary-800) !important;
  color: var(--color-white) !important;
  border: none;
}

.modal.dog-info-modal .competition-btn {
  background: var(--color-primary-800) !important;
  color: var(--color-white) !important;
  border: none;
}

 

/* ==========================================================================
   Pedigree Section - Horizontal animal pedigree with connectors
   ========================================================================== */

.modal.dog-info-modal .pedigree-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-grey-300);
}

.modal.dog-info-modal .pedigree-header {
  font-size: var(--font-size-medium);
  font-weight: 600;
  color: var(--color-grey-900);
  margin: 0 0 0.75rem 0;
  text-align: center;
  background: var(--color-primary-800);
  padding: .5rem;.
  
}

.modal.dog-info-modal .pedigree-container {
  position: relative;
  width: 100%;
  min-height: 200px;
}

.modal.dog-info-modal .pedigree-wrapper {
  display: flex;
  flex-direction: row;
  gap: 2rem;
  justify-content: space-around;
  align-items: flex-start;
  position: relative;
  z-index: 1;
}

.modal.dog-info-modal .pedigree-generation {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 120px;
  flex: 1;
}

.modal.dog-info-modal .pedigree-generation-header {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-grey-700);
  margin: 0 0 0.5rem 0;
  text-align: center;
}

.modal.dog-info-modal .pedigree-nodes {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.modal.dog-info-modal .pedigree-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  text-align: center;
  min-height: 80px;
}

.modal.dog-info-modal .pedigree-node-image {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid var(--color-grey-300);
  object-fit: cover;
  background: var(--color-grey-200);
}

.modal.dog-info-modal .pedigree-node-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-grey-900);
  max-width: 80px;
  word-wrap: break-word;
  line-height: 1.2;
  cursor: default;
  user-select: none;
}

.modal.dog-info-modal .pedigree-node-name.clickable {
  cursor: pointer;
  color: var(--color-primary-700);
  text-decoration: underline;
}

.modal.dog-info-modal .pedigree-node-name.clickable:hover {
  color: var(--color-primary-800);
}

.modal.dog-info-modal .pedigree-node-name.clickable:focus {
  outline: 2px solid var(--color-primary-500);
  outline-offset: 2px;
  border-radius: 2px;
}

.modal.dog-info-modal .pedigree-node-name.unknown {
  color: var(--color-grey-500);
  font-style: italic;
}

.modal.dog-info-modal .pedigree-svg {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 0;
  overflow: visible;
}

/* Responsive adjustments for pedigree */
@media (max-width: 768px) {
  .modal.dog-info-modal .pedigree-wrapper {
    flex-direction: column;
    gap: 1rem;
    align-items: center;
  }

  .modal.dog-info-modal .pedigree-generation {
    min-width: auto;
    width: 100%;
    max-width: 300px;
  }

  .modal.dog-info-modal .pedigree-nodes {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
  }

  .modal.dog-info-modal .pedigree-node {
    min-height: auto;
  }

  .modal.dog-info-modal .pedigree-node-image {
    width: 40px;
    height: 40px;
  }

  .modal.dog-info-modal .pedigree-node-name {
    font-size: 0.75rem;
    max-width: 60px;
  }
}

@media (max-width: 480px) {
  .modal.dog-info-modal .pedigree-wrapper {
    gap: 0.75rem;
  }

  .modal.dog-info-modal .pedigree-nodes {
    gap: 0.75rem;
  }

  .modal.dog-info-modal .pedigree-node-image {
    width: 35px;
    height: 35px;
  }

  .modal.dog-info-modal .pedigree-node-name {
    font-size: 0.7rem;
    max-width: 50px;
  }
}
/* Pedigree caption: gender symbol + name inline */
.modal.dog-info-modal .pedigree-node-caption {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  line-height: 1.2;
}

/* Slight spacing for gender symbol when used in pedigree caption */
.modal.dog-info-modal .pedigree-node-caption .sex-symbol {
  display: inline-block;
  transform: translateY(-1px);
}
/* Equalize pedigree column heights by scaling node sizes per generation (desktop) */
@media (min-width: 769px) {
  /* Base vertical centering for all nodes */
  .modal.dog-info-modal .pedigree-node {
    justify-content: center;
  }

  /* Generation-specific min-heights so that:
     - Gen 0 (2 rows) + 1 gap ~= Gen 2 (8 rows) + 7 gaps
     - Gen 1 (4 rows) + 3 gaps ~= Gen 2 (8 rows) + 7 gaps
     Assumes .pedigree-nodes gap is 0.75rem (~12px) as defined above.
     Gen 2 node ~80px -> Column height ~ 8*80 + 7*12 = ~724px
     Gen 1 => per-node ~= (724 - 3*12)/4 = ~172px
     Gen 0 => per-node ~= (724 - 1*12)/2 = ~356px
   */
  .modal.dog-info-modal .pedigree-generation-2 .pedigree-node {
    min-height: 80px;
  }
  .modal.dog-info-modal .pedigree-generation-1 .pedigree-node {
    min-height: 172px;
  }
  .modal.dog-info-modal .pedigree-generation-0 .pedigree-node {
    min-height: 356px;
  }

  /* Scale images for larger generations */
  .modal.dog-info-modal .pedigree-generation-1 .pedigree-node-image {
    width: 80px;
    height: 80px;
  }
  .modal.dog-info-modal .pedigree-generation-0 .pedigree-node-image {
    width: 110px;
    height: 110px;
  }

  /* Scale caption (name) sizes and widths for readability */
  .modal.dog-info-modal .pedigree-generation-1 .pedigree-node-name {
    font-size: 0.95rem;
    max-width: 110px;
  }
  .modal.dog-info-modal .pedigree-generation-0 .pedigree-node-name {
    font-size: 1.05rem;
    max-width: 140px;
  }
}
/* Achievements two-column layout and table */
.modal.dog-info-modal .dog-info-main-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(300px, 1fr);
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}

@media (max-width: 768px) {
  .modal.dog-info-modal .dog-info-main-grid {
    grid-template-columns: 1fr;
  }
}

.modal.dog-info-modal .achievements-pane {
  background: var(--color-comp-900);
  border: 2px solid var(--color-secondary-500);
  border-radius: 9px;
  padding: 0.5rem 0.75rem;
}

.modal.dog-info-modal .achievements-header {
  margin: 0 0 0.25rem 0;
  font-size: var(--font-size-medium);
  font-weight: 700;
  color: var(--color-grey-900);
}

.modal.dog-info-modal .achievements-summary {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-grey-200);
  margin-bottom: 0.5rem;
}

.modal.dog-info-modal .achievements-table-wrap {
  overflow-x: auto;
}

.modal.dog-info-modal .achievements-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-white);
  border: 1px solid var(--color-grey-200);
  border-radius: 6px;
}

.modal.dog-info-modal .achievements-table caption {
  text-align: left;
  font-weight: 600;
  color: var(--color-grey-200);
  padding: 0.25rem 0.5rem;
}

.modal.dog-info-modal .achievements-table thead th {
  text-align: left;
  font-size: 0.85rem;
  color: var(--color-grey-800);
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--color-grey-200);
  background: var(--color-secondary-100);
}

.modal.dog-info-modal .achievements-table tbody td {
  padding: 0.4rem 0.5rem;
  font-size: 0.9rem;
  color: var(--color-grey-900);
  border-bottom: 1px solid var(--color-grey-100);
}

.modal.dog-info-modal .achievements-table tbody tr:nth-child(odd) {
  background: var(--color-grey-300);
}

.modal.dog-info-modal .achievements-table tbody tr:last-child td {
  border-bottom: none;
}