/* ═══════════════════════════════════════════════════════════════
   RANKING.CSS — Bádminton Perú
   Sección ranking nacional homepage
   → En Angular: ranking.component.scss
   ═══════════════════════════════════════════════════════════════ */

/* ── Sección ──────────────────────────────────────────────────── */
.bp-ranking {
  background: #111;
  padding: 48px 0 56px;
  border-top: 3px solid var(--bp-red);
  border-bottom: 3px solid var(--bp-red);
}

/* ── Header de sección ────────────────────────────────────────── */
.bp-ranking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.bp-ranking-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bp-ranking-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--bp-red);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.bp-ranking-title {
  font-size: 28px;
  font-weight: 900;
  color: var(--bp-white);
  text-transform: uppercase;
  letter-spacing: 1px;
  line-height: 1.1;
}

/* ── Filtros ──────────────────────────────────────────────────── */
.bp-ranking-filters {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.bp-ranking-select {
  font-family: var(--bp-font);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--bp-white);
  background: #1e1e1e;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
  padding: 8px 12px;
  cursor: pointer;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}

.bp-ranking-select:focus,
.bp-ranking-select:hover {
  border-color: var(--bp-red);
}

.bp-ranking-select option {
  background: #1e1e1e;
  color: var(--bp-white);
}

/* ── Tabs de modalidad ────────────────────────────────────────── */
.bp-ranking-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: #1a1a1a;
  border-radius: 6px;
  padding: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.bp-ranking-tabs::-webkit-scrollbar {
  display: none;
}

.bp-ranking-tab {
  font-family: var(--bp-font);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #555;
  background: transparent;
  border: none;
  border-radius: 4px;
  padding: 10px 16px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s;
}

.bp-ranking-tab:hover {
  color: #888;
  background: #222;
}

.bp-ranking-tab.active {
  background: var(--bp-red);
  color: var(--bp-white);
  box-shadow: 0 2px 8px rgba(204, 0, 0, 0.4);
}

/* ── Tabla ────────────────────────────────────────────────────── */
.bp-ranking-table-wrap {
  background: #1a1a1a;
  border-radius: 8px;
  border: 1px solid #2a2a2a;
  overflow: hidden;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.bp-ranking-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
  font-family: var(--bp-font);
}

/* Cabecera */
.bp-ranking-table thead th {
  background: var(--bp-red);
  color: var(--bp-white);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 12px 14px;
  text-align: left;
  border: none;
  white-space: nowrap;
}

.bp-ranking-table thead th.center {
  text-align: center;
}

/* Filas */
.bp-ranking-table tbody tr {
  border-bottom: 1px solid #222;
  transition: background 0.15s;
}

.bp-ranking-table tbody tr:last-child {
  border-bottom: none;
}

.bp-ranking-table tbody tr:hover {
  background: #222;
}

/* Franjas 1°/2°/3° */
.bp-ranking-table tbody tr:nth-child(1) td.bp-rank-cell .bp-rank-box { background: #b8860b; }
.bp-ranking-table tbody tr:nth-child(2) td.bp-rank-cell .bp-rank-box { background: #4a4a4a; }
.bp-ranking-table tbody tr:nth-child(3) td.bp-rank-cell .bp-rank-box { background: #7a3b1e; }

.bp-ranking-table tbody td {
  padding: 10px 14px;
  vertical-align: middle;
  color: var(--bp-white);
  font-size: 13px;
  background: transparent;
}

/* Celda N° */
.bp-rank-cell {
  width: 52px;
  padding: 0 !important;
}

.bp-rank-box {
  background: #1f2a44;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bp-rank-num {
  color: var(--bp-white);
  font-size: 12px;
  font-weight: 900;
  font-family: var(--bp-font);
}

/* Celda foto */
.bp-foto-cell {
  width: 72px;
  text-align: center;
}

.bp-foto-wrap {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #2a2a2a;
  margin: 0 auto;
  background: #222;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bp-foto-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bp-foto-dobles {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.bp-foto-dobles .bp-foto-wrap {
  width: 32px;
  height: 32px;
}

/* Celda deportista */
.bp-deportista-nombre {
  font-size: 13px;
  font-weight: 700;
  color: var(--bp-white);
  line-height: 1.35;
  display: block;
}

/* Celda puntaje */
.bp-puntaje {
  font-size: 16px;
  font-weight: 900;
  color: var(--bp-red);
  font-family: var(--bp-font);
}

/* Celda fecha / club */
.bp-ranking-table td.center {
  text-align: center;
  color: #666;
  font-size: 11px;
  font-weight: 600;
}

/* Botón torneos */
.bp-btn-torneos {
  font-family: var(--bp-font);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--bp-white);
  background: var(--bp-red);
  border: none;
  border-radius: 3px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.bp-btn-torneos:hover {
  background: var(--bp-red-dark);
}

/* ── Loading ──────────────────────────────────────────────────── */
.bp-ranking-loading {
  text-align: center;
  padding: 48px 20px;
  color: #555;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.bp-ranking-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #2a2a2a;
  border-top: 3px solid var(--bp-red);
  border-radius: 50%;
  animation: bp-spin 0.8s linear infinite;
  margin: 0 auto 14px;
}

@keyframes bp-spin {
  to { transform: rotate(360deg); }
}

/* ── Error / sin resultados ───────────────────────────────────── */
.bp-ranking-empty {
  text-align: center;
  padding: 48px 20px;
  color: #444;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

/* ── Modal torneos ────────────────────────────────────────────── */
.bp-ranking-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.bp-ranking-modal-overlay.open {
  display: flex;
}

.bp-ranking-modal {
  background: #1a1a1a;
  border: 2px solid var(--bp-red);
  border-radius: 8px;
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bp-ranking-modal-head {
  background: var(--bp-red);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.bp-ranking-modal-head h3 {
  color: var(--bp-white);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.bp-ranking-modal-close {
  background: rgba(0,0,0,0.3);
  border: none;
  color: var(--bp-white);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.bp-ranking-modal-close:hover {
  background: rgba(0,0,0,0.5);
}

.bp-ranking-modal-body {
  padding: 20px;
  overflow-y: auto;
  color: #ccc;
  font-size: 13px;
  line-height: 1.6;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .bp-ranking-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .bp-ranking-filters {
    width: 100%;
  }

  .bp-ranking-select {
    flex: 1;
    min-width: 0;
  }

  .bp-ranking-title {
    font-size: 22px;
  }

  .bp-ranking-table tbody td {
    font-size: 12px;
    padding: 8px 10px;
  }
}

/* ── Scroll interno — tabla con altura fija ──────────────────── */
#bp-ranking-content {
  max-height: 620px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--bp-red) #1a1a1a;
}

#bp-ranking-content::-webkit-scrollbar {
  width: 6px;
}
#bp-ranking-content::-webkit-scrollbar-track {
  background: #1a1a1a;
}
#bp-ranking-content::-webkit-scrollbar-thumb {
  background: var(--bp-red);
  border-radius: 3px;
}

#bp-ranking-content .bp-ranking-table-wrap {
  overflow-x: auto;
  overflow-y: visible;
}


/* ═══════════════════════════════════════════════════════════════
   TOP 3 — podio (2° izq · 1° centro · 3° der)
   ═══════════════════════════════════════════════════════════════ */
.bp-top3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
  padding: 4px 2px 0;
}

.bp-t3-card {
  --t3-glow: #2a2a2a;
  --t3-accent: #CC0000;
  --t3-num: #bbb;
  height: 368px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  background: linear-gradient(135deg, #050505 0%, #161616 55%, var(--t3-glow) 100%);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
  font-family: var(--bp-font);
}

.bp-t3-card--1 { height: 405px; --t3-glow: #3a0000; --t3-num: #E01E26; }
.bp-t3-card--3 { --t3-glow: #2a2410; --t3-accent: #8B6914; --t3-num: #c9a227; }

/* Cabecera */
.bp-t3-head {
  padding: 12px 16px 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.bp-t3-num {
  font-size: 20px;
  font-weight: 900;
  font-style: italic;
  line-height: 1;
  color: var(--t3-num);
}

.bp-t3-card--1 .bp-t3-num { font-size: 26px; }

.bp-t3-label {
  font-size: 12px;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 1px;
  line-height: 1.1;
  color: #fff;
}

/* Foto rectangular centrada (aquí luego entra GIF/video) */
.bp-t3-photo-wrap {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.bp-t3-photo {
  width: 146px;
  height: 157px;
  border: 3px solid #fff;
  box-sizing: border-box;
  overflow: hidden;
  background: #1c1c1c;
  display: flex;
}

.bp-t3-card--1 .bp-t3-photo { width: 162px; height: 174px; }

.bp-t3-photo img,
.bp-t3-photo video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

/* Dobles: dos fotos lado a lado */
.bp-t3-photo--dobles { gap: 2px; background: #fff; }
.bp-t3-photo--dobles img { width: calc(50% - 1px); }

/* Nombre */
.bp-t3-info {
  padding: 12px 16px 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.bp-t3-ape {
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  text-transform: uppercase;
  line-height: 1.05;
  word-break: break-word;
}

.bp-t3-nom {
  font-size: 17px;
  font-weight: 400;
  color: #ddd;
  line-height: 1.2;
}

.bp-t3-ape--dobles { font-size: 14px; line-height: 1.2; }
.bp-t3-ape--dobles span { font-weight: 400; color: #ddd; text-transform: none; }

.bp-t3-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 12px;
}

.bp-t3-club {
  background: var(--t3-accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.bp-t3-nac {
  font-size: 11px;
  font-weight: 600;
  color: #aaa;
}

/* Bloques inferiores pegados al borde */
.bp-t3-stats {
  display: flex;
  height: 62px;
  flex-shrink: 0;
}

.bp-t3-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.bp-t3-stat--pts { flex: 1; background: #E01E26; }
.bp-t3-stat--tp  { width: 38%; background: #333; }

.bp-t3-stat-label { font-size: 11px; font-weight: 500; }
.bp-t3-stat-val   { font-size: 24px; font-weight: 900; line-height: 1.1; }
.bp-t3-card--1 .bp-t3-stat--pts .bp-t3-stat-val { font-size: 28px; }
.bp-t3-stat--tp .bp-t3-stat-val { font-size: 22px; }

/* Botón ver ranking completo / volver */
.bp-t3-actions {
  display: flex;
  justify-content: center;
  margin-top: 22px;
  padding-bottom: 4px;
}

.bp-t3-btn {
  font-family: var(--bp-font);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--bp-red);
  background: transparent;
  border: 2px solid var(--bp-red);
  border-radius: 6px;
  padding: 11px 40px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.bp-t3-btn:hover { background: var(--bp-red); color: #fff; }

.bp-t3-btn--sm { font-size: 10px; letter-spacing: 1.5px; padding: 8px 20px; border-width: 1px; }

.bp-t3-back {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #111;
  padding: 0 0 10px;
}

/* Móvil: tarjetas apiladas, 1° primero, sin escalonado */
@media (max-width: 760px) {
  .bp-top3 { grid-template-columns: 1fr; align-items: stretch; }
  .bp-t3-card,
  .bp-t3-card--1 { height: 368px; }
  .bp-t3-card--1 { order: -1; }
}

/* Dobles: cada foto con su propio marco, separadas y ocupando todo el ancho */
.bp-t3-card .bp-t3-photo--dobles,
.bp-t3-card--1 .bp-t3-photo--dobles {
  width: calc(100% - 32px);
  border: 0;
  background: transparent;
  gap: 10px;
}

.bp-t3-photo--dobles img {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  border: 3px solid #fff;
  box-sizing: border-box;
  background: #1c1c1c;
}


/* ═══════════════════════════════════════════════════════════════
   MÓVIL (≤ 640px)
   · Top 3: carrusel deslizable (1° primero) en vez de 3 cards apiladas
   · Tabla completa: filas compactas de 2 líneas, sin scroll horizontal
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {

  .bp-ranking { padding: 32px 0 40px; }

  /* ── Top 3: carrusel ── */
  .bp-top3 {
    display: flex;
    gap: 12px;
    align-items: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 0 6px;
  }
  .bp-top3::-webkit-scrollbar { display: none; }

  .bp-t3-card,
  .bp-t3-card--1 {
    order: 0;
    flex: 0 0 82%;
    height: 392px;
    scroll-snap-align: center;
  }
  .bp-t3-card--1 { order: -1; }

  .bp-t3-card--1 .bp-t3-photo,
  .bp-t3-photo { width: 156px; height: 168px; }

  .bp-t3-card .bp-t3-photo--dobles,
  .bp-t3-card--1 .bp-t3-photo--dobles { width: calc(100% - 32px); height: 168px; }

  .bp-t3-actions { margin-top: 14px; }
  .bp-t3-btn { padding: 11px 28px; }

  /* ── Tabla completa: filas compactas ── */
  #bp-ranking-content .bp-ranking-table-wrap { overflow-x: hidden; }

  .bp-ranking-table { min-width: 0; display: block; }
  .bp-ranking-table thead { display: none; }
  .bp-ranking-table tbody { display: block; }

  .bp-ranking-table tbody tr {
    display: grid;
    grid-template-columns: 38px auto auto auto 1fr auto;
    grid-template-areas:
      "rank foto name  name  name pts"
      "rank foto fecha club  .    tp";
    column-gap: 10px;
    row-gap: 4px;
    align-items: center;
    padding: 0 12px 0 0;
  }

  .bp-ranking-table tbody td { padding: 0; border: 0; }

  .bp-ranking-table tbody td.bp-rank-cell { grid-area: rank; align-self: stretch; width: auto; }
  .bp-ranking-table tbody td.bp-rank-cell .bp-rank-box { height: 100%; min-height: 64px; }
  .bp-ranking-table tbody td.bp-foto-cell { grid-area: foto; width: auto; padding: 8px 0; }
  .bp-ranking-table tbody td.c-name  { grid-area: name;  padding-top: 8px; min-width: 0; }
  .bp-ranking-table tbody td.c-fecha { grid-area: fecha; text-align: left; font-size: 10px; padding-bottom: 8px; line-height: 1.3; }
  .bp-ranking-table tbody td.c-club  { grid-area: club;  text-align: left; font-size: 10px; padding-bottom: 8px; color: #999; }
  .bp-ranking-table tbody td.c-pts   { grid-area: pts;   text-align: right; padding-top: 8px; }
  .bp-ranking-table tbody td.c-tp    { grid-area: tp;    text-align: right; padding-bottom: 8px; }

  .bp-ranking-table tbody td.c-pts .bp-puntaje { font-size: 15px; }
  .bp-deportista-nombre { font-size: 12px; }
  .bp-btn-torneos { padding: 5px 10px; }
}
