/**
 * Monthly Competition Leaderboard Styles
 * Version: 9.2
 */

.competition-page {
    padding: 40px 20px;
    direction: rtl;
    text-align: right;
}

.page-header {
    background: linear-gradient(135deg, #1a1a1a 0%, #8b6914 50%, #ffd700 100%);
    color: white;
    padding: 50px 20px;
    border-radius: 15px;
    margin-bottom: 40px;
    box-shadow: 0 15px 40px rgba(218, 165, 32, 0.5);
    border: 2px solid #ffd700;
}

.page-header .display-4 {
    font-weight: 700;
    margin-bottom: 10px;
}

.page-header .lead {
    font-size: 1.5rem;
    opacity: 0.9;
}

.competition-stats {
    margin-top: 30px;
}

.stat-box {
    background: rgba(255, 255, 255, 0.15);
    padding: 20px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.stat-box h3 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-box p {
    margin: 0;
    font-size: 1.1rem;
    opacity: 0.9;
}

/* ============================================ */
/* Winners Banner Compact - Inside Header */
/* ============================================ */
.competition-page .winners-banner-compact {
    margin-top: 30px;
    padding: 0 20px;
}

.title-winner-card-compact {
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.9) 0%, rgba(45, 45, 45, 0.9) 100%);
    text-align: center;
    display: flex;
    color: #000;
    border: 2px solid #ffd700;
    border-radius: 12px;
    padding: 15px 20px;
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
}

.competition-page .winner-card-compact {
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.9) 0%, rgba(45, 45, 45, 0.9) 100%);
    border: 2px solid #ffd700;
    border-radius: 12px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
}

.competition-page .winner-card-compact:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 215, 0, 0.5);
}

.competition-page .winner-card-compact.buyer-winner {
    border-color: #ffd700;
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
}

.competition-page .winner-card-compact.buyer-winner:hover {
    box-shadow: 0 8px 20px rgba(255, 215, 0, 0.5);
}

.competition-page .winner-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.competition-page .winner-info {
    flex: 1;
    text-align: right;
}

.competition-page .winner-label-compact {
    font-size: 0.85rem;
    color: #ffd700;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.competition-page .buyer-winner .winner-label-compact {
    color: #ffd700;
}

.competition-page .winner-name-compact {
    font-size: 1.1rem;
    color: #ffffff;
    font-weight: 700;
    margin-bottom: 3px;
}

.competition-page .winner-count-compact {
    font-size: 1.3rem;
    color: #ffd700;
    font-weight: 900;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.competition-page .buyer-winner .winner-count-compact {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* Responsive Winners Banner Compact */
@media (max-width: 767px) {
    .competition-page .winners-banner-compact {
        padding: 0 10px;
    }
    
    .competition-page .winner-card-compact {
        padding: 12px 15px;
        gap: 10px;
    }
    
    .competition-page .winner-icon {
        font-size: 2rem;
    }
    
    .competition-page .winner-name-compact {
        font-size: 1rem;
    }
    
    .competition-page .winner-count-compact {
        font-size: 1.1rem;
    }
}

/* ============================================ */
/* User Stats Banner */
/* ============================================ */
.user-stats-banner {
    background: linear-gradient(135deg, #c41e3a 0%, #8b6914 50%, #daa520 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    border: 2px solid #ffd700;
    box-shadow: 0 10px 30px rgba(218, 165, 32, 0.4);
    text-align: right;
}

.user-stats-banner h4 {
    margin-bottom: 15px;
}

.user-stats-banner .badge {
    font-size: 0.9rem;
    padding: 5px 10px;
    animation: badge-move 2s infinite;
    text-align: right;
}

@keyframes badge-move {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(-10px);
    }
}

.leaderboard-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    min-height: 800px;
}

.section-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #b8860b;
    padding-bottom: 15px;
    border-bottom: 3px solid #daa520;
    text-shadow: 1px 1px 2px rgba(218, 165, 32, 0.3);
}

.leaderboard-list {
    margin-top: 20px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 20px;
    margin-bottom: 15px;
    background: #f8f9fa;
    border-radius: 12px;
    transition: all 0.3s ease;
    border-left: 4px solid #ddd;
}

.leaderboard-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.leaderboard-item.top-three {
    background: linear-gradient(135deg, #fff9e6 0%, #fff 100%);
    border-left: 4px solid #ffd700;
}

.leaderboard-item.rank-1 {
    background: linear-gradient(135deg, #ffd700 0%, #fff9c4 25%, #ffed4e 50%, #fff9c4 75%, #ffd700 100%);
    border-left: 6px solid #b8860b;
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.6), 0 0 20px rgba(255, 215, 0, 0.3);
    border: 2px solid #daa520;
}

.leaderboard-item.rank-2 {
    background: linear-gradient(135deg, #c0c0c0 0%, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%, #c0c0c0 100%);
    border-left: 6px solid #808080;
    box-shadow: 0 8px 25px rgba(192, 192, 192, 0.5), 0 0 15px rgba(192, 192, 192, 0.2);
    border: 2px solid #a8a8a8;
}

.leaderboard-item.rank-3 {
    background: linear-gradient(135deg, #cd7f32 0%, #f4a460 25%, #e5a572 50%, #f4a460 75%, #cd7f32 100%);
    border-left: 6px solid #8b4513;
    box-shadow: 0 8px 25px rgba(205, 127, 50, 0.5), 0 0 15px rgba(205, 127, 50, 0.2);
    border: 2px solid #b8722c;
}

.rank-badge {
    font-size: 2rem;
    font-weight: 700;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 50%;
    margin-left: 20px;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.leaderboard-item.rank-1 .rank-badge {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 50%, #ffd700 100%);
    color: #1a1a1a;
    animation: shine 3s infinite;
    border: 3px solid #b8860b;
    font-size: 2.2rem;
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.5), inset 0 0 10px rgba(255, 255, 255, 0.3);
}

.leaderboard-item.rank-2 .rank-badge {
    background: linear-gradient(135deg, #c0c0c0 0%, #f0f0f0 50%, #c0c0c0 100%);
    color: #333;
    border: 3px solid #808080;
    font-size: 2rem;
    box-shadow: 0 4px 12px rgba(192, 192, 192, 0.5), inset 0 0 8px rgba(255, 255, 255, 0.2);
}

.leaderboard-item.rank-3 .rank-badge {
    background: linear-gradient(135deg, #cd7f32 0%, #f4a460 50%, #cd7f32 100%);
    color: #1a1a1a;
    border: 3px solid #8b4513;
    font-size: 2rem;
    box-shadow: 0 4px 12px rgba(205, 127, 50, 0.5), inset 0 0 8px rgba(255, 255, 255, 0.2);
}

@keyframes shine {

    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.2);
    }
}

.user-info {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    margin-left: 15px;
    flex-shrink: 0;
    background: #daa520;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #b8860b;
    box-shadow: 0 2px 8px rgba(218, 165, 32, 0.3);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.default-avatar {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #b8860b 0%, #daa520 100%);
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    box-shadow: inset 0 0 10px rgba(255, 215, 0, 0.3);
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-details h5 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.user-details h5 a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
}

.user-details h5 a:hover {
    color: #b8860b;
    text-shadow: 1px 1px 2px rgba(218, 165, 32, 0.2);
}

.store-name {
    color: #666;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.transaction-count {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: white;
    padding: 10px 20px;
    border-radius: 8px;
    margin-right: 15px;
    flex-shrink: 0;
}

.count-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: #b8860b;
    text-shadow: 1px 1px 2px rgba(218, 165, 32, 0.3);
}

.count-label {
    font-size: 0.85rem;
    color: #666;
    text-transform: uppercase;
}

.competition-info {
    margin-top: 60px;
}

.competition-info .card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.competition-info .card-body {
    padding: 30px;
}

.competition-info h3 {
    color: #b8860b;
    font-weight: 700;
    margin-bottom: 20px;
    text-shadow: 1px 1px 2px rgba(218, 165, 32, 0.2);
}

.competition-info ul {
    list-style: none;
    padding: 0;
}

.competition-info ul li {
    padding: 10px 0;
    padding-right: 30px;
    position: relative;
    font-size: 1.05rem;
}

.competition-info ul li:before {
    content: "✓";
    position: absolute;
    right: 0;
    color: #daa520;
    font-weight: 700;
    font-size: 1.2rem;
    text-shadow: 1px 1px 2px rgba(218, 165, 32, 0.3);
}

/* Competition Navigation Bar */
.competition-nav {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 5px !important;
    max-width: 100% !important;
}

/* Competition User Details */
.competition-page .user-details {
    flex: 1 !important;
}

.competition-page .user-name {
    font-weight: 600 !important;
    color: #333 !important;
    font-size: 1.1rem !important;
}

/* Competition Stats Card */
.competition-page .stat-card {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2) !important;
    transition: transform 0.3s ease !important;
}

.competition-page .stat-card:hover {
    transform: translateY(-10px) !important;
}

.competition-page .stat-card hr {
    opacity: 0.3 !important;
}

/* Competition Buttons Base - High Specificity */
.competition-page .competition-btn,
.competition-page a.competition-btn {
    display: inline-block !important;
    text-align: center !important;
    text-decoration: none !important;
    vertical-align: middle !important;
    cursor: pointer !important;
    user-select: none;
    line-height: 1.5 !important;
    font-size: 0.95rem !important;
}

.competition-page .competition-btn-primary,
.competition-page a.competition-btn-primary {
    background: linear-gradient(135deg, #b8860b 0%, #daa520 50%, #ffd700 100%) !important;
    border: 2px solid #b8860b !important;
    padding: 10px 25px !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    transition: all 0.3s !important;
    color: #1a1a1a !important;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 4px 15px rgba(218, 165, 32, 0.4) !important;
}

.competition-page .competition-btn-primary:hover,
.competition-page a.competition-btn-primary:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6), 0 0 15px rgba(255, 215, 0, 0.3) !important;
    color: #1a1a1a !important;
    text-decoration: none !important;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 50%, #ffd700 100%) !important;
    border-color: #daa520 !important;
}

.competition-page .competition-btn-outline-primary,
.competition-page a.competition-btn-outline-primary {
    border: 2px solid #b8860b !important;
    background: transparent !important;
    color: #b8860b !important;
    padding: 10px 25px !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    transition: all 0.3s !important;
}

.competition-page .competition-btn-outline-primary:hover,
.competition-page a.competition-btn-outline-primary:hover {
    background: linear-gradient(135deg, #b8860b 0%, #daa520 100%) !important;
    border-color: #b8860b !important;
    color: white !important;
    transform: translateY(-3px) !important;
    text-decoration: none !important;
    box-shadow: 0 5px 15px rgba(218, 165, 32, 0.4) !important;
    text-shadow: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .page-header .display-4 {
        font-size: 2rem;
    }

    .leaderboard-item {
        flex-wrap: wrap;
        padding: 15px;
    }

    .rank-badge {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
        margin-left: 10px;
    }

    .user-avatar {
        width: 40px;
        height: 40px;
        margin-left: 10px;
    }

    .transaction-count {
        width: 100%;
        margin-top: 10px;
        margin-right: 0;
        flex-direction: row;
        justify-content: center;
    }

    .count-number {
        font-size: 1.5rem;
        margin-left: 5px;
    }

    .stat-box h3 {
        font-size: 2rem;
    }

    .leaderboard-section {
        padding: 20px;
        min-height: auto;
    }
}

/* Animation for new entries */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.leaderboard-item {
    animation: slideIn 0.5s ease-out;
}

.leaderboard-item:nth-child(1) {
    animation-delay: 0.1s;
}

.leaderboard-item:nth-child(2) {
    animation-delay: 0.2s;
}

.leaderboard-item:nth-child(3) {
    animation-delay: 0.3s;
}

.leaderboard-item:nth-child(4) {
    animation-delay: 0.4s;
}

.leaderboard-item:nth-child(5) {
    animation-delay: 0.5s;
}

/* Print Styles */
@media print {

    .competition-page .competition-btn,
    .competition-page .competition-info {
        display: none;
    }

    .competition-page .leaderboard-item {
        break-inside: avoid;
    }
}