/* Replacing entire CSS with original comprehensive styling - UPDATED */
/* ===== RESET & BASE ===== */
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  padding: 0;
  /* Prefer the self-hosted font (GSC-Roboto), then Roboto/system fallbacks */
  font-family: 'GSC-Roboto', Roboto, system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: #f8f9fa;
  min-width: 280px;
  color: #222;
}

/* ===== FORZAR ANCHO COMPLETO - ANULAR ELEMENTOR/TEMAS ===== */
/* Anular cualquier padding/margin de contenedores Elementor padre */
.elementor-widget-container .golf-leaderboard-container,
.elementor-element .golf-leaderboard-container,
.elementor-column .golf-leaderboard-container,
.elementor-widget-shortcode .golf-leaderboard-container {
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}

/* Anular padding de widget shortcode de Elementor */
.elementor-widget-shortcode {
  padding: 0 !important;
  margin: 0 !important;
}

.elementor-widget-shortcode .elementor-widget-container {
  padding: 0 !important;
  margin: 0 !important;
  width: 100% !important;
}

/* Anular padding de columnas Elementor */
.elementor-column-wrap,
.elementor-column > .elementor-widget-wrap {
  padding: 0 !important;
}

/* Forzar contenedor a ocupar todo el ancho disponible */
.golf-leaderboard-container,
.golf-leaderboard-container * {
  box-sizing: border-box !important;
}
main {
  margin: 0;
  padding: 0;
  min-width: 280px;
}

/* ===== CUSTOM SELECT (MOBILE) ===== */
.custom-select-box {
  width: 100%;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e1e1e1;
  position: relative;
  box-sizing: border-box;
  font-size: 1em;
  cursor: pointer;
}
.custom-select-selected {
  padding: 12px 16px;
  border-radius: 8px;
  background: #fff;
  color: #222;
  font-weight: 500;
  border-bottom: 1px solid #e1e1e1;
}
.custom-select-options {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: #fff;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 2px 8px rgba(36, 59, 85, 0.08);
  z-index: 10;
  max-height: 180px;
  overflow-y: auto;
}
.custom-select-option {
  padding: 12px 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px solid #e1e1e1;
  color: #222;
  background: #fff;
  cursor: pointer;
  border: 1px solid #e1e1e1;
}
.custom-select-option:last-child {
  border-bottom: none;
}
.custom-select-option:hover {
  background: #f0f4f8;
}

/* ===== ROUND SELECTOR ===== */
.round-selector-container {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  padding: 18px 24px 0 24px;
  background: #f8f9fa;
}
.round-label {
  font-weight: 600;
  color: #222;
  font-size: 1.08em;
}
.round-select {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #e1e1e1;
  font-size: 1em;
  background: #fff;
  color: #222;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
.round-select:focus {
  border-color: #27ae60;
}

/* Botón con gradiente Obsidian Glow */
.view-results-btn {
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 1.08em;
  font-weight: bold;
  background: linear-gradient(90deg, #243b55 0%, #141e30 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(36, 59, 85, 0.15);
  transition: transform 0.1s, box-shadow 0.2s;
  letter-spacing: 1px;
}
.view-results-btn:hover,
.view-results-btn:focus {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(36, 59, 85, 0.18);
  background: linear-gradient(90deg, #141e30 0%, #243b55 100%);
}

/* ===== ANULAR TODOS LOS PADDINGS/MARGINS DE ELEMENTOR Y TEMAS ===== */
/* Máxima prioridad - Forzar ancho completo sin espacios */
div[class*="elementor"] .golf-leaderboard-container,
section[class*="elementor"] .golf-leaderboard-container,
.elementor .golf-leaderboard-container {
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Anular padding del widget container de Elementor */
.elementor-widget-container > .golf-leaderboard-container {
  margin: 0 !important;
  padding: 0 !important;
}

/* Si el shortcode está dentro de un div wrapper */
.elementor-shortcode > .golf-leaderboard-container,
div > .golf-leaderboard-container {
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
}

/* ===== LEADERBOARD CONTAINER =====  user */
.golf-leaderboard-container,
.leaderboard-container {
    flex-direction: column;
    justify-content: flex-start;
    background-color: #f8f9fa;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    overflow-y: auto;
    display: flex;
    max-width: 100% !important;
    max-height: 100vh;
    /* Make this a container for container queries so layout adapts to the column width */
    container-type: inline-size;
    container-name: leaderboard;
    overflow-x: hidden;
    box-sizing: border-box !important;
    /* Compensar padding de columna Elementor padre si existe */
    position: relative;
    left: 0;
    right: 0;
}

/* Variante para compensar padding común de Elementor (10px, 15px, 20px) */
.elementor-column-gap-default > .elementor-widget-wrap > .elementor-element .golf-leaderboard-container,
.elementor-column-gap-narrow > .elementor-widget-wrap > .elementor-element .golf-leaderboard-container {
  margin-left: -10px !important;
  margin-right: -10px !important;
  width: calc(100% + 20px) !important;
  max-width: calc(100% + 20px) !important;
}

.elementor-column-gap-extended > .elementor-widget-wrap > .elementor-element .golf-leaderboard-container,
.elementor-column-gap-wide > .elementor-widget-wrap > .elementor-element .golf-leaderboard-container {
  margin-left: -20px !important;
  margin-right: -20px !important;
  width: calc(100% + 40px) !important;
  max-width: calc(100% + 40px) !important;
}

.elementor-column-gap-wider > .elementor-widget-wrap > .elementor-element .golf-leaderboard-container {
  margin-left: -30px !important;
  margin-right: -30px !important;
  width: calc(100% + 60px) !important;
  max-width: calc(100% + 60px) !important;
}
.golf-leaderboard-list,
.leaderboard-list {
  width: 100% !important;
  display: flex;
  flex-direction: column;
  gap: 0 !important;
  background-color: #f8f9fa;
  padding: 0 0 0 5% !important;
  margin: 0 !important;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  /* Fallback: allow capping height via CSS var if JS is unavailable */
  max-height: var(--leaderboard-max-height, none);
  overflow-x: hidden; /* avoid horizontal scrollbar inside Elementor columns */
  box-sizing: border-box !important;
}
.golf-leaderboard-card,
.leaderboard-card {
  background-color: white;
  padding: 6px 4px;
  width: 100% !important;
  margin: 0 !important;
  display: flex;
  gap: 6px;
  box-shadow: none !important;
  border-radius: 0 !important;
  border-bottom: 1px solid #e0e0e0 !important;
  position: relative;
  min-height: 60px;
  flex-shrink: 0;
  min-width: 0; /* allow children to shrink within narrow columns */
  overflow: hidden; /* prevent inner overflow causing horizontal scroll */
  box-sizing: border-box !important;
}
.golf-leaderboard-card:first-child,
.leaderboard-card:first-child {
  border-top: 1px solid #e0e0e0 !important;
}
.golf-leaderboard-card:last-child,
.leaderboard-card:last-child {
  border-bottom: 1px solid #e0e0e0 !important;
}
.golf-leaderboard-card:hover,
.leaderboard-card:hover {
  background-color: #f8f9fa !important;
}
.card-content {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  background: #fff;
  border-radius: 0 !important;
  padding: 6px 4px !important;
  box-shadow: none !important;
  width: 100% !important;
  min-width: 0; /* critical for text ellipsis in constrained containers */
  box-sizing: border-box !important;
  margin: 0 !important;
}
.leaderboard-img,
.name {
  text-align: left;
}
.name {
  flex: 1;
}
.position-box {
  order: 1;
  font-weight: bold;
  font-size: clamp(1em, 2vw, 1.15em);
  text-align: center;
  margin: 0;
  min-width: clamp(36px, 7vw, 70px);
  color: #666;
}
.leaderboard-img,
.avatar-initials {
  order: 2;
  width: clamp(28px, 6vw, 48px);
  height: clamp(28px, 6vw, 48px);
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin: 0 clamp(4px, 2vw, 16px);
}
.name {
  order: 3;
  font-weight: 600;
  font-size: clamp(0.95em, 2vw, 1.12em);
  margin-bottom: 0;
  text-transform: uppercase;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: clamp(60px, 15vw, 120px);
  max-width: clamp(100px, 25vw, 220px);
  display: block;
}
.score,
.score.negative,
.score.positive,
.score.even {
  order: 4;
  font-weight: bold;
  font-size: clamp(1em, 2vw, 1.12em);
  text-align: center;
  min-width: clamp(40px, 8vw, 80px);
  color: #e74c3c;
  display: block;
}
.score.positive {
  color: #27ae60;
}
.score.even {
  color: #333;
}
.thru,
.thru-text {
  order: 5;
  color: #888;
  font-size: clamp(0.95em, 2vw, 1.08em);
  text-align: center;
  min-width: clamp(40px, 10vw, 100px);
  display: block;
}

/* ===== RESPONSIVE ===== */
/* Reorganización de Media Queries para un enfoque Mobile-First */

@media (max-width: 600px) {
  /* **Cambio importante:** Se ajusta el padding del contenedor padre
        para controlar el espacio en los bordes. */
  .round-selector-container {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 8px 0 8px; /* Controla el padding desde aquí */
  }

  /* **Cambio importante:** El select y custom-select-box simplemente
        se ajustan al 100% de su contenedor. */
  .custom-select-box {
    width: 100%;
    margin: 0;
  }
  .round-select {
    width: 100%;
    margin: 0;
    padding: 12px 8px;
    box-sizing: border-box;
  }

  .view-results-btn {
    width: 80vw;
    max-width: 320px;
    padding: 12px;
    font-size: 1em;
    margin: auto;
    display: block;
    text-align: center;
    align-items: center;
  }
}

@media (max-width: 450px) {
  .golf-leaderboard-card .card-content,
  .leaderboard-card .card-content {
    display: grid !important;
    flex-direction: unset !important;
    justify-content: unset !important;
    grid-template-areas: 
      "pos img name score"
      ". . . thru" !important;
    grid-template-columns: 10% 20% 45% 25% !important;
    grid-template-rows: 1fr 1fr !important;
    column-gap: 0 !important;
    row-gap: 0 !important;
    justify-items: center !important;
    align-items: center !important;
    padding: 10px 6px !important;
    margin: 0 !important;
    min-height: 70px !important;
  }
  .position-box {
    grid-area: pos !important;
    order: unset !important;
    margin: 0 !important;
    text-align: center !important;
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    grid-row: span 2 !important;
  }
  .leaderboard-img,
  .avatar-initials {
    grid-area: img !important;
    order: unset !important;
    width: 56px;
    height: 56px;
    margin: 0 !important;
    display: block !important;
    justify-self: center !important;
    align-self: center !important;
    grid-row: span 2 !important;
  }
  .name {
    grid-area: name !important;
    order: unset !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    font-size: 0.95em;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    grid-row: span 2 !important;
  }
  .score,
  .score.negative,
  .score.positive,
  .score.even {
    grid-area: score !important;
    order: unset !important;
    justify-self: center !important;
    align-self: end !important;
    min-width: 0 !important;
    margin: 0 !important;
    font-size: 0.95em;
    text-align: center !important;
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding-bottom: 2px !important;
  }
  .thru,
  .thru-text {
    grid-area: thru !important;
    order: unset !important;
    justify-self: center !important;
    align-self: start !important;
    text-align: center !important;
    white-space: nowrap;
    min-width: 0 !important;
    margin: 0 !important;
    font-size: 0.80em;
    color: #888;
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding-top: 2px !important;
  }
}
@media (min-width: 451px) and (max-width: 600px) {
  .golf-leaderboard-card .card-content,
  .leaderboard-card .card-content {
    justify-content: flex-start !important;
    gap: 0 !important;
    padding: 6px 8px !important;
    width: 100% !important;
    margin: 0 !important;
  }
  .golf-leaderboard-card .position-box,
  .leaderboard-card .position-box {
    flex-basis: 5% !important;
    text-align: center !important;
    margin-right: 1% !important;
    font-size: clamp(0.85em, 2vw, 1em) !important;
    order: 1 !important;
  }
  .golf-leaderboard-card .leaderboard-img,
  .golf-leaderboard-card .avatar-initials,
  .leaderboard-card .leaderboard-img,
  .leaderboard-card .avatar-initials {
    flex-basis: clamp(35px, 6vw, 45px) !important;
    flex-shrink: 0 !important;
    width: clamp(35px, 6vw, 45px) !important;
    height: clamp(35px, 6vw, 45px) !important;
    margin-right: 1.5% !important;
    order: 2 !important;
  }
  .golf-leaderboard-card .name,
  .leaderboard-card .name {
    flex-grow: 0 !important;
    flex-basis: 30% !important;
    text-align: left !important;
    margin-right: auto !important;
    font-size: clamp(0.85em, 2vw, 1em) !important;
    min-width: 80px !important;
    order: 3 !important;
  }
  .golf-leaderboard-card .score,
  .golf-leaderboard-card .score.negative,
  .golf-leaderboard-card .score.positive,
  .golf-leaderboard-card .score.even,
  .leaderboard-card .score,
  .leaderboard-card .score.negative,
  .leaderboard-card .score.positive,
  .leaderboard-card .score.even {
    flex-basis: 8% !important;
    text-align: center !important;
    margin-right: 1% !important;
    font-size: clamp(0.85em, 2vw, 1em) !important;
    order: 4 !important;
    display: inline-block !important;
  }
  .golf-leaderboard-card .thru,
  .golf-leaderboard-card .thru-text,
  .leaderboard-card .thru,
  .leaderboard-card .thru-text {
    flex-basis: 12% !important;
    text-align: right !important;
    margin-right: 2% !important;
    font-size: clamp(0.75em, 1.8vw, 0.9em) !important;
    order: 5 !important;
    display: inline-block !important;
    min-width: auto !important;
  }
}

@media (min-width: 601px) and (max-width: 768px) {
  .golf-leaderboard-card .card-content,
  .leaderboard-card .card-content {
    justify-content: flex-start !important;
    gap: 0 !important;
    padding: 7px 10px !important;
    width: 100% !important;
    margin: 0 !important;
  }
  .golf-leaderboard-card .position-box,
  .leaderboard-card .position-box {
    flex-basis: 5% !important;
    text-align: center !important;
    margin-right: 1% !important;
    font-size: clamp(0.9em, 2.2vw, 1.05em) !important;
    order: 1 !important;
  }
  .golf-leaderboard-card .leaderboard-img,
  .golf-leaderboard-card .avatar-initials,
  .leaderboard-card .leaderboard-img,
  .leaderboard-card .avatar-initials {
    flex-basis: clamp(40px, 7vw, 50px) !important;
    flex-shrink: 0 !important;
    width: clamp(40px, 7vw, 50px) !important;
    height: clamp(40px, 7vw, 50px) !important;
    margin-right: 1.8% !important;
    order: 2 !important;
  }
  .golf-leaderboard-card .name,
  .leaderboard-card .name {
    flex-grow: 0 !important;
    flex-basis: 32% !important;
    text-align: left !important;
    margin-right: auto !important;
    font-size: clamp(0.9em, 2.2vw, 1.05em) !important;
    min-width: 90px !important;
    order: 3 !important;
  }
  .golf-leaderboard-card .score,
  .golf-leaderboard-card .score.negative,
  .golf-leaderboard-card .score.positive,
  .golf-leaderboard-card .score.even,
  .leaderboard-card .score,
  .leaderboard-card .score.negative,
  .leaderboard-card .score.positive,
  .leaderboard-card .score.even {
    flex-basis: 9% !important;
    text-align: center !important;
    margin-right: 1.5% !important;
    font-size: clamp(0.9em, 2.2vw, 1.05em) !important;
    order: 4 !important;
    display: inline-block !important;
  }
  .golf-leaderboard-card .thru,
  .golf-leaderboard-card .thru-text,
  .leaderboard-card .thru,
  .leaderboard-card .thru-text {
    flex-basis: 13% !important;
    text-align: right !important;
    margin-right: 2.5% !important;
    font-size: clamp(0.8em, 2vw, 0.95em) !important;
    order: 5 !important;
    display: inline-block !important;
    min-width: auto !important;
  }
}

@media (min-width: 769px) and (max-width: 900px) {
  .golf-leaderboard-card .card-content,
  .leaderboard-card .card-content {
    justify-content: flex-start !important;
    gap: 0 !important;
    padding: 8px 12px !important;
    width: 100% !important;
    margin: 0 !important;
  }
  .golf-leaderboard-card .position-box,
  .leaderboard-card .position-box {
    flex-basis: 5% !important;
    text-align: center !important;
    margin-right: 1% !important;
    font-size: clamp(1em, 2.5vw, 1.08em) !important;
    order: 1 !important;
  }
  .golf-leaderboard-card .leaderboard-img,
  .golf-leaderboard-card .avatar-initials,
  .leaderboard-card .leaderboard-img,
  .leaderboard-card .avatar-initials {
    flex-basis: clamp(45px, 8vw, 55px) !important;
    flex-shrink: 0 !important;
    width: clamp(45px, 8vw, 55px) !important;
    height: clamp(45px, 8vw, 55px) !important;
    margin-right: 2% !important;
    order: 2 !important;
  }
  .golf-leaderboard-card .name,
  .leaderboard-card .name {
    flex-grow: 0 !important;
    flex-basis: 35% !important;
    text-align: left !important;
    margin-right: auto !important;
    font-size: clamp(1em, 2.5vw, 1.08em) !important;
    min-width: 100px !important;
    order: 3 !important;
  }
  .golf-leaderboard-card .score,
  .golf-leaderboard-card .score.negative,
  .golf-leaderboard-card .score.positive,
  .golf-leaderboard-card .score.even,
  .leaderboard-card .score,
  .leaderboard-card .score.negative,
  .leaderboard-card .score.positive,
  .leaderboard-card .score.even {
    flex-basis: 10% !important;
    text-align: center !important;
    margin-right: 2% !important;
    font-size: clamp(1em, 2.5vw, 1.08em) !important;
    order: 4 !important;
    display: inline-block !important;
  }
  .golf-leaderboard-card .thru,
  .golf-leaderboard-card .thru-text,
  .leaderboard-card .thru,
  .leaderboard-card .thru-text {
    flex-basis: 15% !important;
    text-align: right !important;
    margin-right: 3% !important;
    font-size: clamp(0.85em, 2.2vw, 1em) !important;
    order: 5 !important;
    display: inline-block !important;
    min-width: auto !important;
  }
}
@media (min-width: 901px) and (max-width: 1200px) {
  /* Para laptops pequeños/medianos - usar layout apilado con imágenes pequeñas */
  .golf-leaderboard-card .card-content,
  .leaderboard-card .card-content {
    display: grid !important;
    flex-direction: unset !important;
    justify-content: unset !important;
    grid-template-areas: 
      "pos img name score"
      ". . . thru" !important;
    grid-template-columns: 8% 12% 60% 20% !important;
    grid-template-rows: 1fr 1fr !important;
    column-gap: 0 !important;
    row-gap: 0 !important;
    justify-items: center !important;
    align-items: center !important;
    padding: 8px 10px !important;
    margin: 0 !important;
    min-height: 65px !important;
  }
  .golf-leaderboard-card .position-box,
  .leaderboard-card .position-box {
    grid-area: pos !important;
    order: unset !important;
    margin: 0 !important;
    text-align: center !important;
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    grid-row: span 2 !important;
    font-size: clamp(1em, 2.5vw, 1.1em) !important;
  }
  .golf-leaderboard-card .leaderboard-img,
  .golf-leaderboard-card .avatar-initials,
  .leaderboard-card .leaderboard-img,
  .leaderboard-card .avatar-initials {
    grid-area: img !important;
    order: unset !important;
    width: clamp(40px, 5vw, 50px) !important;
    height: clamp(40px, 5vw, 50px) !important;
    margin: 0 !important;
    display: block !important;
    justify-self: center !important;
    align-self: center !important;
    grid-row: span 2 !important;
  }
  .golf-leaderboard-card .name,
  .leaderboard-card .name {
    grid-area: name !important;
    order: unset !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    font-size: clamp(1em, 2.5vw, 1.1em) !important;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    grid-row: span 2 !important;
  }
  .golf-leaderboard-card .score,
  .golf-leaderboard-card .score.negative,
  .golf-leaderboard-card .score.positive,
  .golf-leaderboard-card .score.even,
  .leaderboard-card .score,
  .leaderboard-card .score.negative,
  .leaderboard-card .score.positive,
  .leaderboard-card .score.even {
    grid-area: score !important;
    order: unset !important;
    justify-self: center !important;
    align-self: end !important;
    min-width: 0 !important;
    margin: 0 !important;
    font-size: clamp(1em, 2.5vw, 1.1em) !important;
    text-align: center !important;
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding-bottom: 2px !important;
  }
  .golf-leaderboard-card .thru,
  .golf-leaderboard-card .thru-text,
  .leaderboard-card .thru,
  .leaderboard-card .thru-text {
    grid-area: thru !important;
    order: unset !important;
    justify-self: center !important;
    align-self: start !important;
    text-align: center !important;
    white-space: nowrap;
    min-width: 0 !important;
    margin: 0 !important;
    font-size: clamp(0.8em, 2.2vw, 0.95em) !important;
    color: #888;
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding-top: 2px !important;
  }
}

@media (min-width: 1201px) {
  /* Para pantallas grandes - layout horizontal tradicional */
  .golf-leaderboard-card .card-content,
  .leaderboard-card .card-content {
    justify-content: flex-start !important;
    gap: 0 !important;
    padding: 8px 12px !important;
    width: 100% !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
  }
  .golf-leaderboard-card .position-box,
  .leaderboard-card .position-box {
    flex-basis: 5% !important;
    text-align: center !important;
    margin-right: 1% !important;
    font-size: 1em !important;
    order: 1 !important;
  }
  .golf-leaderboard-card .leaderboard-img,
  .golf-leaderboard-card .avatar-initials,
  .leaderboard-card .leaderboard-img,
  .leaderboard-card .avatar-initials {
    flex-basis: 45px !important;
    flex-shrink: 0 !important;
    width: 45px !important;
    height: 45px !important;
    margin-right: 2% !important;
    order: 2 !important;
  }
  .golf-leaderboard-card .name,
  .leaderboard-card .name {
    flex-grow: 0 !important;
    flex-basis: 35% !important;
    text-align: left !important;
    margin-right: auto !important;
    min-width: 120px !important;
    font-size: 1em !important;
    order: 3 !important;
  }
  .golf-leaderboard-card .score,
  .golf-leaderboard-card .score.negative,
  .golf-leaderboard-card .score.positive,
  .golf-leaderboard-card .score.even,
  .leaderboard-card .score,
  .leaderboard-card .score.negative,
  .leaderboard-card .score.positive,
  .leaderboard-card .score.even {
    flex-basis: 10% !important;
    text-align: center !important;
    margin-right: 2% !important;
    font-size: 1em !important;
    order: 4 !important;
    display: inline-block !important;
  }
  .golf-leaderboard-card .thru,
  .golf-leaderboard-card .thru-text,
  .leaderboard-card .thru,
  .leaderboard-card .thru-text {
    flex-basis: 15% !important;
    text-align: right !important;
    margin-right: 3% !important;
    font-size: 1em !important;
    order: 5 !important;
    display: inline-block !important;
    min-width: auto !important;
  }
}

/* ===== LOADER ===== */
.golf-loader,
#loader {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  width: 64px;
  height: 64px;
  margin-top: -32px;
  margin-left: -32px;
  border: 6px solid #ccc;
  border-top-color: #2c3e50;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 1000;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== SNACKBAR ===== */
.golf-snackbar {
  visibility: hidden;
  min-width: 280px;
  background-color: #333;
  color: #fff;
  text-align: center;
  padding: 12px 16px;
  border-radius: 6px;
  position: absolute;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.5s ease, bottom 0.5s ease;
  font-size: 14px;
}
.golf-snackbar.show {
  visibility: visible;
  opacity: 1;
  bottom: 50px;
}

/* Ensure the container is positioned relative for absolute snackbar */
.golf-leaderboard-container {
  position: relative;
}

/* ===== CONTAINER-QUERY ADAPTATION (Elementor columns) ===== */
/* The parent container now has container-type: inline-size; container-name: leaderboard; */

/* Medium columns: usar layout apilado para mejor responsividad */
@container leaderboard (min-width: 481px) and (max-width: 800px) {
  .golf-leaderboard-card .card-content,
  .leaderboard-card .card-content {
    display: grid !important;
    flex-direction: unset !important;
    justify-content: unset !important;
    grid-template-areas: 
      "pos img name score"
      ". . . thru" !important;
    grid-template-columns: 8% 18% 52% 22% !important;
    grid-template-rows: 1fr 1fr !important;
    column-gap: 0 !important;
    row-gap: 0 !important;
    justify-items: center !important;
    align-items: center !important;
    padding: 8px 12px !important;
    margin: 0 !important;
    min-height: 65px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .golf-leaderboard-card .position-box,
  .leaderboard-card .position-box { 
    grid-area: pos !important;
    grid-row: span 2 !important;
    text-align: center !important;
    font-size: clamp(0.9em, 4cqw, 1.05em) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
  }
  .golf-leaderboard-card .leaderboard-img,
  .golf-leaderboard-card .avatar-initials,
  .leaderboard-card .leaderboard-img,
  .leaderboard-card .avatar-initials { 
    grid-area: img !important;
    grid-row: span 2 !important;
    width: clamp(40px, 12cqw, 64px) !important; 
    height: clamp(40px, 12cqw, 64px) !important; 
    justify-self: center !important;
    align-self: center !important;
  }
  .golf-leaderboard-card .name,
  .leaderboard-card .name { 
    grid-area: name !important;
    grid-row: span 2 !important;
    text-align: center !important;
    font-size: clamp(0.85em, 4cqw, 1.02em) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .golf-leaderboard-card .score,
  .golf-leaderboard-card .score.negative,
  .golf-leaderboard-card .score.positive,
  .golf-leaderboard-card .score.even,
  .leaderboard-card .score,
  .leaderboard-card .score.negative,
  .leaderboard-card .score.positive,
  .leaderboard-card .score.even { 
    grid-area: score !important;
    justify-self: center !important;
    align-self: end !important;
    text-align: center !important;
    font-size: clamp(0.85em, 4cqw, 1.02em) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    padding-bottom: 2px !important;
  }
  .golf-leaderboard-card .thru,
  .golf-leaderboard-card .thru-text,
  .leaderboard-card .thru,
  .leaderboard-card .thru-text { 
    grid-area: thru !important;
    justify-self: center !important;
    align-self: start !important;
    text-align: center !important;
    font-size: clamp(0.75em, 3.5cqw, 0.9em) !important;
    color: #888 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    padding-top: 2px !important;
    min-width: auto !important;
  }
}

/* Wide columns: usar layout apilado hasta llegar a pantallas muy amplias */
@container leaderboard (min-width: 801px) and (max-width: 1200px) {
  .golf-leaderboard-card .card-content,
  .leaderboard-card .card-content {
    display: grid !important;
    flex-direction: unset !important;
    justify-content: unset !important;
    grid-template-areas: 
      "pos img name score"
      ". . . thru" !important;
    grid-template-columns: 7% 15% 56% 22% !important;
    grid-template-rows: 1fr 1fr !important;
    column-gap: 0 !important;
    row-gap: 0 !important;
    justify-items: center !important;
    align-items: center !important;
    padding: clamp(8px, 2.5cqw, 16px) clamp(12px, 4cqw, 28px) !important;
    margin: 0 !important;
    min-height: 70px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .golf-leaderboard-card .position-box,
  .leaderboard-card .position-box { 
    grid-area: pos !important;
    grid-row: span 2 !important;
    text-align: center !important;
    font-size: clamp(1em, 5cqw, 1.15em) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
  }
  .golf-leaderboard-card .leaderboard-img,
  .golf-leaderboard-card .avatar-initials,
  .leaderboard-card .leaderboard-img,
  .leaderboard-card .avatar-initials { 
    grid-area: img !important;
    grid-row: span 2 !important;
    width: clamp(56px, 8cqw, 80px) !important; 
    height: clamp(56px, 8cqw, 80px) !important; 
    justify-self: center !important;
    align-self: center !important;
  }
  .golf-leaderboard-card .name,
  .leaderboard-card .name { 
    grid-area: name !important;
    grid-row: span 2 !important;
    text-align: center !important;
    font-size: clamp(1em, 5cqw, 1.15em) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .golf-leaderboard-card .score,
  .golf-leaderboard-card .score.negative,
  .golf-leaderboard-card .score.positive,
  .golf-leaderboard-card .score.even,
  .leaderboard-card .score,
  .leaderboard-card .score.negative,
  .leaderboard-card .score.positive,
  .leaderboard-card .score.even { 
    grid-area: score !important;
    justify-self: center !important;
    align-self: end !important;
    text-align: center !important;
    font-size: clamp(1em, 5cqw, 1.15em) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    padding-bottom: 2px !important;
  }
  .golf-leaderboard-card .thru,
  .golf-leaderboard-card .thru-text,
  .leaderboard-card .thru,
  .leaderboard-card .thru-text { 
    grid-area: thru !important;
    justify-self: center !important;
    align-self: start !important;
    text-align: center !important;
    font-size: clamp(0.85em, 4.5cqw, 1em) !important;
    color: #888 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    padding-top: 2px !important;
    min-width: auto !important;
  }
}

/* Solo para pantallas realmente amplias usar layout horizontal */
@container leaderboard (min-width: 1201px) {
  .golf-leaderboard-card .card-content,
  .leaderboard-card .card-content { 
    justify-content: flex-start !important;
    gap: 0 !important;
    padding: clamp(10px, 3cqw, 20px) clamp(15px, 5cqw, 35px) !important;
    margin: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
  }
  .golf-leaderboard-card .position-box,
  .leaderboard-card .position-box { 
    flex-basis: 5% !important;
    text-align: center !important;
    margin-right: 1% !important;
    font-size: clamp(1.1em, 6cqw, 1.3em) !important;
    order: 1 !important;
  }
  .golf-leaderboard-card .leaderboard-img,
  .golf-leaderboard-card .avatar-initials,
  .leaderboard-card .leaderboard-img,
  .leaderboard-card .avatar-initials { 
    flex-basis: clamp(70px, 10cqw, 90px) !important;
    flex-shrink: 0 !important;
    width: clamp(70px, 10cqw, 90px) !important; 
    height: clamp(70px, 10cqw, 90px) !important; 
    margin-right: 2% !important;
    order: 2 !important;
  }
  .golf-leaderboard-card .name,
  .leaderboard-card .name { 
    flex-grow: 0 !important;
    flex-basis: 35% !important;
    text-align: left !important;
    margin-right: auto !important;
    font-size: clamp(1.1em, 6cqw, 1.3em) !important;
    order: 3 !important;
    min-width: clamp(140px, 35cqw, 280px) !important;
  }
  .golf-leaderboard-card .score,
  .golf-leaderboard-card .score.negative,
  .golf-leaderboard-card .score.positive,
  .golf-leaderboard-card .score.even,
  .leaderboard-card .score,
  .leaderboard-card .score.negative,
  .leaderboard-card .score.positive,
  .leaderboard-card .score.even { 
    flex-basis: 10% !important;
    text-align: center !important;
    margin-right: 2% !important;
    font-size: clamp(1.1em, 6cqw, 1.3em) !important;
    order: 4 !important;
    display: inline-block !important;
  }
  .golf-leaderboard-card .thru,
  .golf-leaderboard-card .thru-text,
  .leaderboard-card .thru,
  .leaderboard-card .thru-text { 
    flex-basis: 15% !important;
    text-align: right !important;
    margin-right: 3% !important;
    font-size: clamp(1.1em, 6cqw, 1.3em) !important;
    order: 5 !important;
    display: inline-block !important;
    min-width: auto !important;
  }
}
