/* ==========================================
   HERO LEADERS SIDEBAR - Bless Castle & SOD
   Posicionado no lado direito da tela (fixed)
   ========================================== */

/* Sidebar Fixa no Lado Direito */
.hero-sidebar {
    position: fixed;
    top: 70px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 270px;
    min-width: 270px;
    max-height: calc(100vh - 90px);
    overflow: visible;
    z-index: 100;
    background: linear-gradient(135deg, var(--color-parchment), rgba(58, 42, 26, 0.8));
    border-radius: 10px;
    padding: 12px;
    box-shadow:
        var(--shadow-lg),
        inset 0 0 30px rgba(201, 169, 97, 0.15),
        0 0 0 1px rgba(43, 24, 16, 0.5);
    /* Esconder scrollbar completamente */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Esconder scrollbar para Chrome, Safari e Opera */
.hero-sidebar::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

/* Container de Cards (empilhados verticalmente) */
.sidebar-columns {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    flex: 1;
    min-height: 0;
}

/* Coroa Customizável no Topo */
.sidebar-crown {
    text-align: center;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(201, 169, 97, 0.3);
    animation: float 3s ease-in-out infinite;
}

.sidebar-crown-icon {
    font-size: 1.4rem;
    color: var(--color-accent);
    text-shadow:
        0 0 15px rgba(201, 169, 97, 0.6),
        0 0 30px rgba(212, 175, 55, 0.4);
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
}

/* Animação de flutuação */
@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-10px) rotate(-2deg);
    }
    75% {
        transform: translateY(-10px) rotate(2deg);
    }
}

/* Card de Líder - Unificado sem bordas */
.hero-leader-card {
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(201, 169, 97, 0.15);
    border-radius: 6px;
    padding: 12px 10px;
    text-align: center;
    position: relative;
    min-height: auto;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 0;
    flex-shrink: 0;
    display: block;
}

/* Ordem explícita dos cards */
#bless-castle-card {
    order: 1;
}

#sod-clan-card {
    order: 2;
}

#top-level-card {
    order: 3;
}

/* Remove bordas decorativas */
.hero-leader-card::before,
.hero-leader-card::after {
    display: none;
}

/* Ícone do Líder */
.leader-icon {
    width: 38px;
    height: 38px;
    margin: 0 auto 6px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow:
        0 3px 12px rgba(201, 169, 97, 0.5),
        inset 0 2px 6px rgba(255, 255, 255, 0.3),
        inset 0 -2px 6px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(201, 169, 97, 0.6);
    position: relative;
}

.leader-icon.bellatra {
    background: linear-gradient(135deg, #8b0000, #dc143c, #ff4500);
    border-color: #dc143c;
    box-shadow:
        0 4px 20px rgba(220, 20, 60, 0.6),
        inset 0 2px 6px rgba(255, 255, 255, 0.2),
        inset 0 -2px 6px rgba(0, 0, 0, 0.3);
}

.leader-icon i {
    font-size: 1.1rem;
    color: var(--color-text-dark);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.leader-icon img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    opacity: 0.85;
}

/* Remover fundo circular dos ícones customizados */
#bless-castle-card .leader-icon,
#sod-clan-card .leader-icon,
#top-level-card .leader-icon {
    background: transparent;
    border: none;
    box-shadow: none;
    width: 64px;
    height: 64px;
}

/* Bellatra - ícone 10% maior */
#sod-clan-card .leader-icon {
    width: 70px;
    height: 70px;
}

#sod-clan-card .leader-icon img {
    width: 70px;
    height: 70px;
}

/* TOP 5 Level - ícone ajustado */
#top-level-card .leader-icon {
    width: 59px;
    height: 59px;
}

#top-level-card .leader-icon img {
    width: 59px;
    height: 59px;
}

.leader-icon.bellatra i {
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 69, 0, 0.5);
}

/* Título */
.leader-title {
    font-family: var(--font-primary);
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--color-accent);
    margin: 0 0 3px 0;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    line-height: 1.1;
    text-shadow:
        0 2px 4px rgba(0, 0, 0, 0.5),
        0 0 10px rgba(201, 169, 97, 0.3);
}

.leader-subtitle {
    font-size: 0.6rem;
    color: var(--color-text-gray);
    margin: 0 0 5px 0;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.2;
}

/* Info do Clã */
.leader-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 5px 0;
    padding: 6px 6px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 5px;
    border: 1px solid rgba(201, 169, 97, 0.4);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3);
}

.leader-clan-icon {
    width: 28px;
    height: 28px;
    background: rgba(201, 169, 97, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(201, 169, 97, 0.6);
    flex-shrink: 0;
}

.leader-clan-icon i {
    font-size: 0.85rem;
    color: var(--color-accent);
}

.leader-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    flex: 1;
    text-align: left;
    word-break: break-word;
}

/* Estatística */
.leader-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 6px;
    background: linear-gradient(135deg, rgba(201, 169, 97, 0.15), rgba(201, 169, 97, 0.05));
    border-radius: 4px;
    border: 1px solid rgba(201, 169, 97, 0.5);
    margin: 5px 0;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Mini Ranking List */
.mini-ranking-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 5px;
    margin-bottom: 0;
    width: 100%;
}

.mini-ranking-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 4px;
    background: linear-gradient(135deg, rgba(201, 169, 97, 0.15), rgba(201, 169, 97, 0.05));
    border-radius: 3px;
    border: 1px solid rgba(201, 169, 97, 0.3);
}

.mini-rank {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    background: var(--gradient-primary);
    border-radius: 50%;
    font-size: 0.6rem;
    font-weight: 800;
    line-height: 1;
    color: var(--color-text-dark);
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(201, 169, 97, 0.4);
    text-align: center;
}

.mini-ranking-item:nth-child(1) .mini-rank {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.6);
}

.mini-ranking-item:nth-child(2) .mini-rank {
    background: linear-gradient(135deg, #C0C0C0, #A8A8A8);
    box-shadow: 0 2px 8px rgba(192, 192, 192, 0.6);
}

.mini-ranking-item:nth-child(3) .mini-rank {
    background: linear-gradient(135deg, #CD7F32, #B87333);
    box-shadow: 0 2px 8px rgba(205, 127, 50, 0.6);
}

.mini-name {
    flex: 1;
    font-size: 0.65rem;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mini-value {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--color-gold);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
}

.mini-ranking-item.loading .mini-name,
.mini-ranking-item.loading .mini-value {
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

/* Tabela Level - Cabeçalho e Linhas */
.level-table-header {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 4px 5px;
    background: linear-gradient(135deg, rgba(65, 105, 225, 0.2), rgba(0, 100, 0, 0.2));
    border-radius: 3px;
    border: 1px solid rgba(65, 105, 225, 0.5);
    margin: 5px 0 2px 0;
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.level-table-row {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 3px 5px;
    background: linear-gradient(135deg, rgba(201, 169, 97, 0.15), rgba(201, 169, 97, 0.05));
    border-radius: 3px;
    border: 1px solid rgba(201, 169, 97, 0.4);
    margin-bottom: 2px;
    font-size: 0.6rem;
    min-height: 22px;
}

.level-table-row:last-child {
    margin-bottom: 0;
}

/* Colunas da Tabela Level */
.level-col-rank {
    width: 26px;
    flex-shrink: 0;
    text-align: center;
}

.level-col-player {
    flex: 1;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.level-col-class {
    width: 48px;
    flex-shrink: 0;
    text-align: center;
    font-weight: 600;
    color: var(--color-gold);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    font-size: 0.6rem;
}

.level-col-level {
    width: 35px;
    flex-shrink: 0;
    text-align: center;
    font-weight: 700;
    color: var(--color-gold);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    font-size: 0.6rem;
}

.level-table-header .level-col-rank,
.level-table-header .level-col-player,
.level-table-header .level-col-class,
.level-table-header .level-col-level {
    color: var(--color-accent);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

/* Rank badge dentro da tabela level */
.level-table-row .mini-rank {
    width: 16px;
    height: 16px;
    font-size: 0.6rem;
}

/* Class icon small */
.class-icon-small {
    width: 24px;
    height: 24px;
    object-fit: contain;
    vertical-align: middle;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* ===== BLESS CASTLE DATE ===== */
.bless-date {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--color-gold);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    opacity: 0.9;
}

/* ===== BLESS CASTLE TABLE ===== */
.bless-table-header {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 4px 5px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(218, 165, 32, 0.2));
    border-radius: 3px;
    border: 1px solid rgba(255, 215, 0, 0.5);
    margin: 5px 0 2px 0;
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.bless-ranking-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0 0 5px 0;
    width: 100%;
}

.bless-table-row {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 3px 5px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
    font-size: 0.6rem;
    border: 1px solid rgba(255, 215, 0, 0.3);
    min-height: 22px;
}

/* Colunas Bless Castle */
.bless-col-rank {
    width: 26px;
    text-align: center;
    flex-shrink: 0;
}

.bless-col-clan {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    color: var(--color-text);
    font-size: 0.6rem;
}

.bless-col-points {
    width: 38px;
    text-align: right;
    font-weight: 700;
    color: var(--color-gold);
    flex-shrink: 0;
    font-size: 0.6rem;
}

.bless-table-header .bless-col-rank,
.bless-table-header .bless-col-clan,
.bless-table-header .bless-col-points {
    color: var(--color-accent);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

/* Rank badge dentro da tabela Bless Castle */
.bless-table-row .mini-rank {
    width: 16px;
    height: 16px;
    font-size: 0.6rem;
    line-height: 16px;
}

.bless-table-row.loading .bless-col-clan,
.bless-table-row.loading .bless-col-points {
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

/* ===== SOD CLAN TABLE ===== */
.sod-table-header {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 4px 5px;
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.2), rgba(75, 0, 130, 0.2));
    border-radius: 3px;
    border: 1px solid rgba(138, 43, 226, 0.5);
    margin: 5px 0 2px 0;
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.sod-table-row {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 3px 5px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
    margin-bottom: 2px;
    font-size: 0.6rem;
    border: 1px solid rgba(138, 43, 226, 0.3);
    min-height: 22px;
}

.sod-table-row:last-child {
    margin-bottom: 0;
}

/* Colunas SOD */
.sod-col-rank {
    width: 26px;
    text-align: center;
    flex-shrink: 0;
}

.sod-col-clan {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    color: var(--color-text);
    font-size: 0.6rem;
}

.sod-col-points {
    width: 42px;
    text-align: right;
    font-weight: 700;
    color: var(--color-gold);
    flex-shrink: 0;
    font-size: 0.6rem;
}

.sod-table-header .sod-col-rank,
.sod-table-header .sod-col-clan,
.sod-table-header .sod-col-points {
    color: var(--color-accent);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

/* Rank badge dentro da tabela SOD */
.sod-table-row .mini-rank {
    width: 16px;
    height: 16px;
    font-size: 0.6rem;
}

.stat-label {
    font-size: 0.6rem;
    color: var(--color-text-gray);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stat-value {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--color-gold);
    text-shadow:
        0 2px 4px rgba(0, 0, 0, 0.5),
        0 0 10px rgba(212, 175, 55, 0.3);
}

/* Loading State */
.hero-leader-card.loading {
    opacity: 0.7;
}

.hero-leader-card.loading .leader-name {
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

/* Loading Spinner e Loaded Icon */
.hero-leader-card .loading-spinner {
    display: none;
}

.hero-leader-card .loaded-icon {
    display: inline-block;
}

.hero-leader-card.loading .loading-spinner {
    display: inline-block;
}

.hero-leader-card.loading .loaded-icon {
    display: none;
}

/* Ocultar tabela quando estiver loading */
.hero-leader-card.loading .bless-table-header,
.hero-leader-card.loading .bless-ranking-list,
.hero-leader-card.loading .sod-table-header,
.hero-leader-card.loading .mini-ranking-list,
.hero-leader-card.loading .level-table-header,
.hero-leader-card.loading .leader-stat,
.hero-leader-card.loading .bless-date {
    opacity: 0.5;
}

/* Animação de entrada - Desabilitada para evitar conflitos */
.sidebar-columns .hero-leader-card {
    opacity: 1;
}

.sidebar-columns .hero-leader-card:nth-child(1) {
    /* Card 1 */
}

.sidebar-columns .hero-leader-card:nth-child(2) {
    /* Card 2 */
}

.sidebar-columns .hero-leader-card:nth-child(3) {
    /* Card 3 */
}

/* Responsive */
@media (max-width: 1400px) {
    .hero-sidebar {
        right: 10px;
        width: 260px;
    }

    .sidebar-crown-icon {
        font-size: 2.2rem;
    }

    .leader-icon {
        width: 55px;
        height: 55px;
    }

    .leader-icon i {
        font-size: 1.8rem;
    }
}

/* Responsividade para Telas Médias */
@media (max-width: 1300px) {
    .hero-sidebar {
        width: 260px;
        min-width: 260px;
    }
}

/* Responsividade para Tablets */
@media (max-width: 1024px) {
    .hero-sidebar {
        position: relative;
        top: auto;
        right: auto;
        width: 100%;
        min-width: auto;
        max-width: 600px;
        max-height: none;
        margin: 20px auto;
        overflow: visible;
    }

    .sidebar-columns {
        gap: 12px;
    }

    .hero-leader-card {
        padding: 15px 12px;
    }

    .sidebar-crown-icon {
        font-size: 1.8rem;
    }

    .hero-leader-card {
        padding: 10px;
    }

    .leader-icon {
        width: 45px;
        height: 45px;
    }

    .leader-icon i {
        font-size: 1.4rem;
    }

    .leader-title {
        font-size: 0.9rem;
    }

    .leader-subtitle {
        font-size: 0.65rem;
    }

    .leader-name {
        font-size: 0.8rem;
    }

    .stat-label {
        font-size: 0.65rem;
    }

    .stat-value {
        font-size: 0.8rem;
    }
}

/* Responsividade para Mobile */
@media (max-width: 768px) {
    .hero-sidebar {
        width: 100%;
        max-width: 100%;
        padding: 12px;
        margin: 15px 0;
        gap: 10px;
    }

    .sidebar-columns {
        gap: 10px;
    }

    .sidebar-crown {
        margin-bottom: 8px;
        padding-bottom: 8px;
    }

    .sidebar-crown-icon {
        font-size: 1.6rem;
    }

    .hero-leader-card {
        padding: 12px 10px;
        border-radius: 6px;
    }

    .leader-icon {
        width: 40px;
        height: 40px;
        margin-bottom: 6px;
    }

    .leader-icon i {
        font-size: 1.2rem;
    }

    .leader-title {
        font-size: 0.85rem;
        margin-bottom: 4px;
    }

    .leader-subtitle {
        font-size: 0.6rem;
        margin-bottom: 6px;
    }

    .leader-name {
        font-size: 0.75rem;
    }

    .leader-stat {
        padding: 5px 8px;
        margin: 6px 0;
    }

    .stat-label {
        font-size: 0.6rem;
    }

    .stat-value {
        font-size: 0.75rem;
    }

    .mini-ranking-list {
        gap: 3px;
    }

    .mini-ranking-item {
        padding: 4px 5px;
    }

    .mini-rank {
        width: 18px;
        height: 18px;
        font-size: 0.65rem;
        line-height: 18px;
    }

    .mini-name {
        font-size: 0.7rem;
    }

    .mini-value {
        font-size: 0.65rem;
    }

    /* Tabelas */
    .level-table-row,
    .sod-table-row,
    .bless-table-row {
        font-size: 0.6rem;
        padding: 4px 5px;
        gap: 3px;
    }

    .level-table-header,
    .sod-table-header,
    .bless-table-header {
        font-size: 0.6rem;
        padding: 5px 6px;
        margin: 6px 0 3px 0;
    }

    .level-table-row .mini-rank,
    .sod-table-row .mini-rank,
    .bless-table-row .mini-rank {
        width: 18px;
        height: 18px;
        font-size: 0.65rem;
        line-height: 18px;
    }

    /* Ajustes de colunas para mobile */

    .level-col-class {
        width: 50px;
        font-size: 0.6rem;
    }

    .level-col-level {
        width: 35px;
        font-size: 0.6rem;
    }

    .bless-col-points,
    .sod-col-points {
        width: 40px;
        font-size: 0.6rem;
    }
}

/* Responsividade para Mobile Muito Pequeno */
@media (max-width: 480px) {
    .hero-sidebar {
        padding: 10px;
        gap: 8px;
    }

    .sidebar-columns {
        gap: 8px;
    }

    .hero-leader-card {
        padding: 10px 8px;
    }

    .leader-title {
        font-size: 0.8rem;
    }

    .leader-subtitle {
        font-size: 0.55rem;
    }

    .bless-col-clan,
    .sod-col-clan,
    .level-col-player {
        font-size: 0.65rem;
    }
}

/* Prevenir overflow e garantir box-sizing consistente */
* {
    box-sizing: border-box;
}

.hero-sidebar *,
.hero-leader-card * {
    box-sizing: border-box;
}

/* Garantir que nenhum elemento absolute cause sobreposição */
.hero-leader-card > * {
    position: relative;
}

.hero-leader-card .leader-icon {
    position: relative;
}

/* Forçar clear e evitar sobreposição */
.sidebar-columns {
    isolation: isolate;
}

.hero-leader-card {
    isolation: isolate;
    clear: both;
}
