/* Updated Player Card Design - 500px height × 320px width with hover overlay - 5 COLUMNS */
.chroma-grid {
  position: relative;
  width: 100%;
  height: auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  grid-auto-rows: 500px; /* Use auto-rows to only create rows as needed */
  justify-content: center;
  align-items: start;
  gap: 1.5rem;
  max-width: 2100px !important; /* Increased for wider layout */
  margin: 2rem auto;
  padding: 0 0 4rem 0; /* Add bottom padding to prevent footer overlap */
  box-sizing: border-box;
  overflow: visible;
  isolation: isolate;
  contain: layout style; /* Better containment without size */
  z-index: 1;
}

/* Ensure grid creates proper block formatting context */
.chroma-grid::after {
  content: "";
  display: block;
  clear: both;
  height: 0;
  visibility: hidden;
}

/* Container wrapper to handle overflow */
.chroma-grid-wrapper {
  position: relative;
  width: 100%;
  overflow: visible;
  padding-bottom: 6rem; /* Increased padding */
  margin-bottom: 4rem; /* Increased margin */
  min-height: 0; /* Allow natural height */
  height: auto !important;
  display: flow-root; /* Create new block formatting context */
  z-index: 1;
}

/* Fix for chroma-roster-container */
.chroma-roster-container {
  position: relative !important;
  width: 100% !important;
  height: auto !important;
  min-height: 600px !important;
  overflow: visible !important;
  display: flow-root !important;
  padding-bottom: 6rem !important;
  margin-bottom: 4rem !important;
  z-index: 1 !important;
}

/* Mobile-specific fixes for chroma-roster-container */
@media (max-width: 768px) {
  .chroma-roster-container {
    min-height: auto !important;
    max-height: none !important;
    height: auto !important;
    padding-bottom: 3rem !important;
    margin-bottom: 2rem !important;
  }
}

/* Ensure chroma-roster-container properly contains all cards */
.chroma-roster-container .chroma-grid {
  height: auto !important;
  min-height: 0 !important;
  position: relative !important;
  margin-bottom: 4rem !important;
}

/* Fix for chroma-roster-container in team-roster-section */
.team-roster-section {
  position: relative !important;
  width: 100% !important;
  height: auto !important;
  overflow: visible !important;
  margin-bottom: 6rem !important;
}

/* Container styles to ensure proper containment */
.container:has(.chroma-grid-wrapper),
.container:has(.chroma-roster-container) {
  overflow: visible;
  position: relative;
  min-height: 0 !important; /* Allow natural height */
  height: auto !important;
  display: flow-root; /* Create new block formatting context */
  padding-bottom: 6rem !important; /* Ensure enough space for footer */
  max-width: 2100px !important; /* Match game grid width */
  width: 100% !important;
  z-index: 1;
}

/* Main content wrapper fix */
.main-content:has(.chroma-grid-wrapper),
.main-content:has(.chroma-roster-container) {
  min-height: 0 !important;
  height: auto !important;
  overflow: visible !important;
  display: flex !important;
  flex-direction: column !important;
  position: relative !important;
  z-index: 1;
}

/* Centering fix for fewer items */
.chroma-grid[data-count="1"] {
  grid-template-columns: minmax(250px, 320px);
  grid-auto-rows: 500px;
  justify-items: center;
  margin-bottom: 3rem;
}

.chroma-grid[data-count="2"] {
  grid-template-columns: repeat(2, minmax(250px, 320px));
  grid-auto-rows: 500px;
  justify-content: center;
  justify-items: center;
  margin-bottom: 3rem;
}

.chroma-grid[data-count="3"] {
  grid-template-columns: repeat(3, minmax(250px, 320px));
  grid-auto-rows: 500px;
  justify-content: center;
  justify-items: center;
  margin-bottom: 3rem;
}

.chroma-grid[data-count="4"] {
  grid-template-columns: repeat(4, minmax(250px, 320px));
  grid-auto-rows: 500px;
  justify-content: center;
  justify-items: center;
  margin-bottom: 3rem;
}

.chroma-grid[data-count="5"] {
  grid-template-columns: repeat(5, minmax(250px, 320px));
  grid-auto-rows: 500px;
  justify-content: center;
  justify-items: center;
  margin-bottom: 3rem;
}

.chroma-grid[data-count="6"] {
  grid-template-columns: repeat(3, minmax(250px, 320px));
  grid-auto-rows: 500px;
  justify-content: center;
  justify-items: center;
  margin-bottom: 3rem;
}

@media (max-width: 1400px) {
  .chroma-grid {
    grid-template-columns: repeat(4, minmax(240px, 1fr));
    max-width: 2100px !important; /* Keep consistent width */
  }
  
  .chroma-grid[data-count="1"],
  .chroma-grid[data-count="2"],
  .chroma-grid[data-count="3"] {
    justify-content: center;
  }
}

@media (max-width: 1124px) {
  .chroma-grid {
    grid-template-columns: repeat(3, minmax(300px, 1fr));
    gap: 0.75rem;
    padding: 1.5rem 0.75rem;
  }
  
  .chroma-grid[data-count="1"],
  .chroma-grid[data-count="2"] {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .chroma-grid {
    grid-template-columns: 1fr !important; /* Single column on mobile */
    gap: 0.75rem;
    padding: 1rem 0.5rem;
  }
  
  .chroma-grid[data-count="1"] {
    grid-template-columns: 1fr;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .chroma-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
  }
}

.chroma-card {
  position: relative;
  width: 100%;
  max-width: 300px;
  height: 500px;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  background: #1a1a1a;
  margin: 0 auto;
  justify-self: center;
  transform-origin: center center;
  transform: translateY(0); /* Reset default transform */
}

@media (hover: hover) {
  .chroma-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(1, 190, 110, 0.3);
    z-index: 10;
  }

  .chroma-card:hover .chroma-info {
    transform: translateY(0);
    opacity: 1;
  }

  .chroma-card:hover .chroma-img-wrapper img {
    transform: scale(1.05);
  }
}

/* Mobile/touch: hover doesn't exist, so use an explicit "active" state */
@media (hover: none) {
  .chroma-card.is-active .chroma-info {
    transform: translateY(0);
    opacity: 1;
  }

  .chroma-card.is-active .social-tape {
    opacity: 1;
    transform: translateY(0);
  }
}

.chroma-img-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.chroma-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

/* Player Info Overlay */
.chroma-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.7) 50%, transparent);
  color: #fff;
  padding: 2rem 1rem 1rem;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  text-align: center;
  min-height: 40%;
  transform: translateY(70%);
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0;
}

/* Explicit active state (used on touch devices) */
.chroma-card.is-active {
  z-index: 10;
}

.chroma-card.is-active .chroma-info {
  transform: translateY(0);
  opacity: 1;
}

.chroma-card.is-active .social-tape {
  opacity: 1;
  transform: translateY(0);
}

/* Player Information Styling */
.player-nickname {
  font-size: 1rem;
  font-weight: 700;
  color: #01BE6E;
  margin: 0;
  line-height: 1.2;
  text-align: center;
  opacity: 1;
}

.player-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #01BE6E;
  margin: 0;
  line-height: 1.2;
  text-align: center;
}

.player-type {
  font-size: 0.8rem;
  color: #ccc;
  margin: 0;
  text-align: center;
}

/* Readability: dark backing behind each text line (helps on bright portraits) */
.chroma-info .player-nickname,
.chroma-info .player-name,
.chroma-info .player-type {
  background: rgba(0, 0, 0, 0.55);
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  display: inline-block;
}

.player-role {
  font-size: 0.8rem;
  color: #ccc;
  margin: 0;
  text-align: center;
  display: none !important;
}

.player-details {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: #aaa;
  margin: 0.5rem 0;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.player-age, .player-nationality {
  margin: 0;
  padding: 0.25rem 0.5rem;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 12px;
  font-size: 0.7rem;
  text-align: center;
}

/* More Information Button */
.more-info-btn {
  background: linear-gradient(135deg, #01BE6E, #00a858);
  color: #000;
  border: none;
  padding: 0.5rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 0.5rem 0;
  text-decoration: none;
  text-align: center;
  display: block;
}

.more-info-btn:hover {
  background: linear-gradient(135deg, #00a858, #01BE6E);
  transform: translateY(-1px);
}

/* Social Media Tape */
.social-tape {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  background: rgba(1, 190, 111, 0);
  padding: 0.5rem;
  border-radius: 8px;
  margin-top: 0.5rem;
  border: 1px solid rgba(1, 190, 111, 0);
  flex-wrap: wrap;
  min-height: 40px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.chroma-card:hover .social-tape {
  opacity: 1;
  transform: translateY(0);
}

/* Social link styles moved to social-media.css */

/* Empty state styling for Falcons integration */
.chroma-grid .no-roster-message {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: #aaa;
}

.chroma-grid .no-roster-message i {
  font-size: 4rem;
  opacity: 0.3;
  margin-bottom: 1.5rem;
  color: #01BE6E;
}

.chroma-grid .no-roster-message h4 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: #fff;
}

.chroma-grid .no-roster-message p {
  font-size: 1rem;
  opacity: 0.8;
}

/* Mobile Responsive Adjustments */
@media (max-width: 480px) {
  .chroma-card {
    max-width: 320px;
    height: 480px;
  }
  
  .chroma-info {
    padding: 0.75rem;
    gap: 0.4rem;
  }
  
  .player-nickname {
    font-size: 0.9rem;
  }
  
  .player-name {
    font-size: 0.8rem;
  }
  
  .player-type, .player-role {
    font-size: 0.75rem;
  }
  
  .player-details {
    font-size: 0.7rem;
    gap: 0.75rem;
  }
  
  .more-info-btn {
    padding: 0.4rem;
    font-size: 0.75rem;
  }
  
  .social-tape {
    padding: 0.4rem;
    gap: 0.4rem;
  }
  
  .social-link {
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
  }
  
  /* CRITICAL: Mobile chroma-grid containment fixes */
  .chroma-grid {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    margin-bottom: 2rem !important;
    padding-bottom: 3rem !important;
    overflow: visible !important;
  }
}

@media (max-width: 1124px) {
  .chroma-card {
    max-width: 300px;
    height: 470px;
  }
}

@media (max-width: 768px) {
  .chroma-card {
    max-width: 280px;
    height: 450px;
  }
  
  /* CRITICAL: Mobile chroma-grid containment fixes */
  .chroma-grid {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    margin-bottom: 2rem !important;
    padding-bottom: 3rem !important;
    overflow: visible !important;
  }
}

/* Roster Card Styles */
.roster-card {
  position: relative;
  width: 550px;
  height: 400px;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  background: #1a1a1a;
  margin: 0 auto;
  justify-self: center;
}

.roster-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 30px rgba(1, 190, 110, 0.3);
}

.roster-img-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.roster-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.roster-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  color: #fff;
  padding: 1.5rem;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
}

.roster-card:hover .roster-info {
  transform: translateY(0);
}

.roster-players {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.roster-player-name {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.9rem;
  color: #fff;
}

.view-roster-btn {
  background: linear-gradient(135deg, #01BE6E, #00a858);
  color: #000;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  text-align: center;
  display: block;
  width: fit-content;
}

.view-roster-btn:hover {
  background: linear-gradient(135deg, #00a858, #01BE6E);
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .roster-card {
    width: 100%;
    max-width: 500px;
    height: 350px;
  }
}

@media (max-width: 480px) {
  .roster-card {
    height: 300px;
  }
  
  .roster-info {
    padding: 1rem;
  }
  
  .roster-player-name {
    font-size: 0.8rem;
  }
  
  .view-roster-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
}