/*! JDServer-Webs — rankings_history.css */

#rankings-history{
  margin:12px 0 32px;
  color:var(--text, inherit);
  color-scheme:light dark;
}

.rh-wrap{
  display:grid;
  gap:18px;
}

.rh-hero{
  position:relative;
  overflow:hidden;
  isolation:isolate;
  border:1px solid var(--border);
  border-radius:24px;
  background:
    radial-gradient(1200px 300px at 0% 0%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 60%),
    radial-gradient(900px 260px at 100% 100%, color-mix(in srgb, var(--brand-2, var(--brand)) 14%, transparent), transparent 62%),
    var(--card);
  box-shadow:0 14px 40px rgba(2,6,23,.08);
}

.rh-hero-inner{
  padding:22px 20px;
  display:grid;
  gap:10px;
}

.rh-kicker{
  display:inline-flex;
  width:max-content;
  align-items:center;
  gap:.45rem;
  border:1px solid var(--border);
  background:color-mix(in srgb, var(--card) 88%, transparent);
  padding:.38rem .72rem;
  border-radius:999px;
  font-size:.82rem;
  color:var(--muted);
  backdrop-filter:blur(8px);
}

.rh-title{
  font-size:clamp(1.55rem, 2vw, 2.1rem);
  line-height:1.08;
  font-weight:800;
  letter-spacing:-.02em;
}

.rh-subtitle{
  color:var(--muted);
  max-width:76ch;
  line-height:1.55;
}

.rh-meta{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:4px;
}

.rh-chip{
  display:inline-flex;
  align-items:center;
  gap:.45rem;
  padding:.42rem .72rem;
  border-radius:999px;
  border:1px solid var(--border);
  background:var(--card);
  color:var(--muted);
  font-size:.84rem;
}

.rh-panel{
  border:1px solid var(--border);
  border-radius:22px;
  background:var(--card);
  box-shadow:0 10px 28px rgba(2,6,23,.05);
  padding:16px;
}

.rh-controls{
  display:grid;
  grid-template-columns:1.2fr 1.8fr .9fr .8fr .9fr;
  gap:12px;
  align-items:end;
}

.rh-field{
  display:grid;
  gap:6px;
}

.rh-label{
  font-size:.82rem;
  color:var(--muted);
}

.rh-select,
.rh-input{
  width:100%;
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--bg-elevated, var(--card));
  color:var(--text, inherit);
  padding:.68rem .75rem;
  font:inherit;
  font-size:.94rem;
}

.rh-select{
  cursor:pointer;
}

.rh-results-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  margin:16px 0 10px;
}

.rh-results-title{
  margin:0;
  font-size:1.05rem;
  font-weight:750;
}

.rh-results-sub{
  color:var(--muted);
  font-size:.86rem;
}

.rh-list{
  display:grid;
  gap:9px;
}

.rh-item{
  display:grid;
  grid-template-columns:auto 1fr auto;
  align-items:center;
  gap:12px;
  padding:12px 13px;
  border-radius:18px;
  border:1px solid var(--border);
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--brand) 7%, var(--card)) 0%,
      color-mix(in srgb, var(--brand) 3%, var(--card)) 100%
    );
  box-shadow:0 8px 20px rgba(2,6,23,.04);
}

.rh-pos{
  width:34px;
  height:34px;
  border-radius:999px;
  display:grid;
  place-items:center;
  font-size:.9rem;
  font-weight:850;
  color:var(--brand);
  background:color-mix(in srgb, var(--brand) 14%, transparent);
  border:1px solid color-mix(in srgb, var(--brand) 22%, var(--border));
}

.rh-main{
  min-width:0;
}

.rh-item-title{
  font-weight:700;
  line-height:1.2;
}

.rh-item-sub{
  margin-top:3px;
  color:var(--muted);
  font-size:.84rem;
}

.rh-value{
  font-size:1.1rem;
  font-weight:850;
  white-space:nowrap;
}

.rh-empty,
.rh-error{
  border:1px solid var(--border);
  border-radius:18px;
  background:var(--card);
  padding:14px;
  color:var(--muted);
}

@media (max-width: 980px){
  .rh-controls{
    grid-template-columns:repeat(2, minmax(0,1fr));
  }
}

@media (max-width: 640px){
  .rh-hero-inner{
    padding:18px 16px;
  }

  .rh-panel{
    padding:13px;
  }

  .rh-controls{
    grid-template-columns:minmax(0,1fr);
  }

  .rh-item{
    grid-template-columns:auto 1fr;
  }

  .rh-value{
    grid-column:2;
    justify-self:start;
  }
}

/* --- Rankings históricos: versión 3 paneles --- */

.rh-panels{
  display:grid;
  gap:18px;
}

.rh-panel-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:12px;
}

.rh-controls-annual{
  grid-template-columns:minmax(220px, 1.6fr) minmax(130px, .6fr);
}

.rh-controls-monthly{
  grid-template-columns:minmax(220px, 1.6fr) minmax(150px, .8fr) minmax(130px, .6fr);
}

.rh-controls-daily{
  grid-template-columns:minmax(220px, 1.6fr) minmax(150px, .8fr) minmax(100px, .5fr) minmax(130px, .6fr);
}

.rh-panel .rh-list{
  margin-top:12px;
}

@media (max-width: 980px){
  .rh-controls-annual,
  .rh-controls-monthly,
  .rh-controls-daily{
    grid-template-columns:repeat(2, minmax(0,1fr));
  }
}

@media (max-width: 640px){
  .rh-controls-annual,
  .rh-controls-monthly,
  .rh-controls-daily{
    grid-template-columns:minmax(0,1fr);
  }
}

/* --- Rankings históricos: sin selector de número de resultados --- */

.rh-controls-annual{
  grid-template-columns:minmax(260px, 1fr);
}

.rh-controls-monthly{
  grid-template-columns:minmax(220px, 1.4fr) minmax(150px, .8fr);
}

.rh-controls-daily{
  grid-template-columns:minmax(220px, 1.4fr) minmax(150px, .8fr) minmax(100px, .5fr);
}

/* --- Resumen absoluto superior: Top 5 de toda la serie --- */

.rh-overview{
  border:1px solid var(--border);
  border-radius:22px;
  background:var(--card);
  box-shadow:0 10px 28px rgba(2,6,23,.05);
  padding:16px;
}

.rh-overview-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:12px;
}

.rh-overview-title{
  margin:0;
  font-size:1.08rem;
  font-weight:800;
  letter-spacing:-.01em;
}

.rh-overview-sub{
  margin:4px 0 0;
  color:var(--muted);
  font-size:.9rem;
  line-height:1.45;
}

.rh-overview-grid{
  display:grid;
  grid-template-columns:repeat(4, minmax(0,1fr));
  gap:12px;
}

.rh-overview-card{
  border-radius:18px;
  border:1px solid color-mix(in srgb, var(--brand) 14%, var(--border));
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--brand) 7%, var(--card)) 0%,
      color-mix(in srgb, var(--brand) 3%, var(--card)) 100%
    );
  padding:12px;
  min-width:0;
}

.rh-overview-card-title{
  margin:0 0 9px;
  font-size:.9rem;
  font-weight:750;
  color:var(--text, inherit);
}

.rh-overview-row{
  display:grid;
  grid-template-columns:24px 1fr auto;
  gap:8px;
  align-items:center;
  padding:7px 0;
  border-top:1px solid color-mix(in srgb, var(--border) 72%, transparent);
}

.rh-overview-row:first-of-type{
  border-top:0;
}

.rh-overview-rank{
  width:22px;
  height:22px;
  border-radius:999px;
  display:grid;
  place-items:center;
  font-size:.74rem;
  font-weight:850;
  color:var(--brand);
  background:color-mix(in srgb, var(--brand) 14%, transparent);
  border:1px solid color-mix(in srgb, var(--brand) 22%, var(--border));
}

.rh-overview-date{
  min-width:0;
  color:var(--muted);
  font-size:.82rem;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.rh-overview-value{
  font-size:.86rem;
  white-space:nowrap;
  color:var(--text, inherit);
}

@media (max-width: 1180px){
  .rh-overview-grid{
    grid-template-columns:repeat(2, minmax(0,1fr));
  }
}

@media (max-width: 640px){
  .rh-overview{
    padding:13px;
  }

  .rh-overview-grid{
    grid-template-columns:minmax(0,1fr);
  }

  .rh-overview-row{
    grid-template-columns:24px 1fr;
  }

  .rh-overview-value{
    grid-column:2;
    justify-self:start;
  }
}

/* --- FIX móvil: evitar desbordes horizontales en Rankings históricos --- */

#rankings-history,
#rankings-history *{
  box-sizing:border-box;
}

#rankings-history{
  width:100%;
  max-width:100%;
  overflow-x:hidden;
}

.rh-wrap,
.rh-hero,
.rh-overview,
.rh-panel,
.rh-panels{
  width:100%;
  max-width:100%;
  min-width:0;
}

.rh-title,
.rh-subtitle,
.rh-overview-title,
.rh-overview-sub,
.rh-results-title,
.rh-results-sub,
.rh-chip,
.rh-item-title,
.rh-item-sub,
.rh-overview-card-title,
.rh-overview-date,
.rh-overview-value{
  min-width:0;
  overflow-wrap:anywhere;
}

.rh-meta{
  min-width:0;
  max-width:100%;
  overflow:hidden;
}

.rh-chip{
  max-width:100%;
  white-space:normal;
}

/* El grid superior nunca debe forzar ancho */
.rh-overview-grid{
  width:100%;
  max-width:100%;
  min-width:0;
}

.rh-overview-card{
  width:100%;
  max-width:100%;
  min-width:0;
  overflow:hidden;
}

/* Filas del resumen: compactas y sin salirse */
.rh-overview-row{
  width:100%;
  min-width:0;
}

@media (max-width: 640px){
  #rankings-history{
    padding-inline:0;
  }

  .rh-hero,
  .rh-overview,
  .rh-panel{
    border-radius:20px;
  }

  .rh-hero-inner{
    padding:18px 14px;
  }

  .rh-title{
    font-size:clamp(1.65rem, 8vw, 2rem);
    line-height:1.08;
  }

  .rh-subtitle{
    font-size:1rem;
    line-height:1.45;
  }

  .rh-meta{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
  }

  .rh-chip{
    font-size:.82rem;
    padding:.36rem .62rem;
  }

  .rh-overview{
    padding:14px;
  }

  .rh-overview-grid{
    grid-template-columns:minmax(0,1fr);
  }

  .rh-overview-card{
    padding:12px;
  }

  .rh-overview-row{
    grid-template-columns:26px minmax(0,1fr) auto;
    gap:8px;
    align-items:center;
  }

  .rh-overview-value{
    grid-column:auto;
    justify-self:end;
    text-align:right;
    font-size:.9rem;
  }

  .rh-overview-date{
    white-space:normal;
    overflow:visible;
    text-overflow:clip;
  }

  .rh-panel{
    padding:13px;
  }

  .rh-controls,
  .rh-controls-annual,
  .rh-controls-monthly,
  .rh-controls-daily{
    grid-template-columns:minmax(0,1fr) !important;
  }

  .rh-select,
  .rh-input{
    max-width:100%;
    min-width:0;
  }

  .rh-item{
    grid-template-columns:34px minmax(0,1fr) auto;
    gap:10px;
  }

  .rh-value{
    grid-column:auto;
    justify-self:end;
    text-align:right;
    font-size:1rem;
  }
}

@media (max-width: 390px){
  .rh-overview-row{
    grid-template-columns:26px minmax(0,1fr);
  }

  .rh-overview-value{
    grid-column:2;
    justify-self:start;
    text-align:left;
    margin-top:2px;
  }

  .rh-item{
    grid-template-columns:34px minmax(0,1fr);
  }

  .rh-value{
    grid-column:2;
    justify-self:start;
    text-align:left;
    margin-top:2px;
  }
}
