/**
 * Frontend Styles for Donation Leaderboard
 * Mobile-first responsive design
 */

/* Main Wrapper */
.dl-leaderboard-wrapper {
    width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Default table layout */
.dl-leaderboard {
    display: table;
    width: 100%;
    table-layout: auto;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@media screen and (max-width: 421px) {
    .dl-leaderboard .dl-name {
        min-width: 80px !important;
        
    }
}

/* Column sizing */
.dl-leaderboard .dl-name {
    min-width: 140px;
    flex: 2 1 90px;
    white-space: normal;
    word-break: break-word;
    font-weight: 600;
    font-size: 16px;
    color: #1f2937;
    
    text-align: center;
    padding: 12px 10px;
}

.dl-leaderboard .dl-name > div:first-child {
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-word;
}

.dl-leaderboard .dl-country {
    min-width: 60px;
    flex: 1 1 60px;
    white-space: normal;
    word-break: break-word;
    padding: 12px 10px;
}

.dl-leaderboard .dl-badges {
    flex: 1 1 40px;
    min-width: 40px;
    max-width: 120px;
    overflow: hidden;
    display: table-cell;
}

.dl-leaderboard .dl-amount {
    min-width: 70px;
    flex: 1 1 70px;
    white-space: nowrap;
    word-break: break-word;
    font-weight: 700;
    font-size: 18px;
    color: #e87234;
    text-align: center;
    padding: 12px 14px 12px 10px;
}

/* Mobile: Use flex for rows */
@media screen and (max-width: 599px) {
    .dl-leaderboard tbody tr {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        border-bottom: 1px solid #e5e7eb;
    }
    .dl-leaderboard tbody td {
        display: block;
        box-sizing: border-box;
        padding: 12px 8px;
    }
    .dl-leaderboard .dl-amount {
        order: 1;
        margin-bottom: 0;
    }
    .dl-leaderboard .dl-badges {
        order: 2;
        display: block;
        padding-top: 0;
        margin-top: 0;
    }
    .dl-leaderboard .dl-badges.dl-mobile-hide {
        display: none !important;
    }
    .dl-leaderboard .dl-amount .dl-mobile-badges {
        display: block;
    }
    .dl-leaderboard .dl-amount .dl-mobile-badges:empty {
        margin-top: 0;
    }
}

@media screen and (min-width: 600px) {
    .dl-leaderboard .dl-amount .dl-mobile-badges {
        display: none !important;
    }
}

.dl-leaderboard thead {
    display: none;
}

/* Leaderboard Row */
.dl-leaderboard tbody {
    display: table-row-group;
}

.dl-leaderboard tbody tr {
    display: table-row;
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.2s ease;
}

.dl-leaderboard tbody tr:nth-child(even) {
    background-color: #f9fafb;
}

.dl-leaderboard tbody tr:hover {
    background-color: #f3f4f6;
}

.dl-leaderboard tbody tr:last-child {
    border-bottom: none;
}

/* Table cells */
.dl-leaderboard tbody td {
    display: table-cell;
    padding: 12px 8px;
    vertical-align: middle;
}

/* Rank Badge */
.dl-leaderboard .dl-rank {
    width: 1%;
    padding: 12px 6px;
    text-align: center;
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    background: #5e9732;
}

/* Photo */
.dl-leaderboard .dl-photo {
    width: 1%;
    text-align: center;
    padding: 12px 8px;
}

.dl-participant-photo {
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #005581;
    display: block;
    margin: 0 auto;
}

.dl-participant-initials {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #005581;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 1px;
    margin: 0 auto;
}

/* Mobile: Show country under name */
.dl-mobile-country {
    font-size: 14px;
    font-weight: normal;
}

/* Mobile: Hide desktop country column */
.dl-leaderboard .dl-country.dl-desktop-country {
    display: none;
}

.dl-country-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.dl-country-name {
    color: #6b7280;
}

/* Badges */
.dl-badges-wrapper {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 8px;
}

.dl-badge {
    display: inline-block;
}

.dl-badge-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.dl-badge-text {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f59e0b;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
}

/* No Results Message */
.dl-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
    font-size: 16px;
    font-style: italic;
}

/* Tablet */
@media screen and (min-width: 600px) {
    .dl-leaderboard tbody td {
        padding: 14px 10px;
    }

    .dl-leaderboard .dl-rank {
        width: 1%;
        font-size: 18px;
        padding: 14px 8px;
    }

    .dl-leaderboard .dl-photo {
        width: auto;
        padding: 14px 8px;
    }

    .dl-participant-photo,
    .dl-participant-initials {
        width: 64px;
        height: 64px;
        min-width: 64px;
        min-height: 64px;
        font-size: 20px;
        margin: 0 auto;
    }

    .dl-leaderboard .dl-name {
        font-size: 18px;
        padding: 14px 12px;
        width: 1%;
        white-space: nowrap;
        text-align: center;
    }

    .dl-leaderboard .dl-amount {
        font-size: 20px;
        padding: 14px 16px 14px 12px;
        text-align: center;
    }

    .dl-leaderboard .dl-badges {
        display: table-cell;
        padding: 14px 12px;
        text-align: center;
    }

    .dl-badges-wrapper {
        margin-top: 0;
    }

    .dl-badge-icon {
        width: 34px;
        height: 34px;
    }
}

/* Desktop */
@media screen and (min-width: 1024px) {
    .dl-leaderboard {
        border-collapse: collapse;
        border-radius: 12px;
    }

    .dl-leaderboard thead {
        display: table-header-group;
        background: #5e9732;
        color: #fff;
    }

    .dl-leaderboard thead th {
        padding: 16px 14px;
        text-align: center;
        font-weight: 600 !important;
        font-size: 14px !important;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: #fff !important;
        background: #5e9732;
        border: none;
    }

    .dl-leaderboard thead th.dl-rank {
        padding: 16px 8px;
        text-align: center;
        width: 1%;
    }

    .dl-leaderboard thead th.dl-photo {
        padding: 14px 8px;
        text-align: center;
        width: 1%;
    }

    .dl-leaderboard .dl-rank {
        width: 1%;
        background: transparent;
        color: #005581;
        font-size: 16px;
        text-align: center;
        padding: 14px 8px;
    }

    .dl-leaderboard .dl-photo {
        width: 1%;
        text-align: center;
        padding: 14px 8px;
    }

    .dl-participant-photo,
    .dl-participant-initials {
        width: 60px;
        height: 60px;
        min-width: 60px;
        min-height: 60px;
        font-size: 18px;
        margin: 0 auto;
    }

    .dl-leaderboard .dl-name {
        font-size: 16px;
        padding: 14px;
        width: 1%;
        white-space: nowrap;
        text-align: center;
    }

    .dl-leaderboard .dl-name > div:first-child {
        margin-bottom: 0;
        white-space: normal;
    }

    /* Desktop: Hide mobile country, show desktop column */
    .dl-mobile-country {
        display: none;
    }

    .dl-leaderboard .dl-country.dl-desktop-country {
        display: table-cell;
        width: 1%;
        text-align: center;
    }

    .dl-leaderboard .dl-amount {
        font-size: 18px;
        width: 1%;
        text-align: center;
        padding: 14px;
    }

    .dl-leaderboard .dl-badges {
        width: 1%;
        padding: 14px;
        text-align: center;
        min-width: 150px;
        max-width: 180px;
    }

    .dl-badge-icon,
    .dl-badge-text {
        width: 34px;
        height: 34px;
        font-size: 14px;
    }
}