/**
 * Mobility Trailblazers Ranking System v2
 * Complete rebuild of ranking, medal, and badge displays
 * @since 2.5.19
 */

/* ========================================
   Base Ranking Badge Styles
   ======================================== */

.mt-ranking-badge {
    position: relative;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    transition: all 0.3s ease;
}

/* Badge Sizes */
.mt-badge-small {
    width: 32px;
    height: 32px;
    font-size: 14px;
}

.mt-badge-medium {
    width: 48px;
    height: 48px;
    font-size: 18px;
}

.mt-badge-large {
    width: 64px;
    height: 64px;
    font-size: 24px;
}

/* Badge Contexts */
.mt-badge-context-default {
    border-radius: 50%;
    box-shadow: 0 2px 8px rgb(0 0 0 / 15%);
}

.mt-badge-context-table {
    border-radius: 8px;
    box-shadow: 0 1px 3px rgb(0 0 0 / 10%);
}

.mt-badge-context-card {
    position: absolute;
    top: -20px;
    right: -20px;
    z-index: 10;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgb(0 0 0 / 20%);
}

.mt-badge-context-hero {
    border-radius: 50%;
    box-shadow: 0 6px 20px rgb(0 0 0 / 30%);
}

/* ========================================
   Rank Colors and Styles
   ======================================== */

/* Gold Rank */
.mt-rank-gold {
    color: #333;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border: 2px solid #B8860B;
}

.mt-rank-gold .mt-medal-icon {
    color: #FFD700;
}

.mt-rank-gold .mt-rank-number {
    color: #333;
    text-shadow: 1px 1px 2px rgb(255 255 255 / 50%);
}

/* Silver Rank */
.mt-rank-silver {
    color: #333;
    background: linear-gradient(135deg, #E5E5E5, #B8B8B8);
    border: 2px solid #999;
}

.mt-rank-silver .mt-medal-icon {
    color: #C0C0C0;
}

.mt-rank-silver .mt-rank-number {
    color: #333;
    text-shadow: 1px 1px 2px rgb(255 255 255 / 50%);
}

/* Bronze Rank */
.mt-rank-bronze {
    color: #fff;
    background: linear-gradient(135deg, #CD7F32, #A0522D);
    border: 2px solid #8B4513;
}

.mt-rank-bronze .mt-medal-icon {
    color: #CD7F32;
}

.mt-rank-bronze .mt-rank-number {
    color: #fff;
    text-shadow: 1px 1px 2px rgb(0 0 0 / 30%);
}

/* Standard Rank (4+) */
.mt-rank-standard {
    color: #495057;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
}

.mt-rank-standard .mt-rank-number {
    color: #495057;
}

/* ========================================
   Medal Icon Styles
   ======================================== */

.mt-medal-icon {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.mt-medal-icon .mt-medal-circle {
    filter: drop-shadow(0 2px 4px rgb(0 0 0 / 20%));
}

.mt-medal-icon .mt-medal-ribbon {
    opacity: 0.6;
}

.mt-medal-icon .mt-medal-text {
    font-family: Arial, sans-serif;
    font-weight: 700;
    fill: white;
}

/* Medal specific colors */
.mt-medal-gold .mt-medal-circle {
    fill: #FFD700;
}

.mt-medal-silver .mt-medal-circle {
    fill: #C0C0C0;
}

.mt-medal-bronze .mt-medal-circle {
    fill: #CD7F32;
}

/* ========================================
   Rank Number Styles
   ======================================== */

.mt-rank-number {
    position: relative;
    z-index: 2;
    font-weight: 700;
    line-height: 1;
}

/* When medal is shown, adjust number position */
.mt-ranking-badge .mt-medal-icon + .mt-rank-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ========================================
   Ranking Table Styles
   ======================================== */

.mt-rankings-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.mt-ranking-row {
    background: #fff;
    transition: all 0.3s ease;
}

.mt-ranking-row:hover {
    box-shadow: 0 4px 12px rgb(0 0 0 / 10%);
    transform: translateX(5px);
}

.mt-ranking-row td {
    padding: 12px;
    vertical-align: middle;
}

.mt-rank-cell {
    width: 60px;
    text-align: center;
}

.mt-candidate-cell {
    padding-left: 20px;
}

.mt-candidate-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mt-candidate-name {
    font-size: 16px;
    font-weight: 600;
    color: #212529;
}

.mt-candidate-org {
    font-size: 14px;
    color: #6c757d;
}

.mt-score-cell {
    width: 100px;
    text-align: center;
}

.mt-score-value {
    font-size: 18px;
    font-weight: 600;
    color: #495057;
}

/* Special row highlights */
.position-gold {
    background: linear-gradient(90deg, rgb(255 215 0 / 10%) 0%, rgb(255 255 255 / 0%) 100%);
}

.position-silver {
    background: linear-gradient(90deg, rgb(192 192 192 / 10%) 0%, rgb(255 255 255 / 0%) 100%);
}

.position-bronze {
    background: linear-gradient(90deg, rgb(205 127 50 / 10%) 0%, rgb(255 255 255 / 0%) 100%);
}

/* ========================================
   Winner Card Styles
   ======================================== */

.mt-winner-card {
    position: relative;
    padding: 30px;
    text-align: center;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgb(0 0 0 / 10%);
    transition: all 0.3s ease;
}

.mt-winner-card:hover {
    box-shadow: 0 8px 24px rgb(0 0 0 / 15%);
    transform: translateY(-5px);
}

.mt-winner-gold {
    border-top: 4px solid #FFD700;
}

.mt-winner-silver {
    border-top: 4px solid #C0C0C0;
}

.mt-winner-bronze {
    border-top: 4px solid #CD7F32;
}

.mt-winner-photo {
    width: 120px;
    height: 120px;
    margin: 20px auto;
    overflow: hidden;
    border: 4px solid #f0f0f0;
    border-radius: 50%;
}

.mt-winner-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mt-winner-name {
    margin: 16px 0 8px;
    font-size: 20px;
    font-weight: 700;
    color: #212529;
}

.mt-winner-title {
    margin-bottom: 4px;
    font-size: 14px;
    color: #6c757d;
}

.mt-winner-org {
    font-size: 14px;
    font-weight: 500;
    color: #495057;
}

/* ========================================
   Grid Layout for Winners
   ======================================== */

.mt-winners-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px,1fr));
    gap: 30px;
    margin-top: 40px;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (width <= 768px) {
    .mt-badge-small {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .mt-badge-medium {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .mt-badge-large {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
    
    .mt-winners-grid {
        grid-template-columns: 1fr;
    }
    
    .mt-ranking-row:hover {
        transform: none;
    }
}

/* ========================================
   Animation Effects
   ======================================== */

@keyframes pulse-gold {
    0% { box-shadow: 0 0 0 0 rgb(255 215 0 / 40%); }
    70% { box-shadow: 0 0 0 10px rgb(255 215 0 / 0%); }
    100% { box-shadow: 0 0 0 0 rgb(255 215 0 / 0%); }
}

.mt-rank-gold:hover {
    animation: pulse-gold 1.5s infinite;
}

/* ========================================
   Accessibility
   ======================================== */

.mt-ranking-badge:focus {
    outline: 3px solid #007bff;
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    border: 0;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .mt-ranking-badge {
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
    
    .mt-rank-gold {
        background: #FFD700 !important;
    }
    
    .mt-rank-silver {
        background: #C0C0C0 !important;
    }
    
    .mt-rank-bronze {
        background: #CD7F32 !important;
    }
}
