/* ============================================
   HavenCraft — Full Leaderboard Specific Styles
   ============================================ */

.page-header {
    padding-top: calc(var(--nav-height) + 32px);
    padding-bottom: 8px;
    margin-bottom: 0;
}

.page-title {
    font-size: clamp(2rem, 3.5vw, 2.75rem);
    font-weight: 800;
    margin-bottom: 8px;
}

.text-accent {
    color: var(--accent);
}

.hint-text {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
}

.full-leaderboard-section {
    padding: 16px 0 60px;
}

/* Container */
.full-lb-wrapper {
    background: var(--surface);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Controls */
.lb-controls {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    background: var(--surface-hover);
}

@media (min-width: 768px) {
    .lb-controls {
        flex-direction: column;
        align-items: center;
    }
}

/* Search Box */
.lb-search-wrapper {
    position: relative;
    width: 100%;
    max-width: 450px;
}

.lb-search-input {
    width: 100%;
    padding: 12px 40px 12px 45px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all var(--transition);
}

.lb-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 200, 150, 0.1);
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.clear-search-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
}

.clear-search-btn:hover {
    color: var(--text);
}

/* Tabs (Pill Segmented Control) */
.lb-tabs-container {
    width: 100%;
}

.full-lb-wrapper .lb-tabs,
.lb-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: transparent !important;
    border: none !important;
    border-bottom: none !important;
    padding: 0 !important;
}

.full-lb-wrapper .lb-tab,
.lb-tab {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 8px 18px !important;
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 9999px !important;
    color: var(--text-secondary) !important;
    font-family: var(--font-body) !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.25s ease !important;
    text-shadow: none !important;
    box-shadow: none !important;
    min-height: 38px !important;
    white-space: nowrap !important;
    flex: initial !important;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.full-lb-wrapper .lb-tab span,
.lb-tab span {
    display: inline !important;
    font-size: inherit !important;
}

.full-lb-wrapper .lb-tab i,
.lb-tab i {
    font-size: 0.9rem !important;
}

.full-lb-wrapper .lb-tab:hover,
.lb-tab:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: var(--text) !important;
    transform: translateY(-1px);
}

.full-lb-wrapper .lb-tab:active,
.lb-tab:active {
    transform: scale(0.97);
}

.full-lb-wrapper .lb-tab.active,
.lb-tab.active {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(0, 200, 150, 0.3) !important;
}

.full-lb-wrapper .lb-tab.active i,
.full-lb-wrapper .lb-tab.active .shard-glyph,
.lb-tab.active i,
.lb-tab.active .shard-glyph {
    color: #ffffff !important;
}

/* Data Container */
.lb-data-container {
    position: relative;
    min-height: 400px;
}

/* Table Header */
.lb-header {
    display: grid;
    grid-template-columns: 80px 1fr 120px;
    padding: 16px 24px;
    background: var(--surface-hover);
    border-bottom: 2px solid var(--border);
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
}

@media (min-width: 768px) {
    .lb-header {
        grid-template-columns: 100px 1fr 150px;
    }
}

.lb-col-val {
    text-align: right;
}

/* Rows */
.flb-list {
    display: flex;
    flex-direction: column;
}

.flb-row {
    display: grid;
    grid-template-columns: 80px 1fr 120px;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
    animation: fadeInRow 0.4s ease-out forwards;
    opacity: 0;
    transform: translateY(10px);
}

@media (min-width: 768px) {
    .flb-row {
        grid-template-columns: 100px 1fr 150px;
    }
}

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

.flb-row:hover {
    background: var(--surface-hover);
}

/* Ranking column */
.flb-rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.95rem;
}

/* Top 3 Highlighting */
.flb-row-top1 .flb-rank-badge {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #fff;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
    font-size: 1.1rem;
}

.flb-row-top2 .flb-rank-badge {
    background: linear-gradient(135deg, #e0e0e0, #9e9e9e);
    color: #fff;
    box-shadow: 0 4px 12px rgba(158, 158, 158, 0.4);
}

.flb-row-top3 .flb-rank-badge {
    background: linear-gradient(135deg, #cd7f32, #a0522d);
    color: #fff;
    box-shadow: 0 4px 12px rgba(205, 127, 50, 0.4);
}

/* Player Column */
.flb-player-col {
    display: flex;
    align-items: center;
    gap: 12px;
}

.flb-avatar {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    image-rendering: pixelated;
    background: rgba(0, 0, 0, 0.1);
}

@media (min-width: 768px) {
    .flb-avatar {
        width: 40px;
        height: 40px;
    }
}

.flb-username {
    font-weight: 700;
    color: var(--text);
    font-size: 1rem;
}

.flb-row-top1 .flb-username {
    color: #ffaa00;
}

/* Value Column */
.flb-value {
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--text);
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Loading Skeleton */
.flb-loading {
    padding: 10px 0;
}

.flb-skeleton-row {
    display: grid;
    grid-template-columns: 80px 1fr 120px;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    animation: skeletonPulse 1.5s infinite ease-in-out;
}

@media (min-width: 768px) {
    .flb-skeleton-row {
        grid-template-columns: 100px 1fr 150px;
    }
}

.skel-block {
    height: 24px;
    background: var(--border-strong);
    border-radius: 4px;
}

.skel-rank {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.skel-player {
    display: flex;
    gap: 12px;
    align-items: center;
}

.skel-avatar {
    width: 40px;
    height: 40px;
    border-radius: 4px;
}

.skel-name {
    width: 120px;
}

.skel-val {
    width: 80px;
    justify-self: end;
}

@keyframes skeletonPulse {
    0% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.5;
    }
}

/* Empty / Error States */
.flb-empty,
.flb-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.flb-empty .empty-icon {
    font-size: 3rem;
    color: var(--border-strong);
    margin-bottom: 16px;
}

.flb-empty h3 {
    color: var(--text);
    margin-bottom: 8px;
}

.flb-error i {
    font-size: 3rem;
    color: #ff5050;
    margin-bottom: 16px;
}

/* Bottom Bar */
.lb-bottom-bar {
    padding: 20px 24px;
    background: var(--surface-hover);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

@media (min-width: 768px) {
    .lb-bottom-bar {
        flex-direction: row;
        justify-content: space-between;
    }
}

.lb-stats {
    display: flex;
    gap: 16px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.lb-pagination {
    display: flex;
    align-items: center;
    gap: 16px;
}

.page-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.page-btn {
    min-width: 90px;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}


/* Mobile Fixes for Leaderboard */
@media (max-width: 640px) {
    .lb-header {
        grid-template-columns: 50px 1fr 80px;
        padding: 12px 12px;
        gap: 8px;
    }

    .flb-row {
        grid-template-columns: 50px 1fr 80px;
        padding: 12px 12px;
        gap: 8px;
    }

    .flb-skeleton-row {
        grid-template-columns: 50px 1fr 80px;
        padding: 12px 12px;
        gap: 8px;
    }

    .flb-rank-badge {
        width: 30px;
        height: 30px;
        font-size: 0.85rem;
    }

    .flb-value {
        font-size: 0.85rem;
    }

    .flb-avatar {
        width: 28px;
        height: 28px;
    }

    .flb-username {
        font-size: 0.85rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100px;
    }

    .flb-player-col {
        gap: 8px;
        min-width: 0;
    }
}

/* ============================================
   TOP SUMMARY CARDS — Redesigned
   ============================================ */

/* Entrance animation */
@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.96);
    }

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

@keyframes shimmerGlow {
    0% {
        background-position: -200% center;
    }

    100% {
        background-position: 200% center;
    }
}

@keyframes subtlePulse {

    0%,
    100% {
        box-shadow: var(--shadow-sm);
    }

    50% {
        box-shadow: var(--shadow-md);
    }
}

.top-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.top-summary-card {
    background: var(--surface);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 12px;
    box-shadow: var(--shadow-sm);
    text-align: center;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.35s ease;
    /* Start hidden for entrance animation */
    opacity: 0;
    transform: translateY(24px) scale(0.96);
}

.top-summary-card.loaded {
    animation: fadeSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Decorative gradient shimmer line at top */
.top-summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    background-size: 200% 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.top-summary-card:hover::before {
    opacity: 1;
    animation: shimmerGlow 2s linear infinite;
}

.top-summary-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: var(--shadow-md);
    border-color: rgba(0, 200, 150, 0.15);
}

/* Category-specific top accent colors */
.top-summary-card[data-cat="playtime"]::before {
    background: linear-gradient(90deg, transparent, #3b82f6, transparent);
    background-size: 200% 100%;
}

.top-summary-card[data-cat="kills"]::before {
    background: linear-gradient(90deg, transparent, #ef4444, transparent);
    background-size: 200% 100%;
}

.top-summary-card[data-cat="deaths"]::before {
    background: linear-gradient(90deg, transparent, #a855f7, transparent);
    background-size: 200% 100%;
}

.top-summary-card[data-cat="money"]::before {
    background: linear-gradient(90deg, transparent, #10b981, transparent);
    background-size: 200% 100%;
}

.top-summary-card[data-cat="block_place"]::before {
    background: linear-gradient(90deg, transparent, #f59e0b, transparent);
    background-size: 200% 100%;
}

.top-summary-card[data-cat="block_break"]::before {
    background: linear-gradient(90deg, transparent, #8b5cf6, transparent);
    background-size: 200% 100%;
}

.top-summary-card[data-cat="mobs_killed"]::before {
    background: linear-gradient(90deg, transparent, #ec4899, transparent);
    background-size: 200% 100%;
}

.top-summary-card[data-cat="shards"]::before {
    background: linear-gradient(90deg, transparent, #06b6d4, transparent);
    background-size: 200% 100%;
}

.top-summary-card[data-cat="playtime"]:hover {
    border-color: rgba(59, 130, 246, 0.25);
}

.top-summary-card[data-cat="kills"]:hover {
    border-color: rgba(239, 68, 68, 0.25);
}

.top-summary-card[data-cat="deaths"]:hover {
    border-color: rgba(168, 85, 247, 0.25);
}

.top-summary-card[data-cat="money"]:hover {
    border-color: rgba(16, 185, 129, 0.25);
}

.top-summary-card[data-cat="block_place"]:hover {
    border-color: rgba(245, 158, 11, 0.25);
}

.top-summary-card[data-cat="block_break"]:hover {
    border-color: rgba(139, 92, 246, 0.25);
}

.top-summary-card[data-cat="mobs_killed"]:hover {
    border-color: rgba(236, 72, 153, 0.25);
}

.top-summary-card[data-cat="shards"]:hover {
    border-color: rgba(6, 182, 212, 0.25);
}

.top-summary-icon {
    font-size: 20px;
    color: var(--primary);
    margin-bottom: 6px;
    transition: transform 0.3s ease;
    line-height: 1;
}

.top-summary-card:hover .top-summary-icon {
    transform: scale(1.15);
}

.shard-glyph {
    font-family: Arial, "Helvetica Neue", sans-serif;
    font-style: normal;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.top-summary-card[data-cat="playtime"] .top-summary-icon {
    color: #3b82f6;
}

.top-summary-card[data-cat="kills"] .top-summary-icon {
    color: #ef4444;
}

.top-summary-card[data-cat="deaths"] .top-summary-icon {
    color: #a855f7;
}

.top-summary-card[data-cat="money"] .top-summary-icon {
    color: #10b981;
}

.top-summary-card[data-cat="block_place"] .top-summary-icon {
    color: #f59e0b;
}

.top-summary-card[data-cat="block_break"] .top-summary-icon {
    color: #8b5cf6;
}

.top-summary-card[data-cat="mobs_killed"] .top-summary-icon {
    color: #ec4899;
}

.top-summary-card[data-cat="shards"] .top-summary-icon {
    color: #06b6d4;
}

.top-summary-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 8px;
    line-height: 1.2;
}

.top-summary-player {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* Content inside summary card */
.top-summary-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    width: 100%;
}

.top-summary-avatar {
    width: 32px;
    height: 32px;
    border-radius: 5px;
    image-rendering: pixelated;
    border: 1.5px solid var(--border);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.top-summary-card:hover .top-summary-avatar {
    transform: scale(1.08);
    border-color: var(--primary);
}

.top-summary-name {
    font-weight: 700;
    color: var(--text);
    font-size: 0.92rem;
    line-height: 1.2;
    text-decoration: none;
    transition: color 0.2s ease;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-summary-name:hover {
    color: var(--primary);
}

.top-summary-value {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.2px;
    line-height: 1.2;
    text-shadow: 0 0 16px rgba(0, 200, 150, 0.15);
}

.top-summary-card[data-cat="playtime"] .top-summary-value {
    color: #3b82f6;
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.15);
}

.top-summary-card[data-cat="kills"] .top-summary-value {
    color: #ef4444;
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.15);
}

.top-summary-card[data-cat="deaths"] .top-summary-value {
    color: #a855f7;
    text-shadow: 0 0 20px rgba(168, 85, 247, 0.15);
}

.top-summary-card[data-cat="money"] .top-summary-value {
    color: #10b981;
    text-shadow: 0 0 20px rgba(16, 185, 129, 0.15);
}

.top-summary-card[data-cat="block_place"] .top-summary-value {
    color: #f59e0b;
    text-shadow: 0 0 20px rgba(245, 158, 11, 0.15);
}

.top-summary-card[data-cat="block_break"] .top-summary-value {
    color: #8b5cf6;
    text-shadow: 0 0 20px rgba(139, 92, 246, 0.15);
}

.top-summary-card[data-cat="mobs_killed"] .top-summary-value {
    color: #ec4899;
    text-shadow: 0 0 20px rgba(236, 72, 153, 0.15);
}

.top-summary-card[data-cat="shards"] .top-summary-value {
    color: #06b6d4;
    text-shadow: 0 0 20px rgba(6, 182, 212, 0.15);
}

.top-summary-dash {
    font-size: 1.5rem;
    color: var(--text-muted);
}

@media (max-width: 900px) {
    .top-summary-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }

    .top-summary-card {
        padding: 12px 8px;
    }

    .top-summary-name {
        font-size: 0.85rem;
    }

    .top-summary-value {
        font-size: 0.98rem;
    }
}

@media (max-width: 768px) {
    .top-summary-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .top-summary-card {
        padding: 14px 10px;
    }

    .top-summary-name {
        font-size: 0.9rem;
    }

    .top-summary-value {
        font-size: 1.02rem;
    }
}

@media (max-width: 480px) {
    .page-header {
        padding-top: calc(var(--nav-height) + 20px);
        padding-bottom: 6px;
    }

    .full-leaderboard-section {
        padding-top: 10px;
    }

    .top-summary-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-bottom: 20px;
    }

    .top-summary-card {
        padding: 10px 8px;
    }

    .top-summary-icon {
        font-size: 17px;
        margin-bottom: 4px;
    }

    .top-summary-label {
        font-size: 0.65rem;
        margin-bottom: 6px;
    }

    .top-summary-avatar {
        width: 28px;
        height: 28px;
    }

    .top-summary-name {
        font-size: 0.82rem;
    }

    .top-summary-value {
        font-size: 0.92rem;
    }
}

/* Mobile Category Tabs & Buttons Adjustments */
@media (max-width: 768px) {
    .lb-controls {
        padding: 16px 12px;
        gap: 12px;
    }

    .lb-search-wrapper {
        max-width: 100%;
    }

    .lb-search-input {
        padding: 10px 36px 10px 38px;
        font-size: 0.92rem;
    }

    .search-icon {
        left: 12px;
        font-size: 0.9rem;
    }

    .clear-search-btn {
        right: 8px;
        width: 32px;
        height: 32px;
    }

    /* Category pills horizontal smooth scroll */
    .lb-tabs-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        position: relative;
        padding: 4px 2px 6px;
        mask-image: none;
        -webkit-mask-image: none;
    }

    .lb-tabs-container::-webkit-scrollbar {
        display: none;
    }

    .full-lb-wrapper .lb-tabs,
    .lb-tabs {
        display: flex !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        width: max-content !important;
        gap: 8px !important;
        padding: 0 4px !important;
    }

    .full-lb-wrapper .lb-tab,
    .lb-tab {
        padding: 7px 14px !important;
        font-size: 0.82rem !important;
        min-height: 36px !important;
        gap: 6px !important;
        flex-shrink: 0 !important;
        border-radius: 9999px !important;
    }

    .full-lb-wrapper .lb-tab span,
    .lb-tab span {
        display: inline !important;
        font-size: 0.82rem !important;
    }

    .full-lb-wrapper .lb-tab i,
    .lb-tab i {
        font-size: 0.85rem !important;
    }

    /* Pagination buttons on mobile */
    .lb-bottom-bar {
        padding: 14px 12px;
        gap: 12px;
    }

    .lb-stats {
        flex-direction: column;
        align-items: center;
        gap: 4px;
        font-size: 0.8rem;
        text-align: center;
    }

    .lb-pagination {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
    }

    .page-btn {
        flex: 1;
        max-width: 110px;
        min-height: 40px;
        padding: 8px 12px;
        font-size: 0.85rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        border-radius: var(--radius-sm);
    }

    .page-info {
        font-size: 0.82rem;
        white-space: nowrap;
    }
}