/* Leetify CS2 Stats Styling */

.leetify-matches-container {
    max-width: 800px;
    margin: 20px 0;
}

.leetify-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--wp--preset--color--tertiary);
}

.leetify-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.leetify-refresh {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    background: var(--wp--preset--color--primary);
    color: black;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
}

.leetify-refresh:hover {
    background: #ff7256;
}

.leetify-refresh.loading {
    opacity: 0.6;
    cursor: not-allowed;
}

.leetify-refresh .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.leetify-error {
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 5px;
    color: #856404;
    margin: 10px 0;
}

.leetify-no-data {
    padding: 30px;
    text-align: center;
    background: #f8f9fa;
    border-radius: 8px;
    color: #6c757d;
    font-size: 16px;
}

.leetify-matches-list {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.leetify-match {
    border: 2px solid var(--wp--preset--color--tertiary);
    border-radius: 0px 8px 8px 0px;
    padding: 32px;
    transition: all 0.3s ease;
}

.leetify-match.match-win {
    border-left: 5px solid #28a745;
}

.leetify-match.match-loss {
    border-left: 5px solid #dc3545;
}

.leetify-match.match-draw {
    border-left: 5px solid #6c757d;
}

.leetify-match-header {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 15px;
    align-items: center;
    margin-bottom: 12px;
}

.leetify-match-result {
    font-weight: 700;
    font-size: 16px;
    text-transform: uppercase;
    padding: 0px 4px;
    border-radius: 5px;
    text-align: center;
}

.match-win .leetify-match-result {
    background: #d4edda;
    color: #155724;
}

.match-loss .leetify-match-result {
    background: #f8d7da;
    color: #721c24;
}

.match-draw .leetify-match-result {
    background: #e2e3e5;
    color: #383d41;
}

.leetify-match-map {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.leetify-party-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--wp--preset--color--primary);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 12px;
    cursor: help;
}

.leetify-party-badge .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

.leetify-match-date {
    color: var(--wp--preset--color--secondary);
    font-size: 13px;
    white-space: nowrap;
}

/* Player Tabs */
.leetify-player-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--wp--preset--color--tertiary);
    padding-bottom: 0;
    flex-wrap: wrap;
}

.leetify-tab {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 10px 16px;
    cursor: pointer !important;
    font-size: 14px;
    font-weight: 600;
    color: var(--wp--preset--color--secondary);
    transition: all 0.2s ease;
    position: relative;
    bottom: -2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.leetify-tab:hover {
    color: var(--wp--preset--color--primary);
    background: rgba(0, 0, 0, 0.02);
}

.leetify-tab.active {
    color: var(--wp--preset--color--primary);
    border-bottom-color: var(--wp--preset--color--primary);
}

/* Player Avatar */
.leetify-player-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    pointer-events: none;
}

.leetify-tab.active .leetify-player-avatar {
    border-color: var(--wp--preset--color--primary);
    box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.1);
}

.leetify-player-name {
    white-space: nowrap;
    pointer-events: none;
}

/* MVP Badge */
.leetify-mvp-badge {
    font-size: 14px;
    line-height: 1;
    pointer-events: none;
}

.leetify-tab-content {
    display: none;
}

.leetify-tab-content.active {
    display: block;
}

/* Match Details */
.leetify-match-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    padding-top: 12px;
}

.leetify-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 4px 12px 4px 12px;
    border-radius: 8px;
    background: var(--wp--preset--color--quaternary);
    transition: all 0.3s ease;
}

/* Color-coded stats */
.leetify-stat.stat-green {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.15) 0%, rgba(40, 167, 69, 0.25) 100%);
}

.leetify-stat.stat-green .value {
    font-weight: 800;
}

.leetify-stat.stat-amber {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15) 0%, rgba(255, 193, 7, 0.25) 100%);
}

.leetify-stat.stat-amber .value {
    font-weight: 800;
}

.leetify-stat.stat-red {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.15) 0%, rgba(220, 53, 69, 0.25) 100%);
}

.leetify-stat.stat-red .value {
    font-weight: 800;
}

.leetify-stat .label {
    font-size: 11px;
    color: var(--wp--preset--color--secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.leetify-stat .value {
    font-size: 18px;
    font-weight: 700;
}

.leetify-load-more {
    border: none;
    color: var(--wp--preset--color--foreground);
    border-bottom: 2px solid var(--wp--preset--color--primary);
    font-size: 13px;
    padding: 6px 12px;
    cursor: pointer;
}

.leetify-load-more:hover {
    background-color: var(--wp--preset--color--quaternary);
}

/* Responsive Design */
@media (max-width: 600px) {
    .leetify-match-header {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .leetify-match-date {
        order: -1;
    }

    .leetify-match-details {
        grid-template-columns: repeat(2, 1fr);
    }

    .leetify-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .leetify-player-tabs {
        flex-wrap: wrap;
    }

    .leetify-tab {
        padding: 8px 12px;
        font-size: 13px;
    }

    @media (max-width: 400px) {
        .leetify-player-name {
            display: none;
        }

        .leetify-tab {
            padding: 8px;
        }

        .leetify-player-avatar {
            width: 32px;
            height: 32px;
        }
    }
}

/* Loading animation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.leetify-refresh.loading .dashicons {
    animation: spin 1s linear infinite;
}

.leetify-view-link {
    font-weight: bold;
    color: #F84982;
    text-decoration: underline;
}

.leetify-view-link:hover {
    opacity: 0.85;
}

.leetify-separator {
    margin: 0 6px;
    opacity: 0.6;
}

/* Loading State */
.leetify-loading {
    min-height: 200px;
    position: relative;
}

.leetify-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.leetify-spinner {
    border: 6px solid var(--wp--preset--color--secondary);
    border-top: 6px solid var(--wp--preset--color--primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: leetify-spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes leetify-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.leetify-loader p {
    color: var(--wp--preset--color--secondary);
    font-size: 14px;
    margin: 0;
}

/* Error State */
.leetify-error {
    background-color: #fee;
    border-left: 4px solid #c33;
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
    color: #c33;
}

/* Map Link Styling */
.leetify-map-link {
    transition: color 0.2s ease;
}

.leetify-map-link:hover {
    color: var(--wp--preset--color--primary);
}

/* =============================================================================
   LEADERBOARD
   ============================================================================= */

.leetify-leaderboard-container {
    max-width: 800px !important;
    margin: 20px 0;
}

.leetify-leaderboard-subtitle {
    font-size: 14px;
    color: var(--wp--preset--color--secondary);
    font-weight: normal;
}

.leetify-leaderboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
    margin-bottom: 64px;
}

.leetify-leaderboard-card {
    border-radius: 12px;
    padding: 20px;
    border: 2px solid var(--wp--preset--color--tertiary);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.leetify-leaderboard-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
}

.leetify-leaderboard-stat-title {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--wp--preset--color--secondary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.5;
}

.leetify-leaderboard-player {
    display: flex;
    align-items: center;
    gap: 15px;
}

.leetify-leaderboard-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid var(--wp--preset--color--primary);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.leetify-leaderboard-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.leetify-leaderboard-name {
    font-size: 24px;
    font-weight: 800;
    color: #e0a800;
}

.leetify-leaderboard-value {
    font-size: 16px;
    font-weight: 600;
}

@media (max-width: 768px) {
    .leetify-leaderboard-grid {
        grid-template-columns: 1fr;
    }

    .leetify-leaderboard-card {
        padding: 15px;
    }

    .leetify-leaderboard-avatar {
        width: 50px;
        height: 50px;
    }

    .leetify-leaderboard-name {
        font-size: 16px;
    }

    .leetify-leaderboard-value {
        font-size: 20px;
    }
}

/* =============================================================================
   PLAYER COMPARISON  [leetify_compare]
   ============================================================================= */

.leetify-compare-wrapper {
    margin-top: 20px;
    margin-bottom: 64px;
    border: 2px solid var(--wp--preset--color--tertiary);
    border-radius: 12px;
    overflow: hidden;
}

.leetify-compare-header {
    display: grid;
    grid-template-columns: 1fr 160px 1fr;
    gap: 0;
    background: var(--wp--preset--color--quaternary);
    padding: 16px 20px;
    border-bottom: 2px solid var(--wp--preset--color--tertiary);
}

.leetify-compare-player-name {
    font-size: 18px;
    font-weight: 800;
}

.leetify-compare-name-a {
    text-align: left;
}

.leetify-compare-name-b {
    text-align: right;
}

.leetify-compare-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--wp--preset--color--secondary);
    text-align: center;
    align-self: center;
}

/* Each stat row */
.leetify-compare-row {
    display: grid;
    grid-template-columns: 1fr 160px 1fr;
    align-items: center;
    gap: 0;
    padding: 14px 20px;
    border-bottom: 1px solid var(--wp--preset--color--tertiary);
    transition: background 0.2s ease;
}

.leetify-compare-row:last-child {
    border-bottom: none;
}

/* Stat values */
.leetify-compare-val {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.leetify-compare-val-a {
    justify-content: flex-start;
}

.leetify-compare-val-b {
    justify-content: flex-end;
}

.leetify-compare-val.winner {
    font-size: 22px;
    color: var(--wp--preset--color--primary);
}

.leetify-compare-winner-badge {
    font-size: 12px;
    color: var(--wp--preset--color--primary);
    opacity: 0.8;
}

/* Middle bar section */
.leetify-compare-bar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 0 8px;
}

.leetify-compare-label {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--wp--preset--color--secondary);
    text-align: center;
    white-space: nowrap;
}

/* Dual progress bar */
//.leetify-compare-bar-a,
//.leetify-compare-bar-b {
    height: 4px;
    border-radius: 2px;
    width: 50%;
    /* overridden by inline style */
    transition: width 0.6s ease;
//}

.leetify-compare-bar-a {
    background: #ff6b6b;
    align-self: flex-start;
    margin-left: 75px;
}

.leetify-compare-bar-b {
    background: #4ecdc4;
    align-self: flex-end;
    margin-right: 75px;
}

/* Row winner highlight */
.leetify-compare-row.a-wins .leetify-compare-bar-a {
    background: #ff6b6b;
    opacity: 1;
}

.leetify-compare-row.b-wins .leetify-compare-bar-b {
    background: #4ecdc4;
    opacity: 1;
}

.leetify-compare-row.tie .leetify-compare-bar-a,
.leetify-compare-row.tie .leetify-compare-bar-b {
    opacity: 0.4;
}

.leetify-compare-bar-a winner,
.leetify-compare-bar-b winner {
    background: var(--wp--preset--color--primary);
}

@media (max-width: 600px) {

    .leetify-compare-header,
    .leetify-compare-row {
        grid-template-columns: 1fr 100px 1fr;
        padding: 12px 14px;
    }

    .leetify-compare-player-name {
        font-size: 14px;
    }

    .leetify-compare-val {
        font-size: 16px;
    }

    .leetify-compare-val.winner {
        font-size: 18px;
    }

    .leetify-compare-label {
        font-size: 10px;
    }
}

/* =============================================================================
   HISTORICAL TREND CHART  [leetify_trends]
   ============================================================================= */

.leetify-trend-wrapper {
    margin-top: 20px;
    margin-bottom: 64px;
    border: 2px solid var(--wp--preset--color--tertiary);
    border-radius: 12px;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.leetify-trend-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--wp--preset--color--tertiary);
}

.leetify-trend-legend-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--wp--preset--color--secondary);
}

.leetify-trend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.leetify-trend-canvas {
    display: block;
    width: 100%;
    max-width: 100%;
    border-radius: 6px;
}

@media (max-width: 600px) {
    .leetify-trend-wrapper {
        padding: 14px;
    }

    .leetify-trend-legend {
        gap: 10px;
    }
}

/* =============================================================================
   PLAYER FILTER CONTROLS  (trends toggles + compare picker)
   ============================================================================= */

.leetify-player-filter {
    padding: 10px 16px 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.leetify-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.leetify-filter-label-text {
    font-size: 12px;
    color: var(--wp--preset--color--secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Trend toggle buttons */
.leetify-trend-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1.5px solid var(--wp--preset--color--tertiary);
    background: transparent;
    color: var(--wp--preset--color--secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.leetify-trend-toggle.active {
    border-color: var(--lf-color, var(--wp--preset--color--primary));
    color: var(--wp--preset--color--contrast);
    background: var(--wp--preset--color--quaternary);
}

.leetify-trend-toggle:hover {
    background: var(--wp--preset--color--quaternary);
}

.lf-toggle-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

/* Compare filter dropdowns */
.leetify-filter-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--wp--preset--color--secondary);
}

.leetify-filter-select {
    background: var(--wp--preset--color--quaternary);
    color: var(--wp--preset--color--contrast);
    border: 1.5px solid var(--wp--preset--color--tertiary);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease;
}

.leetify-filter-select:focus,
.leetify-filter-select:hover {
    border-color: var(--wp--preset--color--primary);
}

.leetify-filter-vs {
    font-size: 13px;
    color: var(--wp--preset--color--secondary);
    font-style: italic;
}

.leetify-filter-apply {
    padding: 6px 18px;
    border-radius: 8px;
    border: none;
    background: var(--wp--preset--color--primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.leetify-filter-apply:hover {
    opacity: 0.85;
}