/* ========================================
   PROFILE MODAL
   ======================================== */

.profile-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    pointer-events: none;
    transition: background 0.3s ease, visibility 0s 0.3s;
}
.profile-modal-overlay.show {
    visibility: visible;
    pointer-events: auto;
    background: rgba(15,15,20,0.85);
    transition: background 0.3s ease, visibility 0s 0s;
}
.profile-modal-overlay.closing {
    background: rgba(0, 0, 0, 0);
    visibility: visible;
    pointer-events: none;
    transition: background 0.25s ease, visibility 0s 0.25s;
}

.profile-modal {
    background: #0B0B0F;
    border-radius: 10px;
    width: 590px;
    max-width: 94vw;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px;
    position: relative;
    transform: scale(0.92);
    opacity: 0;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}
.profile-modal-overlay.show .profile-modal {
    transform: scale(1);
    opacity: 1;
}
.profile-modal-overlay.closing .profile-modal {
    transform: scale(0.92);
    opacity: 0;
}

/* Scrollbar */
.profile-modal::-webkit-scrollbar {
    display: none;
}
.profile-modal {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Header */
.profile-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.profile-modal-title {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}
.profile-modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.profile-modal-close:hover {
    color: #fff;
}

/* User row */
.profile-modal-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.profile-modal-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.profile-modal-username {
    font-size: 16px;
    font-weight: 500;
    color: #fff;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.profile-modal-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}
.profile-modal-id {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}
.profile-modal-id:hover {
    color: rgba(255, 255, 255, 0.7);
}
.pm-copy-icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity 0.2s;
}
.profile-modal-id:hover .pm-copy-icon {
    opacity: 1;
}
.profile-modal-transfer-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #5E6EFF;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.15s;
    font-family: 'Onest', sans-serif;
}
.profile-modal-transfer-btn:hover {
    background: #4d5ee6;
}
.profile-modal-transfer-btn:active {
    transform: scale(0.97);
}
.profile-modal-transfer-btn svg {
    width: 16px;
    height: 15px;
    flex-shrink: 0;
}

/* Stats grid */
.profile-modal-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    margin-bottom: 16px;
    background: #0B0B0F;
    border-radius: 10px;
    overflow: hidden;
}
.profile-modal-stat-box {
    background: #16161D;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-sizing: border-box;
    justify-content: center;
    min-height: 80px;
}
.profile-modal-stat-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.45);
}
.profile-modal-stat-label svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}
.profile-modal-stat-value {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 4px;
}
.profile-modal-stat-value.positive {
    color: #4ADE80;
}
.profile-modal-stat-value.negative {
    color: #F87171;
}

/* Games table */
.profile-modal-games {
    background: #16161D;
    border-radius: 10px;
    overflow: hidden;
}
.profile-modal-games-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.pm-games-col-name {
    flex: 1;
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 0.5px;
}
.pm-games-col-turnover {
    width: 140px;
    text-align: right;
    margin-right: 20px;
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 0.5px;
}
.pm-games-col-profit {
    width: 160px;
    text-align: right;
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 0.5px;
}

.profile-modal-games-list {
    /* Rows injected by JS */
}

.pm-game-row {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.15s;
}
.pm-game-row:last-child {
    border-bottom: none;
}
.pm-game-row:hover {
    background: none;
}
.pm-game-row-name {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
}
.pm-game-row-name svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.pm-game-row-turnover {
    width: 140px;
    text-align: right;
    margin-right: 20px;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
}
.pm-game-row-profit {
    width: 160px;
    text-align: right;
    font-size: 13px;
    font-weight: 500;
}
.pm-game-row-profit.positive {
    color: #4ADE80;
}
.pm-game-row-profit.negative {
    color: #F87171;
}
.pm-game-row-profit.zero {
    color: rgba(255, 255, 255, 0.5);
}

/* Loading state */
.profile-modal-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
}
.pm-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #5E6EFF;
    border-radius: 50%;
    animation: pmSpin 0.7s linear infinite;
    margin-right: 10px;
}
@keyframes pmSpin {
    to { transform: rotate(360deg); }
}

/* Currency icon inline */
.pm-currency-icon {
    display: inline-block;
    vertical-align: middle;
    margin-left: 4px;
    position: relative;
    top: -1px;
}

/* Skeleton shimmer */
@keyframes pmShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.pm-skeleton-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    background: #0B0B0F;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    opacity: 1;
    transition: opacity .25s ease;
    border-radius: 10px;
}
.pm-skeleton-overlay.pm-skel-hide {
    opacity: 0;
    pointer-events: none;
}
.pm-skel-block {
    background: linear-gradient(110deg, rgba(255,255,255,0.04) 8%, rgba(255,255,255,0.09) 18%, rgba(255,255,255,0.04) 33%);
    background-size: 200% 100%;
    animation: pmShimmer 1.4s infinite linear;
    border-radius: 10px;
}
.pm-skel-header { display: flex; justify-content: space-between; align-items: center; }
.pm-skel-title { width: 60px; height: 16px; border-radius: 6px; }
.pm-skel-close { width: 14px; height: 14px; border-radius: 4px; }
.pm-skel-user-row { display: flex; align-items: center; gap: 12px; }
.pm-skel-avatar { width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0; }
.pm-skel-user-info { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.pm-skel-username { width: 120px; height: 16px; border-radius: 6px; }
.pm-skel-uid { width: 70px; height: 12px; border-radius: 6px; }
.pm-skel-btn { width: 110px; height: 38px; border-radius: 10px; flex-shrink: 0; }
.pm-skel-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; border-radius: 10px; overflow: hidden; }
.pm-skel-stat { height: 80px; border-radius: 0; }
.pm-skel-games { border-radius: 10px; width: 100%; height: 220px; }

/* Clickable game rows */
.pm-game-row.pm-game-clickable {
    cursor: pointer;
    position: relative;
}
.pm-game-row.pm-game-clickable:hover {
    background: rgba(255,255,255,0.03);
}
.pm-game-row.pm-game-clickable .pm-game-row-name::after {
    content: '';
    display: inline-block;
    width: 6px; height: 6px;
    border-right: 1.5px solid rgba(255,255,255,0.3);
    border-bottom: 1.5px solid rgba(255,255,255,0.3);
    transform: rotate(-45deg);
    margin-left: 6px;
    transition: transform .2s;
    flex-shrink: 0;
}
.pm-game-row.pm-game-clickable.pm-game-expanded .pm-game-row-name::after {
    transform: rotate(45deg);
}

/* Individual bet list inside game row */
.pm-bets-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
    background: rgba(0,0,0,0.15);
}
.pm-bets-container.pm-bets-open {
    max-height: 600px;
    overflow-y: auto;
}
.pm-bets-container::-webkit-scrollbar { display: none; }
.pm-bets-container { -ms-overflow-style: none; scrollbar-width: none; }
.pm-bet-item {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    cursor: pointer;
    transition: background .15s;
}
.pm-bet-item:last-child { border-bottom: none; }
.pm-bet-item:hover { background: rgba(255,255,255,0.04); }
.pm-bet-date {
    font-size: 11px;
    color: rgba(255,255,255,0.35);
    width: 100px;
    flex-shrink: 0;
}
.pm-bet-amount {
    flex: 1;
    font-size: 12px;
    color: #fff;
    font-weight: 500;
}
.pm-bet-result {
    font-size: 12px;
    font-weight: 600;
}
.pm-bet-result.win { color: #4ADE80; }
.pm-bet-result.lose { color: #F87171; }
.pm-bet-view-icon {
    width: 16px; height: 16px;
    color: rgba(255,255,255,0.3);
    flex-shrink: 0;
    transition: color .15s;
}
.pm-bet-item:hover .pm-bet-view-icon { color: rgba(255,255,255,0.7); }
.pm-bets-loading {
    padding: 16px;
    text-align: center;
    font-size: 12px;
    color: rgba(255,255,255,0.4);
}

/* Responsive */
@media (max-width: 520px) {
    .profile-modal {
        padding: 18px 14px;
        border-radius: 10px;
    }
    .profile-modal-stat-box {
        min-height: 70px;
    }
    .profile-modal-avatar {
        width: 48px;
        height: 48px;
    }
    .profile-modal-transfer-btn {
        padding: 8px 12px;
        font-size: 10px;
    }
    .pm-games-col-turnover,
    .pm-game-row-turnover {
        width: 100px;
    }
    .pm-games-col-profit,
    .pm-game-row-profit {
        width: 90px;
    }
}
