/* ===========================================================
   Jack & Jill League — Ranking público (auto-contenido)
   Sin Bootstrap ni Font Awesome. Iconos SVG/emoji.
   =========================================================== */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --jj-green: #089f6f;
    --jj-green-2: #0bbf86;
    --leader: #1565c0;
    --follower: #e91e63;
    --bg: #f4f7fa;
    --txt: #1e293b;
    --muted: #64748b;
}

body {
    background: var(--bg);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: var(--txt);
    -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 760px; margin: 0 auto; padding: 0 12px 40px; }

/* ---------- BANNER (compacto + animación de color) ---------- */
.hero {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    color: #fff;
    background: linear-gradient(110deg, #067a55, #089f6f, #0bbf86, #18d29a, #089f6f);
    background-size: 300% 100%;
    animation: heroShift 7s ease infinite;
    box-shadow: 0 3px 10px rgba(0,0,0,.12);
}
@keyframes heroShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.hero svg { width: 26px; height: 26px; flex-shrink: 0; }
.hero .brand {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: .4px;
    white-space: nowrap;
}

/* ---------- Cabecera compacta ---------- */
.head {
    text-align: center;
    padding: 14px 0 10px;
}
.head h1 {
    font-size: 1.35rem;
    font-weight: 900;
    letter-spacing: 1px;
    background: linear-gradient(90deg, #089f6f, #1565c0, #e91e63, #f59e0b, #089f6f);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: heroShift 8s ease infinite;
}
.visitors {
    font-size: .78rem;
    color: var(--muted);
    margin: 4px 0 8px;
}
.visitors b { color: var(--jj-green); }
.btn-home {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--jj-green);
    color: #fff;
    text-decoration: none;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .5px;
    padding: 6px 16px;
    border-radius: 30px;
    transition: filter .2s, transform .2s;
}
.btn-home:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-home svg { width: 14px; height: 14px; }

/* ---------- Caja de filtros (compacta) ---------- */
.filters {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 14px rgba(0,0,0,.06);
    padding: 12px;
    margin-bottom: 16px;
}
.f-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.f-row:last-child { margin-bottom: 0; }

.field {
    flex: 1 1 100%;
    min-width: 0;
}
.label {
    display: block;
    font-size: .62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--muted);
    margin: 0 0 4px 3px;
}
select.input, input.input {
    width: 100%;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 10px;
    padding: 9px 12px;
    font-size: .9rem;
    font-weight: 600;
    color: var(--txt);
    outline: none;
    appearance: none;
}
select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='3'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 30px; }
select.input:focus, input.input:focus { border-color: var(--jj-green); background:#fff; }

.input.liga { border-color: #cfe9df; background:#f0fbf6; font-weight:800; }

/* Segmento de Rol (Todos/Leader/Follower) */
.seg { display: flex; gap: 6px; }
.seg button {
    flex: 1;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    color: var(--muted);
    font-weight: 800;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 8px 4px;
    border-radius: 10px;
    cursor: pointer;
    transition: all .15s;
}
.seg button.active.rol-all { background:#1e293b; color:#fff; border-color:#1e293b; }
.seg button.active.rol-leader { background:var(--leader); color:#fff; border-color:var(--leader); }
.seg button.active.rol-follower { background:var(--follower); color:#fff; border-color:var(--follower); }

/* Botones de categoría */
.cats { display: flex; flex-wrap: wrap; gap: 6px; }
.cats button {
    border: none;
    border-radius: 30px;
    padding: 6px 13px;
    font-size: .68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: #fff;
    cursor: pointer;
    opacity: .38;
    transition: all .2s;
}
.cats button.active { opacity: 1; transform: translateY(-1px); box-shadow: 0 5px 10px -3px rgba(0,0,0,.25); }

/* Colores por categoría */
.cat-all       { background: #1e293b; }
.cat-bailador  { background: linear-gradient(135deg,#10b981,#059669); }
.cat-champion  { background: linear-gradient(135deg,#3b82f6,#1d4ed8); }
.cat-master    { background: linear-gradient(135deg,#14b8a6,#0f766e); }
.cat-allstar   { background: linear-gradient(135deg,#f59e0b,#d97706); }
.cat-legend    { background: linear-gradient(135deg,#a855f7,#7e22ce); }

/* Orden por likes */
.sort-row { text-align: center; margin-top: 8px; }
.sort-row.hide { display: none; }
#sortLikesBtn {
    border: 1.5px solid #e2e8f0; background:#f8fafc; color:var(--muted);
    border-radius: 30px; padding: 6px 16px; font-size:.72rem; font-weight:800;
    text-transform: uppercase; letter-spacing:.5px; cursor:pointer; transition: all .15s;
    display:inline-flex; align-items:center; gap:6px;
}
#sortLikesBtn.active { background: linear-gradient(135deg,#f43f5e,#e11d48); color:#fff; border-color:transparent; }

/* ---------- Lista de ranking ---------- */
#rankingList { transition: opacity .25s ease; }
#rankingList.fading { opacity: 0; }

.empty {
    text-align: center;
    padding: 36px 16px;
    color: var(--muted);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(0,0,0,.05);
}
.empty .big { font-size: 2.4rem; margin-bottom: 8px; }
.empty h3 { font-size: 1rem; color: var(--txt); margin-bottom: 4px; }
.empty p { font-size: .85rem; }

.card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 10px;
    box-shadow: 0 3px 10px rgba(0,0,0,.05);
    border-left: 5px solid #cbd5e1;
    animation: slideUp .35s ease both;
}
.card.leader   { border-left-color: var(--leader); }
.card.follower { border-left-color: var(--follower); }
@keyframes slideUp { from { opacity:0; transform: translateY(12px);} to {opacity:1; transform:none;} }

.rk { font-size: 1.1rem; font-weight: 900; color: #94a3b8; min-width: 30px; text-align:center; }
.rk.top1 { color:#f59e0b; } .rk.top2 { color:#94a3b8; } .rk.top3 { color:#b45309; }

.av { position: relative; flex-shrink: 0; }
.av img { width: 58px; height: 58px; border-radius: 50%; object-fit: cover; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.12); background:#eee; }
.av .catdot { position:absolute; bottom:-2px; right:-2px; width:16px; height:16px; border-radius:50%; border:2px solid #fff; }

.info { flex: 1; min-width: 0; }
.info .name { font-size: 1rem; font-weight: 800; color: var(--txt); display:flex; align-items:center; gap:7px; flex-wrap:wrap; }
.info .ig { color:#e1306c; text-decoration:none; display:inline-flex; }
.info .ig svg { width:16px; height:16px; }
.info .meta { font-size:.76rem; color: var(--muted); margin-top:2px; }
.info .meta .rol { font-weight:800; }
.info .meta .rol.leader { color:var(--leader); }
.info .meta .rol.follower { color:var(--follower); }
.badge-cat { display:inline-block; color:#fff; font-size:.6rem; font-weight:800; text-transform:uppercase; letter-spacing:.4px; padding:2px 9px; border-radius:20px; margin-top:6px; }

.actions { display:flex; align-items:center; gap:10px; margin-top:7px; }
.btn-like { border:none; background:none; cursor:pointer; display:inline-flex; align-items:center; gap:4px; color:#ef4444; font-weight:800; font-size:.85rem; padding:0; }
.btn-like svg { width:16px; height:16px; }
.btn-like:disabled { opacity:.7; }
.btn-perfil {
    display:inline-flex; align-items:center; gap:5px; text-decoration:none; color:#fff;
    font-size:.62rem; font-weight:800; text-transform:uppercase; letter-spacing:.6px;
    padding:5px 14px; border-radius:20px;
    background: linear-gradient(135deg,#f7971e,#ffd200);
    animation: perfilGlow 1.8s ease-in-out infinite;
}
.btn-perfil svg { width:13px; height:13px; }
@keyframes perfilGlow {
    0%,100% { box-shadow: 0 0 0 0 rgba(247,151,30,.5), 0 3px 8px rgba(0,0,0,.12); }
    50%     { box-shadow: 0 0 14px 5px rgba(255,210,0,.6), 0 3px 8px rgba(0,0,0,.12); }
}

.pts { text-align: right; flex-shrink: 0; }
.pts .n { font-size: 1.5rem; font-weight: 900; color: var(--txt); line-height: 1; }
.pts .lbl { font-size: .56rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); font-weight: 800; }

/* Pantallas grandes: un poco más de aire */
@media (min-width: 600px) {
    .hero { height: 72px; }
    .hero .brand { font-size: 1.15rem; }
    .head h1 { font-size: 1.7rem; }
    .field.half { flex: 1 1 calc(50% - 4px); }
}

/* En muy chico, la foto y puntaje algo menores */
@media (max-width: 360px) {
    .av img { width: 50px; height: 50px; }
    .pts .n { font-size: 1.25rem; }
    .rk { min-width: 22px; font-size: 1rem; }
}
