/* Leaderboard New Design - Tailwind-inspired CSS */

/* 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;
}

.jp-leaderboard-wrapper {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Premium Gold Gradient */
.bg-premium-gold {
    background: linear-gradient(135deg, rgb(255, 215, 0), rgb(255, 165, 0));
}

/* Scrollbar Hiding */
.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 */
.jp-tab-button {
    position: relative;
    flex-shrink: 0;
    padding: 0.75rem 1.25rem;
    transform: skewX(-12deg);
    transition: all 0.2s;
    border-right: 2px solid white;
    cursor: pointer;
}

.jp-tab-button:last-child {
    border-right: 0;
}

.jp-tab-button.active {
    background: #333333;
    z-index: 10;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.jp-tab-button:not(.active) {
    background: transparent;
}

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

.jp-tab-button span {
    display: block;
    transform: skewX(12deg);
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.jp-tab-button.active span {
    color: rgb(250, 204, 21);
}

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

.jp-tab-button:not(.active):hover span {
    color: rgb(30, 41, 59);
}

/* Badge Styles - Match badges.html */
.jp-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.375rem;
    border-radius: 0.375rem;
    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 - match SVG icons */
.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 - left to right every 10s */
.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 - chỉ áp dụng cho badges trong leaderboard (không áp dụng trong 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-bottom: 0.125rem;
}

.jp-star {
    width: 10px;
    height: 10px;
    fill: rgb(250, 204, 21);
    color: rgb(250, 204, 21);
}

/* Leaderboard Row */
.jp-leaderboard-row {
    display: grid;
    grid-template-columns: 30px 1fr 55px 70px;
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem 0.25rem;
    min-height: 50px;
    transition: background-color 0.2s;
    cursor: pointer;
}

/* Mobile avatar size (+10%) */
.jp-leaderboard-row .jp-avatar-mobile {
    width: 44px !important;
    height: 44px !important;
}

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

/* Hover effect */
.jp-leaderboard-row:hover {
    background-color: rgb(254, 252, 232);
}

.jp-leaderboard-row:active {
    background-color: rgb(254, 249, 195);
}

/* Club styling - multiple clubs */
.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;
}

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

/* Second, third, etc. clubs - lighter and smaller */
.jp-club-container > *:not(:first-child),
.jp-club-container > *:not(:first-child) a {
    color: rgb(148, 163, 184);
    font-size: 11px;
    margin-top: 2px;
}

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

    .jp-tab-button {
        flex-grow: 0;
    }

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

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

    .jp-leaderboard-row {
        grid-template-columns: 55px 1fr 100px 125px 110px 100px 90px minmax(140px, 200px);
        padding: 0.625rem 0.75rem;
    }

    /* Desktop avatar (47px) */
    .jp-leaderboard-row .jp-avatar-img,
    .jp-leaderboard-row .jp-avatar-wrapper .jp-avatar-img {
        width: 47px !important;
        height: 47px !important;
        min-width: 47px !important;
        min-height: 47px !important;
    }

    .jp-leaderboard-row .jp-competitor-cell {
        gap: 0.875rem !important;
    }

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

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

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

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

    /* Mobile row name */
    .jp-leaderboard-row h3 {
        font-size: 13px !important;
    }

    /* Mobile badges smaller */
    .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;
    }

    /* Mobile crown icons - match SVG size */
    .jp-leaderboard-row .jp-crown-icon {
        font-size: 8px !important;
        width: 8px !important;
        height: 8px !important;
    }
}
