/**
 * DogRenderer - Mobile-First Responsive Styles
 *
 * Comprehensive CSS for dog display module with:
 * - Mobile-first responsive design
 * - Touch-friendly interactions
 * - Performance-optimized layouts
 * - Accessibility features
 */

/* ===== BASE DOG LIST CONTAINER ===== */

#dogList {
   width: 100%;
   padding: 1rem;
   box-sizing: border-box;
 }

 /* Dog list grid layout */
 .dog-list {
   display: grid;
   grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
   gap: 1rem;
   overflow-y: auto;
 }

/* Kennel layout with responsive columns */
.kennel-layout {
  display: grid;
  gap: 0.5rem;
  overflow-y: auto;
  /* Default: 1 column for mobile */
  grid-template-columns: 1fr;
}

/* 2 columns for tablet+ */
@media (min-width: 769px) {
  .kennel-layout {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 4 columns for desktop+ */
@media (min-width: 1025px) {
  .kennel-layout {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Pregnant dog spans 2 columns when >= 2 columns available */
.dog-card--pregnant {
  grid-column: span 2;
}

/* Mobile fallback: row span 2 and larger height for 1-column layout */
@media (max-width: 768px) {
  .dog-card--pregnant {
    grid-column: span 1;
    grid-row: span 2;
    min-height: 200px; /* Approximately double standard card height */
  }
}

/* Mobile Layout (default) */
#dogList.mobile-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Desktop Layout */
#dogList.desktop-layout {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
}

/* ===== DOG ENTRY ===== */

.dog-entry {
  border: 1px var(--color-secondary-600) solid;
  border-radius: 8px;
  transition: all 0.2s ease;
  overflow: hidden;
  background-color: var(--color-grey-200);
  padding: var(--spacing-md);
  box-shadow: var(--shadow-small);
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
  box-sizing: border-box;
}

.dog-entry:hover {
  background-color: var(--color-grey-400);
}

/* Mobile-specific dog entry styles */
.dog-entry-mobile {
  margin-bottom: 1rem;
  padding: 1rem;
}

/* Desktop-specific dog entry styles */
.dog-entry-desktop {
  padding: 1.25rem;
}

/* New dog animation */
.dog-entry.new-dog {
  background-color: var(--color-primary-700);
  color: var(--color-pure-grey-100); 
   animation: newDogPulse 2s ease-in-out;
   border-color: var(--color-secondary-600);
 }

/* Light text for new dogs */
.dog-entry.new-dog .dog-name {
   color: var(--color-grey-100);
 }

 .dog-entry.new-dog .height-display,
.dog-entry.new-dog .confidence-display {
color: var(--color-grey-100);
}

@keyframes newDogPulse {
  0% { box-shadow: 0 0 0 0 rgba(72, 187, 120, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(72, 187, 120, 0); }
  100% { box-shadow: 0 0 0 0 rgba(72, 187, 120, 0); }
}

/* ===== DOG INFO SECTION ===== */

.dog-info {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Mobile dog info */
.dog-info-mobile {
  gap: 0.5rem;
}

/* Desktop dog info */
.dog-info-desktop {
  gap: 1rem;
}

/* ===== DOG NAME CONTAINER ===== */

.dog-name-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.dog-name-container-mobile {
  gap: 0.25rem;
}

.dog-name-container-desktop {
  gap: 0.75rem;
}

.dog-name {
  font-weight: 600;
  font-size: 1.1rem;
  color: #2d3748;
  flex: 1;
  min-width: 0;
  word-wrap: break-word;
}

/* Mobile name truncation */
.dog-name-container-mobile .dog-name {
  font-size: 1rem;
  line-height: 1.3;
}

/* Desktop name styles */
.dog-name-container-desktop .dog-name {
  font-size: 1.2rem;
  line-height: 1.4;
}

/* Edit name button */
.edit-name-btn {
  background: #e2e8f0;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.edit-name-btn:hover {
  background: #cbd5e0;
  transform: scale(1.05);
}

.edit-name-btn:active {
  transform: scale(0.95);
}

/* ===== HEIGHT DISPLAY ===== */

.height-display {
  font-size: 0.95rem;
  color: var(--color-grey-500);
  font-weight: 500;
}

/* ===== CONFIDENCE DISPLAY ===== */

.confidence-display {
  font-size: 0.9rem;
  color: #718096;
  font-style: italic;
}

/* Mobile confidence */
.confidence-display-mobile {
  font-size: 0.85rem;
}

/* Desktop confidence */
.confidence-display-desktop {
  font-size: 0.95rem;
}

/* ===== DOG ACTIONS ===== */

.dog-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.dog-actions-mobile {
  gap: 0.25rem;
  justify-content: center;
}

.dog-actions-desktop {
  gap: 0.5rem;
  justify-content: flex-start;
}

.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: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-height: 36px;
}

/* Mobile buttons - touch-friendly */
@media (max-width: 768px) {
  .action-btn {
    min-width: 36px;
    min-height: 36px;
    padding: 0.5rem;
    font-size: 0.8rem;
  }

  /* Stack buttons vertically on very small screens */
  .dog-actions-mobile {
    flex-direction: column;
    align-items: stretch;
  }

  .dog-actions-mobile .action-btn {
    justify-content: center;
  }
}

/* Desktop buttons */
@media (min-width: 769px) {
  .action-btn {
    min-width: auto;
    padding: 0.5rem 1rem;
  }
}

/* Button variants */
.delete-btn {
  background: #fed7d7;
  color: #c53030;
}

.delete-btn:hover:not(:disabled) {
  background: #feb2b2;
}

.train-btn {
  background: var(--color-primary-800);
  color: var(--color-white);
}

/*.train-btn:hover:not(:disabled) {
  background: var(--color-primary-600);
}*/

.competition-btn {
  background: #bee3f8;
  color: #2a4365;
}

/*.competition-btn:hover:not(:disabled) {
  background: var(--color-primary-600);
} */

/* Locked competition button state for reproductive restrictions */
.competition-btn.locked {
  background: #a0aec0;
  color: #2d3748;
  cursor: not-allowed;
}

/* Informational message shown when compete is locked by reproductive rules */
.competition-lock-message {
  font-size: 0.85rem;
  color: #4a5568;
  margin-top: 0.25rem;
  line-height: 1.3;
}

.edit-genotype-btn {
  background: #e6fffa;
  color: #234e52;
}

.edit-genotype-btn:hover:not(:disabled) {
  background: #b2f5ea;
}

/* Disabled button states */
.action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* Button hover effects */
.action-btn:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-btn:not(:disabled):active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ===== COMPETITION RECORDS ===== */

.competition-records {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
}

.competition-records-mobile {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
}

.competition-records-desktop {
  margin-top: 1rem;
  padding-top: 1rem;
}

.competition-level {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.25rem;
  flex-wrap: wrap;
}

.competition-level-mobile {
  gap: 0.125rem;
  margin-bottom: 0.125rem;
}

.competition-level-desktop {
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.level-name {
  font-size: 0.8rem;
  font-weight: bold;
  color: var(--color-grey-700);
  white-space: nowrap;
}

.placement-circle {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 2px;
  flex-shrink: 0;
}

/* Mobile placement circles */
@media (max-width: 768px) {
  .placement-circle {
    width: 6px;
    height: 6px;
    margin-right: 1px;
  }
}

.place-1 {
  background-color: #3182ce; /* Blue for 1st */
}

.place-2 {
  background-color: #e53e3e; /* Red for 2nd */
}

.place-3 {
  background-color: #d69e2e; /* Yellow for 3rd */
}

/* ===== GENOTYPE DETAILS ===== */

.genotype-details {
  margin-top: 1rem;
  padding: 0.75rem;
  background: #f7fafc;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  font-family: var(--font-family);
  font-size: 0.85rem;
  line-height: 1.4;
}

.genotype-details-mobile {
  margin-top: 0.75rem;
  padding: 0.5rem;
  font-size: 0.8rem;
}

.genotype-details-desktop {
  margin-top: 1rem;
  padding: 1rem;
  font-size: 0.9rem;
}

.genotype-details strong {
  color: #2d3748;
  display: block;
  margin-bottom: 0.25rem;
}

.genotype-details br {
  margin-bottom: 0.5rem;
}

/* ===== BOOST DETAILS ===== */

.boost-details {
  margin-top: 0.75rem;
  padding: 0.5rem;
  background: #fff5f5;
  border-radius: 6px;
  border: 1px solid #fed7d7;
  font-size: 0.85rem;
  line-height: 1.4;
}

.boost-details-mobile {
  margin-top: 0.5rem;
  padding: 0.375rem;
  font-size: 0.8rem;
}

.boost-details-desktop {
  margin-top: 1rem;
  padding: 0.75rem;
  font-size: 0.9rem;
}

.boost-details strong {
  color: #c53030;
  display: block;
  margin-bottom: 0.25rem;
}

/* ===== FAMILY TREE ===== */

.family-tree {
  margin-top: 1rem;
  padding: 0.75rem;
  background: #f0fff4;
  border-radius: 6px;
  border: 1px solid #c6f6d5;
}

.family-tree-mobile {
  margin-top: 0.75rem;
  padding: 0.5rem;
}

.family-tree-desktop {
  margin-top: 1rem;
  padding: 1rem;
}

.family-tree pre {
  margin: 0;
  font-family: var(--font-family);
  font-size: 0.8rem;
  line-height: 1.3;
  color: #22543d;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Mobile family tree toggle */
.family-tree-toggle {
  background: #9ae6b4;
  border: none;
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: #22543d;
  width: 100%;
  transition: all 0.2s ease;
}

.family-tree-toggle:hover {
  background: #68d391;
}

.family-tree-content {
  margin-top: 0.5rem;
  transition: all 0.3s ease;
}

.family-tree-content.hidden {
  display: none;
}

/* Desktop family tree */
@media (min-width: 769px) {
  .family-tree-toggle {
    display: none;
  }

  .family-tree-content {
    display: block !important;
  }
}

/* ===== RESPONSIVE BREAKPOINTS ===== */

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
  #dogList.desktop-layout {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
  }

  .dog-entry-desktop {
    padding: 1rem;
  }

  .action-btn {
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
  }
}

/* Large desktop */
@media (min-width: 1200px) {
  #dogList.desktop-layout {
    grid-template-columns: repeat(auto-fill, minmax(20%, 1fr));
    gap: 1rem;
  }

  .dog-entry-desktop {
    padding: 1.5rem;
  }

  .dog-name-container-desktop .dog-name {
    font-size: 1.3rem;
  }
}

/* ===== SENIOR BADGE ===== */

.senior-badge {
  background-color: #f6ad55;
  color: #2d3748;
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 8px;
  display: inline-block;
  border: 1px solid #d69e2e;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Mobile responsive senior badge */
@media (max-width: 768px) {
  .senior-badge {
    font-size: 0.7rem;
    padding: 1px 4px;
    margin-left: 4px;
  }
}

/* ARIA support for screen readers */
.senior-badge:focus {
  outline: 2px solid #3182ce;
  outline-offset: 2px;
}

/* ===== ACCESSIBILITY ===== */

/* Focus styles */
.action-btn:focus,
.edit-name-btn:focus,
.family-tree-toggle:focus,
.senior-badge:focus {
  outline: 2px solid #3182ce;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .dog-entry {
    border-width: 2px;
  }

  .action-btn {
    border: 1px solid;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .dog-entry,
  .action-btn,
  .edit-name-btn,
  .family-tree-toggle,
  .dog-entry.new-dog {
    transition: none;
    animation: none;
  }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */

/* Hardware acceleration for animations */
.dog-entry,
.action-btn {
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Optimize repaints */
#dogList {
  contain: layout style paint;
}

.dog-entry {
  contain: layout style;
}

/* ===== PRINT STYLES ===== */

@media print {
  .dog-actions,
  .edit-name-btn,
  .family-tree-toggle {
    display: none;
  }

  .dog-entry {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #000;
  }

  .genotype-details,
  .boost-details,
  .family-tree {
    background: white !important;
    border: 1px solid #000;
  }
}

/* ===== DARK MODE SUPPORT ===== */

@media (prefers-color-scheme: dark) {
  .dog-entry {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
  }

  .dog-name {
    color: #f7fafc;
  }

  .height-display,
  .level-name {
    color: #cbd5e0;
  }

  .confidence-display {
    color: #a0aec0;
  }

  .genotype-details {
    background: #1a202c;
    border-color: #2d3748;
  }

  .boost-details {
    background: #2d1b1b;
    border-color: #4a1a1a;
  }

  .family-tree {
    background: #1a2e1f;
    border-color: #2d5016;
  }

  .family-tree pre {
    color: #9ae6b4;
  }
}
/* ===== LITTER MINI-CARDS (Mother's Kennel Composite) ===== */
.litter-section {
  margin-top: 0.5rem;
}

.litter-section-mobile {
  margin-top: 0.5rem;
}

.litter-section-desktop {
  margin-top: 0.75rem;
}

.litter-mini-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: stretch;
}

.litter-mini-card {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.5rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  box-shadow: var(--shadow-small);
}

@media (prefers-color-scheme: dark) {
  .litter-mini-card {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
  }
}

.litter-mini-image.placeholder {
  width: 28px;
  height: 28px;
  background: #cbd5e0;
  border-radius: 4px;
  flex-shrink: 0;
}

@media (prefers-color-scheme: dark) {
  .litter-mini-image.placeholder {
    background: #4a5568;
  }
}

.litter-mini-meta {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.9rem;
  color: #2d3748;
}

@media (prefers-color-scheme: dark) {
  .litter-mini-meta {
    color: #e2e8f0;
  }
}

.litter-mini-age {
  font-size: 0.8rem;
  font-weight: 500;
  color: #4a5568;
  opacity: 0.9;
}

/* Mobile responsive puppy age */
@media (max-width: 768px) {
  .litter-mini-age {
    font-size: 0.75rem;
  }
}

/* Dark mode puppy age */
@media (prefers-color-scheme: dark) {
  .litter-mini-age {
    color: #a0aec0;
  }
}

/* Optional sex symbol coloring reused across views */
.sex-symbol {
  font-weight: 600;
  line-height: 1;
}
.sex-symbol--male {
  color: #2b6cb0;
}
.sex-symbol--female {
  color: #b83280;
}

.litter-actions {
  display: flex;
  gap: 0.25rem;
  margin-left: 0.25rem;
}

.litter-actions .btn {
  font-size: 0.75rem;
  line-height: 1;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
}

.litter-actions .btn.btn-primary {
  background: var(--color-primary-800, #2f855a);
  color: var(--color-white, #fff);
}

.litter-actions .btn.btn-secondary {
  background: #e2e8f0;
  color: #2d3748;
}

.litter-actions .btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}