/**
 * Estilos para o Ranking YOP Poll - Pixel Perfect
 */

.yoppoll-ranking-container {
    margin: 24px 0;
    padding: 0 12px;
    /* evita ficar colado às margens do conteúdo */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.ranking-yoppoll-cards {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.ranking-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    column-gap: 20px;
    padding-top: 22px;
    padding-bottom: 22px;
    padding-left: 20px;
    padding-right: 20px;
    margin: 0;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid rgba(17, 24, 39, 0.08);
    box-shadow: 0 1px 3px rgba(17, 24, 39, 0.08), 0 1px 2px rgba(17, 24, 39, 0.04);
    position: relative;
    min-height: 100px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin-left: 0 !important;
}

.ranking-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(17, 24, 39, 0.12), 0 2px 4px rgba(17, 24, 39, 0.08);
    border-color: rgba(17, 24, 39, 0.12);
}

/* Avatar/Foto com posição sobreposta */
.rank-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

.rank-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.9);
    display: block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.rank-avatar-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 20px;
    text-transform: uppercase;
    line-height: 1;
}

/* Número da posição - sobreposto à imagem */
.rank-number {
    position: absolute;
    top: -4px;
    left: -4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 11px;
    color: #ffffff;
    line-height: 1;
    z-index: 10;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25), 0 0 0 2px #ffffff;
    transition: transform 0.2s ease;
}

.ranking-card:hover .rank-number {
    transform: scale(1.05);
}

/* Indicador de mudança de posição (estilo F1) - ao lado do nome */
.position-change {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
    flex-shrink: 0;
}

.position-change.up {
    background: #10b981;
    color: #ffffff;
}

.position-change.down {
    background: #ef4444;
    color: #ffffff;
}

.position-change.stable {
    display: none;
    /* Não mostrar se não mudou */
}

.rank-number.rank-first {
    background: #10b981;
}

.rank-number.rank-other {
    background: #9ca3af;
}

/* Informações */
.rank-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rank-name-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rank-name {
    font-weight: 700;
    font-size: 22px;
    color: #111827;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin: 0;
    padding: 0;
}

.rank-percentage-text {
    font-size: 15px;
    color: #6b7280;
    line-height: 1.4;
    margin: 0;
    padding: 0;
    font-weight: 500;
}

/* Barra de progresso */
.rank-progress-bar {
    width: 100%;
    height: 12px;
    background: #f3f4f6;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 4px;
    position: relative;
}

.rank-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
    border-radius: 6px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.rank-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.ranking-card.rank-first .rank-progress-fill {
    background: #10b981;
}

.ranking-card.rank-other .rank-progress-fill {
    background: #10b981;
}

/* Variação */
.rank-variation {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
    min-width: 90px;
    justify-content: flex-end;
    padding-left: 0;
    letter-spacing: -0.01em;
}

.rank-variation.positive {
    color: #10b981;
}

.rank-variation.negative {
    color: #ef4444;
}

.rank-variation.neutral {
    color: #9ca3af;
}

.variation-arrow {
    font-size: 12px;
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
}

.variation-value {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.variation-stable {
    color: #9ca3af;
    font-size: 16px;
    line-height: 1;
}

/* Ajustes específicos para alinhamento pixel perfect */
.ranking-card {
    box-sizing: border-box;
}

.ranking-yoppoll-cards li.ranking-card {
    padding-top: 22px !important;
    padding-bottom: 22px !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
}

.rank-info {
    padding: 0;
    margin: 0;
}

/* Responsivo */
@media (max-width: 768px) {
    .ranking-card {
        padding: 16px;
        min-height: auto;
        /* Mudar grid para coluna em mobile */
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        row-gap: 12px;
        column-gap: 0;
    }

    /* Primeira linha: Avatar e nome lado a lado */
    .rank-avatar-wrapper {
        display: flex;
        align-items: center;
        gap: 12px;
        justify-self: start;
    }

    .rank-number {
        width: 20px;
        height: 20px;
        font-size: 11px;
        top: -6px;
        left: -6px;
    }

    .rank-avatar,
    .rank-avatar-placeholder {
        width: 52px;
        height: 52px;
    }

    .ranking-card .image-wrapper_center .cl-image,
    .cl-image-container .cl-image {
        width: 52px;
        height: 52px;
        border-radius: 50%;
        object-fit: cover;
        border: 2px solid rgba(255, 255, 255, 0.9);
        display: block;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        text-align: center;
    }

    .ranking-card .image-wrapper_center {
        margin: 0;
    }

    .rank-avatar-placeholder {
        font-size: 18px;
    }

    /* Segunda linha: Info completa */
    .rank-info {
        width: 100%;
        justify-self: start;
    }

    .rank-name {
        font-size: 18px;
    }

    .rank-percentage-text {
        font-size: 14px;
    }

    .rank-progress-bar {
        height: 12px;
    }

    /* Terceira linha: Variação centralizada */
    .rank-variation {
        min-width: auto;
        font-size: 14px;
        width: 100%;
        justify-self: center;
    }

    .variation-value {
        font-size: 14px;
    }
}

/* Animações suaves */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ranking-card {
    animation: slideIn 0.3s ease-out;
    animation-fill-mode: both;
}

.ranking-card:nth-child(1) {
    animation-delay: 0.05s;
}

.ranking-card:nth-child(2) {
    animation-delay: 0.1s;
}

.ranking-card:nth-child(3) {
    animation-delay: 0.15s;
}

.ranking-card:nth-child(4) {
    animation-delay: 0.2s;
}

.ranking-card:nth-child(5) {
    animation-delay: 0.25s;
}

.ranking-card:nth-child(n+6) {
    animation-delay: 0.3s;
}

/* Reset de estilos para garantir consistência */
.ranking-yoppoll-cards * {
    box-sizing: border-box;
}