/* Leaderboard New Design - Table-based layout */

/* Fix modal z-index to appear above header */
#jp_googlesheet_api-modal.uk-modal {
    z-index: 99999 !important;
}

/* Fix modal vertical center */
#jp_googlesheet_api-modal .uk-modal-dialog {
    margin: auto !important;
}

/* Fix modal content alignment - left align values */
.jp_ggs_modal_content_thongtin table td:nth-child(2) {
    text-align: left !important;
}

/* Fix danh hieu badges in modal - match leaderboard style */
#jp_googlesheet_api-modal [data-target="__danh_hieu"],
#jp_googlesheet_api-modal .jpga-danh-hieu {
    display: flex !important;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center !important;
}

#jp_googlesheet_api-modal .jp-badge {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.25rem !important;
    padding: 0.25rem 0.5rem !important;
    border-radius: 0.375rem !important;
    border: 1px solid !important;
    white-space: nowrap !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
}

#jp_googlesheet_api-modal .jp-badge.badge-yellow {
    border-color: #fcd34d !important;
    background: #fbbf24 !important;
    color: #451a03 !important;
    position: relative !important;
    overflow: hidden !important;
}

#jp_googlesheet_api-modal .jp-badge.badge-yellow::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.6),
        transparent
    );
    animation: vip-shine 5s infinite;
}

#jp_googlesheet_api-modal .jp-badge.badge-red {
    border-color: #fca5a5 !important;
    background: #f87171 !important;
    color: #991b1b !important;
}

#jp_googlesheet_api-modal .jp-badge.badge-blue {
    border-color: #93c5fd !important;
    background: #60a5fa !important;
    color: #1e3a8a !important;
}

#jp_googlesheet_api-modal .jp-badge.badge-gray {
    border-color: #d1d5db !important;
    background: #94a3b8 !important;
    color: #334155 !important;
}

#jp_googlesheet_api-modal .jp-badge.badge-orange {
    border-color: #fdba74 !important;
    background: #fb923c !important;
    color: #7c2d12 !important;
}

#jp_googlesheet_api-modal .jp-badge.badge-green {
    border-color: #86efac !important;
    background: #4ade80 !important;
    color: #14532d !important;
}

#jp_googlesheet_api-modal .jp-badge.badge-pink {
    border-color: #f9a8d4 !important;
    background: #f472b6 !important;
    color: #9d174d !important;
}

#jp_googlesheet_api-modal .jp-badge.badge-cyan {
    border-color: #67e8f9 !important;
    background: #22d3ee !important;
    color: #164e63 !important;
}

#jp_googlesheet_api-modal .jp-badge.badge-purple {
    border-color: #d8b4fe !important;
    background: #c084fc !important;
    color: #581c87 !important;
}

#jp_googlesheet_api-modal .jp-badge.badge-white {
    border-color: #e5e7eb !important;
    background: #ffffff !important;
    color: #1f2937 !important;
}

#jp_googlesheet_api-modal .jp-badge.badge-cyan-light {
    border-color: #cffafe !important;
    background: #a5f3fc !important;
    color: #164e63 !important;
}

#jp_googlesheet_api-modal .jp-badge.badge-pink-light {
    border-color: #fce7f3 !important;
    background: #fbcfe8 !important;
    color: #9f1239 !important;
}

#jp_googlesheet_api-modal .jp-badge svg {
    width: 12px !important;
    height: 12px !important;
}

#jp_googlesheet_api-modal .jp-crown-icon {
    font-size: 12px !important;
    width: 12px !important;
    height: 12px !important;
}

/* Wrapper */
.jp-leaderboard-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f5f9;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Scrollbar Hiding (for tabs) */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-in-out forwards;
}

.animate-fade-in-up {
    animation: fadeInUp 0.5s ease-out forwards;
}

/* Tabs - Rounded pill style */
.jp-tab-button {
    position: relative;
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    transition: all 0.2s;
    border: 1px solid transparent;
    cursor: pointer;
    background: transparent;
}

.jp-tab-button.active {
    background: #0f172a;
    border-color: #0f172a;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.15);
}

.jp-tab-button:not(.active):hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: #FFA500;
}

.jp-tab-button span {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.jp-tab-button.active span {
    color: #FFD700;
}

.jp-tab-button:not(.active) span {
    color: rgb(100, 116, 139);
}

.jp-tab-button:not(.active):hover span {
    color: #FFA500;
}

/* Badge Styles */
.jp-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    border: 1px solid;
    white-space: nowrap;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s ease-in-out;
}

/* Crown icon sizing */
.jp-crown-icon {
    display: inline-block;
    font-size: 12px;
    line-height: 1;
    width: 12px;
    height: 12px;
}

.jp-badge.badge-yellow {
    border-color: #fcd34d;
    background: #fbbf24;
    color: #451a03;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
    position: relative;
    overflow: hidden;
}

/* VIP shine animation */
.jp-badge.badge-yellow::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.6),
        transparent
    );
    animation: vip-shine 5s infinite;
}

@keyframes vip-shine {
    0%, 90% {
        left: -100%;
    }
    95% {
        left: 100%;
    }
    100% {
        left: 100%;
    }
}

.jp-badge.badge-red {
    border-color: #fca5a5;
    background: #f87171;
    color: #991b1b;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

.jp-badge.badge-blue {
    border-color: #93c5fd;
    background: #60a5fa;
    color: #1e3a8a;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.jp-badge.badge-gray {
    border-color: #d1d5db;
    background: #94a3b8;
    color: #334155;
    box-shadow: 0 2px 8px rgba(148, 163, 184, 0.1);
}

.jp-badge.badge-orange {
    border-color: #fdba74;
    background: #fb923c;
    color: #7c2d12;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.2);
}

.jp-badge.badge-green {
    border-color: #86efac;
    background: #4ade80;
    color: #14532d;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.2);
}

.jp-badge.badge-pink {
    border-color: #f9a8d4;
    background: #f472b6;
    color: #9d174d;
    box-shadow: 0 2px 8px rgba(236, 72, 153, 0.2);
}

.jp-badge.badge-cyan {
    border-color: #67e8f9;
    background: #22d3ee;
    color: #164e63;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.2);
}

.jp-badge.badge-purple {
    border-color: #d8b4fe;
    background: #c084fc;
    color: #581c87;
    box-shadow: 0 2px 8px rgba(168, 85, 247, 0.2);
}

.jp-badge.badge-white {
    border-color: #e5e7eb;
    background: #ffffff;
    color: #1f2937;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.jp-badge.badge-cyan-light {
    border-color: #cffafe;
    background: #a5f3fc;
    color: #164e63;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.15);
}

.jp-badge.badge-pink-light {
    border-color: #fce7f3;
    background: #fbcfe8;
    color: #9f1239;
    box-shadow: 0 2px 8px rgba(244, 114, 182, 0.15);
}

.jp-badge {
    position: relative;
}

.jp-badge:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

/* Custom tooltip - only for badges in leaderboard rows (not modal) */
.jp-leaderboard-row .jp-badge[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease 0s, visibility 0s linear 0s;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Tooltip arrow */
.jp-leaderboard-row .jp-badge[data-tooltip-arrow="true"]::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease 0s, visibility 0s linear 0s;
    z-index: 1000;
}

/* Show tooltip after 0.3s hover */
.jp-leaderboard-row .jp-badge[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
    transition-delay: 0.3s;
}

.jp-leaderboard-row .jp-badge[data-tooltip-arrow="true"]:hover::after {
    opacity: 1;
    visibility: visible;
    transition-delay: 0.3s;
}

/* Mobile: Show tooltip when badge has 'badge-active' class (tap to show) */
.jp-leaderboard-row .jp-badge[data-tooltip].badge-active::before {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
}

.jp-leaderboard-row .jp-badge[data-tooltip-arrow="true"].badge-active::after {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
}

/* Stars */
.jp-stars {
    display: flex;
    gap: 1px;
    margin-top: 0.25rem;
}

.jp-star {
    width: 10px;
    height: 10px;
    fill: #FFA500;
    color: #FFA500;
}

/* Table Rows */
.jp-leaderboard-table {
    border-collapse: collapse;
}

.jp-leaderboard-row {
    transition: background-color 0.2s;
    cursor: pointer;
}

.jp-leaderboard-row:hover {
    background-color: rgb(248, 250, 252);
}

.jp-leaderboard-row.jp-top3-row {
    background: linear-gradient(to right, rgba(255, 215, 0, 0.05), transparent);
}

.jp-leaderboard-row.jp-top3-row:hover {
    background: linear-gradient(to right, rgba(255, 215, 0, 0.1), rgba(248, 250, 252, 0.5));
}

/* Gold gradient rank text for top 3 */
.jp-rank-gold {
    font-weight: 900;
    font-style: italic;
    letter-spacing: -0.05em;
    background: linear-gradient(to bottom right, #FFD700, #FFA500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.1));
}

/* Avatar - rounded-lg instead of rounded-full */
.jp-avatar-img {
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid rgb(226, 232, 240);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.jp-avatar-img.jp-avatar-top3 {
    border-color: #FFD700;
}

/* Name with Facebook link - underline on hover */
.jp-leaderboard-row h3 a.jp-fb-link:hover {
    text-decoration: underline !important;
}

/* Club styling */
.jp-club-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: left;
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    padding-right: 0.5rem;
}

.jp-club-container > *:first-child,
.jp-club-container > *:first-child a {
    color: rgb(51, 65, 85);
    font-size: 13px;
}

.jp-club-container > *:not(:first-child),
.jp-club-container > *:not(:first-child) a {
    color: rgb(148, 163, 184);
    font-size: 11px;
    margin-top: 2px;
}

/* Responsive */
@media (min-width: 768px) {
    .jp-leaderboard-wrapper {
        padding: 2.5rem 1rem;
    }

    .jp-tab-button {
        padding: 0.5rem 1rem;
    }

    .jp-tab-button span {
        font-size: 0.8125rem;
    }

    .jp-badge {
        gap: 0.25rem;
        font-size: 0.625rem;
    }

    .jp-star {
        width: 14px;
        height: 14px;
    }

    /* Desktop avatar */
    .jp-leaderboard-row .jp-avatar-img {
        width: 56px !important;
        height: 56px !important;
        min-width: 56px !important;
        min-height: 56px !important;
    }

    .jp-leaderboard-row h3 {
        font-size: 15px !important;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .jp-leaderboard-wrapper {
        padding: 1rem 0.5rem;
    }

    .jp-tab-button {
        padding: 0.375rem 0.75rem;
    }

    .jp-tab-button span {
        font-size: 0.6875rem;
    }

    .jp-leaderboard-row h3 {
        font-size: 12px !important;
    }

    .jp-leaderboard-row .jp-badge {
        padding: 0.1rem 0.25rem !important;
        font-size: 7px !important;
    }

    .jp-leaderboard-row .jp-badge svg {
        width: 8px !important;
        height: 8px !important;
    }

    .jp-leaderboard-row .jp-crown-icon {
        font-size: 8px !important;
        width: 8px !important;
        height: 8px !important;
    }

    .jp-leaderboard-row .jp-avatar-img {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
    }
}
