/* --------------------------------------------------------------------------
   16. PERFIL
   -------------------------------------------------------------------------- */
.perfil-body {
    background-color: var(--bg-dark);
    color: var(--text-white);
}

/* Badge de rango con imagen. Vive aqui (y no en ui-effects.css) porque lo
   pinta perfil-summary.php, que aparece en paginas que cargan profile-ui pero
   no ui-effects; alli el icono salia gigante por falta de estas reglas. */
.badge-rank-img {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
}
.rank-badge-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    vertical-align: middle;
}
.rank-icon-sm {
    width: 16px;
    height: 16px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 2px;
}

.perfil-container {
    width: 100%;
    max-width: var(--page-max);
    margin: 0 auto;
    /* Espaciado vertical uniforme (16px) igual que entre las secciones de
       las columnas; los laterales siguen en --sp-9. */
    padding: var(--sp-7) var(--sp-9) 80px;
    display: flex;
    flex-direction: column;
    gap: var(--sp-7);
}

/* El resumen aparece DENTRO de .perfil-container en Overview (val-resumen) y
   FUERA, como hermano, en el resto de paginas. Para que se vea igual en ambos
   casos, su ancho coincide con el CONTENIDO del container: 1280 menos su
   padding lateral. Asi queda centrado y alineado esté donde esté. */
.perfil-summary {
    /* superficie (fondo, borde, radio) = .card (components/cards.css) */
    width: calc(100% - 2 * var(--sp-9));
    max-width: calc(var(--page-max) - 2 * var(--sp-9));
    margin-left: auto;
    margin-right: auto;
    padding: var(--sp-9);
    position: relative;
}

/* Pill de idioma/pais anclada arriba a la derecha de la card de summary */
.perfil-country-corner {
    position: absolute;
    top: var(--sp-6);
    right: var(--sp-6);
    z-index: 2;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Contador de sincronización automática del perfil (esquina del summary) */
/* Pill de sync: mismo estilo que la badge de pais/idioma (.badge-country),
   scopeada al summary para no afectar al contador del historial. */
.perfil-country-corner .sync-countdown {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    margin-bottom: 0;
    padding: 3px var(--sp-4) 3px 0;   /* sin padding izq: lo pone el bloque del icono */
    overflow: hidden;
    border: 0;
    border-radius: var(--radius-xs);
    font-size: var(--fs-2xs);
    font-weight: var(--fw-bold);
    text-transform: uppercase;
    letter-spacing: var(--ls-sm);
    white-space: nowrap;
    color: var(--on-accent);
    background: var(--neutral);
    cursor: default;
    transition: filter var(--t-slow);
}
.perfil-country-corner .sync-countdown #syncCountdownTimer {
    color: var(--on-accent);
    font-weight: var(--fw-extrabold);
    font-variant-numeric: tabular-nums;
}
.perfil-country-corner .sync-countdown svg { stroke: var(--on-accent); }
/* Bloque del icono: mismo gris pero más oscuro; el resto de la pill no cambia */
.perfil-country-corner .sync-countdown .sync-ico {
    display: inline-flex;
    align-items: center;
    align-self: stretch;
    margin: -3px 0;
    padding: 0 var(--sp-2);
    background: rgba(0,0,0,.18);
}
.perfil-country-corner .sync-countdown.is-clickable { cursor: pointer; }
.perfil-country-corner .sync-countdown.is-clickable:hover { filter: brightness(1.08); }
.perfil-country-corner .sync-countdown.is-syncing { cursor: default; opacity: .85; }
.perfil-country-corner .sync-countdown.is-syncing svg { animation: syncSpin .8s linear infinite; }
@keyframes syncSpin { to { transform: rotate(360deg); } }

.perfil-summary-header {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-9);
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--sp-9);
}

.perfil-avatar-block { display: flex; flex-direction: column; align-items: center; gap: var(--sp-5); }

.perfil-avatar {
    width: 80px;
    height: 80px;
    background-color: var(--bg-input);
    border-radius: var(--radius-circle);
    overflow: hidden;
    border: 2px solid var(--brand-accent);
}

.perfil-avatar img { width: 100%; height: 100%; object-fit: cover; }

.subtle-btn {
    font-size: var(--fs-sm);
    color: var(--text-gray);
    text-decoration: none;
    background: none;
    border: 1px solid var(--border);
    padding: var(--sp-1) var(--sp-5);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
}

.subtle-btn:hover { color: var(--text-white); background-color: var(--bg-input); }

.perfil-info    { flex: 1; min-width: 200px; }

.perfil-username { font-size: var(--fs-4xl); margin-bottom: var(--sp-3); }

.perfil-badges  { display: flex; gap: var(--sp-3); }

.perfil-bio {
    margin-top: var(--sp-3);
    font-size: var(--fs-sm);
    color: var(--text-muted);
    line-height: var(--lh-normal);
    max-width: 340px;
    opacity: .85;
}

/* Estilo "tag": fondo translucido del propio color + texto del color solido,
   mayusculas y esquina pequena. El mismo que la etiqueta FREE de la home.
   Estos badges llevan tambien la clase base .badge (de ui-shared.css), que
   aporta borde, un punto pulsante (::before) y margen inferior pensados para
   el eyebrow del hero. Aqui se anulan: en el perfil no se quieren. */
.badge-rank, .badge-level, .badge-premium, .badge-country {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    margin-bottom: 0;
    padding: 3px var(--sp-4);
    border-radius: var(--radius-xs);
    font-size: var(--fs-2xs);
    font-weight: var(--fw-bold);
    text-transform: uppercase;
    letter-spacing: var(--ls-sm);
    white-space: nowrap;
    color: var(--on-accent);
}
.badge-rank::before, .badge-level::before, .badge-premium::before, .badge-country::before {
    display: none;
}

.badge-rank    { background: var(--green); }

.badge-level   { background: var(--purple); }

.badge-premium { background: var(--amber); }

.badge-country { background: var(--neutral); }

/* Pais en el summary: solo la bandera; el nombre sale en un tooltip al pasar
   el raton (o al enfocar con teclado). Tooltip debajo y alineado a la derecha
   porque el badge esta en la esquina superior derecha de la card. */
.badge-country--flag {
    position: relative;
    padding: 0;
    background: none;
    overflow: visible;
    line-height: 0;
    cursor: default;
}
.badge-country--flag img {
    width: 22px;
    height: 16px;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: 0 0 0 1px rgba(255,255,255,.12);
}
.badge-country--flag::after {
    content: attr(data-tip);
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: max-content;
    background: var(--bg-tooltip);
    color: var(--text-white);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 8px;
    padding: var(--sp-2) var(--sp-4);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    line-height: 1.3;
    letter-spacing: 0;
    text-transform: none;
    box-shadow: 0 12px 30px -12px rgba(0,0,0,.85);
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    z-index: 50;
    transition: opacity var(--t-fast), transform var(--t-fast);
}
.badge-country--flag:hover::after,
.badge-country--flag:focus-visible::after {
    opacity: 1;
    transform: none;
}

.perfil-chart-mini { position: relative; flex: 1; min-width: 0; height: 90px; display: flex; flex-direction: column; }

.perfil-chart-mini canvas { flex: 1; min-height: 0; }

.chart-no-data { flex: 1; display: flex; align-items: center; justify-content: center; font-size: var(--fs-xs); color: var(--text-muted); opacity: .6; }

.chart-filter-buttons { display: flex; justify-content: space-between; margin-top: var(--sp-2); }

.filter-btn { background: none; border: none; color: var(--text-gray); font-size: var(--fs-xs); cursor: pointer; }

.filter-btn.active { color: var(--brand-accent); font-weight: var(--fw-bold); }

.perfil-summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--sp-7);
    margin-top: var(--sp-8);
}

.summary-stat { display: flex; flex-direction: column; }

.section-label { font-size: var(--fs-xl); font-weight: var(--fw-bold); display: flex; align-items: center; gap: var(--sp-3); }

/* Tamaño uniforme de iconos de cabecera de sección (sobrescribe cualquier width/height inline) */
.section-label svg { width: 16px !important; height: 16px !important; flex-shrink: 0; vertical-align: -2px; }

.stats-row-label svg { width: 16px !important; height: 16px !important; flex-shrink: 0; vertical-align: -2px; }

.perfil-stats {
    /* superficie (fondo, borde, radio) = .card (components/cards.css) */
    padding: var(--sp-9);
}

.perfil-stats-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-8); }

.stats-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--sp-7);
}

.stats-kpi {
    background-color: transparent;
    border: 1px solid transparent;
    padding: var(--sp-7);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stats-kpi-label { font-size: var(--fs-xs); color: var(--text-gray); text-transform: uppercase; }

.stats-kpi-value { font-size: var(--fs-3xl); font-weight: var(--fw-bold); margin: var(--sp-2) 0; }

.stats-kpi-sub, .stats-wins-total { font-size: var(--fs-xs); color: var(--text-gray); }

.stats-kpi-accent .stats-kpi-value { color: var(--text-white); } /* numero destacado = blanco + negrita; el rojo se reserva para marca y negativos */

.stats-kpi-green  .stats-kpi-value { color: var(--green); }

.stats-kpi-amber  .stats-kpi-value { color: var(--amber); }

.stats-divider { height: 1px; background-color: var(--border); margin: var(--sp-9) 0; }

.stats-rows-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--sp-5);
}

.perfil-rango {/* superficie (fondo, borde, radio) = .card (components/cards.css) */ padding: var(--sp-9); }

.perfil-rango-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-7); }

.rango-peak-pill {
    background-color: color-mix(in srgb, var(--brand-accent) 10%, transparent);
    color: var(--brand-accent);
    padding: var(--sp-1) var(--sp-5);
    border-radius: var(--radius-pill);
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
}

.perfil-roles,
.perfil-agentes,
.perfil-mapas,
.perfil-armas {
    /* superficie (fondo, borde, radio) = .card (components/cards.css) */
    padding: var(--sp-9);
}

/* ── Agent Roles ─────────────────────────────────────── */
.roles-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--sp-5);
    margin-top: var(--sp-6);
}

@media (max-width: 700px) {
    .roles-grid { grid-template-columns: repeat(2, 1fr); }
}

.role-card {
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    padding: var(--sp-6);
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
}

.role-name {
    font-size: var(--pcard-name-fs);
    font-weight: var(--fw-bold);
    color: var(--text-white);
    letter-spacing: var(--ls-sm);
    text-transform: uppercase;
}

.role-games {
    font-size: var(--pcard-sub-fs);
    color: var(--text-gray);
    margin-top: 1px;
}

.role-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.role-stat-val {
    font-size: var(--fs-md);
    font-weight: var(--fw-bold);
    color: var(--text-white);
}

.role-wr-bar { height: 3px; background: var(--track); }

.perfil-agentes-header,
.perfil-mapas-header,
.perfil-armas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--sp-8);
}

.agentes-grid,
.mapas-grid,
.armas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--sp-7);
}

/* Hit zones: interacción muñeco + línea "Most hit zone" (movido desde resumen.php) */
.hz-zone { stroke: none; transition: opacity var(--t-slow) ease, filter var(--t-slow) ease; cursor: pointer; }

/* -- Banner de perfil -- */
.profile-banner {
    position: relative;
    height: 160px;
    background: linear-gradient(135deg, #0d1b2a 0%, #1a1030 50%, #0d1b2a 100%);
    overflow: hidden;
}

.banner-pattern {
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(
    45deg,
    color-mix(in srgb, var(--brand-accent) 4%, transparent) 0px,
    color-mix(in srgb, var(--brand-accent) 4%, transparent) 1px,
    transparent 1px,
    transparent 40px
    );
}

.banner-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 40%, rgba(11, 17, 30, .9) 100%);
}

.tab {
    background: none;
    border: none;
    color: var(--text-gray);
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    padding: var(--sp-3) var(--sp-7);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    transition: color var(--t-normal), background var(--t-normal);
    white-space: nowrap;
}

.tab:hover  { color: var(--text-white); background: var(--bg-input); }

.tab.active { color: var(--text-white); background: var(--bg-input); }

/* -- Avatar ring + online dot -- */
.avatar-ring {
    position: relative;
    padding: 3px;
    border-radius: var(--radius-circle);
    background: linear-gradient(135deg, var(--brand-accent), var(--purple));
}

/* -- Header actions -- */
.perfil-summary-header-top { align-items: flex-start; }

/* -- Stats period btn (clase directa) -- */
.stats-period-btn {
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-gray);
    padding: var(--sp-2) var(--sp-5);
    font-size: var(--fs-sm);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    transition: background var(--t-normal), color var(--t-normal);
}

.stats-period-btn.active {
    background-color: var(--brand-accent);
    color: var(--text-white);
    border-color: var(--brand-accent);
}

/* -- Stats rows -- */
.stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--sp-4) var(--sp-6);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.stats-row-label { font-size: var(--fs-md); color: var(--text-gray); }

.stats-row-value { font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--text-white); }

.rango-chip.active {
    border-color: var(--brand-accent);
    background: rgba(var(--brand-accent-rgb), .10);
}

.agentes-sort-btn.active,
.mapas-sort-btn.active {
    background-color: var(--bg-elevated);
    color: var(--text-white);
}

.arma-card {
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--sp-7);
    transition: border-color var(--t-normal);
}

.agent-card,
.mapa-card {
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    padding: var(--sp-7);
}

.arma-card:hover { border-color: color-mix(in srgb, var(--brand-accent) 35%, transparent); }

/* Imágenes de agentes y armas */
.agent-img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

/* Versión pequeña para tablas de partida */
.agent-img-sm {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-xs);
    vertical-align: middle;
}

/* Icono de agente dentro de la card de partida */
.partida-agent-img {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: block;
}

.weapon-icon-wrap {
    background: transparent !important;
    border-radius: 0 !important;
    width: auto !important;
    min-width: 64px;
}

/* Las tarjetas de arma (.arma-card, en val-resumen y ft-resumen) se montan por
   JS copiando la maqueta de las de agente pero con prefijo "arma-". Nunca se
   duplicaron estas reglas, asi que salian sin formato: cabecera sin flex, icono
   sin caja y nombre sin negrita. Se comparten los selectores en vez de repetir
   el bloque — si cambia el diseno de una, cambia el de la otra. */
.agent-card-header,
.arma-card-header {
    display: flex;
    align-items: center;
    gap: var(--sp-5);
    margin-bottom: var(--sp-6);
}

.agent-card-icon,
.arma-card-icon {
    font-size: var(--fs-4xl);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.agent-card-name,
.arma-card-name   { font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--text-white); }

.agent-card-games { font-size: var(--fs-xs); color: var(--text-gray); margin-top: 2px; }

.agent-card-stats {
    display: flex;
    gap: var(--sp-5);
    margin-bottom: var(--sp-5);
}

.agent-card-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    background: transparent;
    border-radius: var(--radius-sm);
    padding: var(--sp-3) var(--sp-1);
}

.agent-card-stat-val { font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--text-white); }
.agent-card-stat-val.is-accent { color: var(--text-white); font-weight: var(--fw-extrabold); } /* numero destacado = blanco + negrita; el rojo se reserva para marca y negativos */
.agent-wr-bar-fill.is-accent   { background: var(--text-gray); }

.agent-card-stat-lbl { font-size: var(--fs-2xs); color: var(--text-gray); margin-top: 2px; }

.agent-wr-bar { height: 4px; background: var(--track); }

/* -- Chart tooltip -- */
.chart-tooltip {
    position: absolute;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-white);
    font-size: var(--fs-xs);
    padding: var(--sp-2) var(--sp-4);
    border-radius: var(--radius-sm);
    pointer-events: none;
    display: none;
    white-space: nowrap;
    z-index: var(--z-tooltip);
}

/* ── Profundidad + hover en iconos de agente/mapa (Overview y Stats),
      mismo look que el ranking (2026-09) ───────────────────────────── */
.agent-card-icon,
.mapa-card-icon {
    border: 1px solid var(--tint-3);
    box-shadow: 0 2px 6px -2px rgba(0,0,0,.6);
    overflow: hidden;
}
.agent-card-icon .agent-img,
.agent-card-icon .mapa-img,
.mapa-card-icon .mapa-img,
.mapa-card-icon .agent-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    transition: transform var(--t-fast);
}
.agent-card:hover .agent-card-icon img,
.mapa-card:hover .mapa-card-icon img,
.mapa-card:hover .agent-card-icon img { transform: scale(1.08); }

/* ==========================================================================
   PAGINAS DE PERFIL — piezas compartidas (Overview, Agents, Maps, History)
   ========================================================================== */

/* Perfil no encontrado / privado */
.prof-empty      { max-width: 540px; margin: 60px auto; text-align: center; color: var(--text-muted); }
.prof-empty-ic   { opacity: .35; margin-bottom: var(--sp-6); color: var(--brand-accent); }
.prof-empty-t    { font-size: var(--fs-xl); font-weight: var(--fw-bold); color: var(--text-gray); margin-bottom: var(--sp-3); }
.prof-empty-d    { font-size: var(--fs-md); }
.prof-empty-link { display: inline-block; margin-top: var(--sp-9); color: var(--brand-accent); font-weight: var(--fw-bold); }

/* Layout 70 / 30 (se apila en pantallas estrechas) */
.res-layout   { display: flex; gap: var(--sp-7); align-items: flex-start; }
.res-col      { min-width: 0; display: flex; flex-direction: column; gap: var(--sp-7); }
.res-col-main { flex: 0 0 70%; }
.res-col-side { flex: 0 0 calc(30% - var(--sp-7)); }
@media (max-width: 960px) {
    .res-layout { flex-direction: column; align-items: stretch; }
    .res-col-main, .res-col-side { flex: 1 1 auto; width: 100%; }
}

/* Textos de estado (Loading..., sin datos) */
.cuenta-vincular-desc.res-note  { font-size: var(--fs-sm); }
.cuenta-vincular-desc.is-spaced { margin-top: var(--sp-3); }
