/* Enhanced Profile Styles */

/* Profile Container */
#profile-container {
    display: flex;
    flex-direction: column;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    gap: 20px;
}

/* Profile Loading */
.profile-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
    color: #fff;
}

.profile-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: #4a90e2;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Profile Header with Banner */
#profile-header {
    position: relative;
    display: flex;
    align-items: flex-end;
    padding-bottom: 20px;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    min-height: 150px;
}

.profile-banner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.profile-banner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.7) 70%);
    z-index: 1;
}

#profile-avatar-container {
    position: relative;
    z-index: 2;
    margin-right: 15px;
}

#profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    object-fit: cover;
}

#profile-info {
    position: relative;
    z-index: 2;
    color: #fff;
}

#profile-name {
    margin: 0 0 5px 0;
    font-size: 24px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.profile-title {
    font-size: 14px;
    color: #ccc;
    margin-bottom: 5px;
    font-style: italic;
}

#profile-status {
    display: flex;
    align-items: center;
    gap: 5px;
}

#profile-status-icon {
    font-size: 14px;
}

#profile-status-text {
    font-size: 14px;
    color: #ccc;
}

/* Profile Stats */
#profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 15px;
}

.profile-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.profile-stat-label {
    font-size: 12px;
    color: #aaa;
    margin-bottom: 5px;
}

.profile-stat-value {
    font-size: 18px;
    font-weight: bold;
    color: #fff;
}

/* Profile Sections */
.profile-section {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
}

.profile-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #4a90e2;
    font-size: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
}

/* Match History */
#profile-match-history {
    max-height: 400px;
    overflow-y: auto;
}

.match-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.match-history-item {
    display: flex;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.match-history-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.match-history-item.match-win {
    border-left: 4px solid #4caf50;
}

.match-history-item.match-loss {
    border-left: 4px solid #f44336;
}

.match-history-item.match-draw {
    border-left: 4px solid #ff9800;
}

.match-result {
    width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.match-history-item.match-win .match-result {
    color: #4caf50;
}

.match-history-item.match-loss .match-result {
    color: #f44336;
}

.match-history-item.match-draw .match-result {
    color: #ff9800;
}

.match-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.match-players {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.match-player {
    display: flex;
    flex-direction: column;
    color: #fff;
}

.match-player.match-winner {
    font-weight: bold;
}

.player-name {
    font-size: 14px;
}

.player-deck {
    font-size: 12px;
    color: #aaa;
}

.match-vs {
    color: #aaa;
    font-size: 12px;
    margin: 0 10px;
}

.match-time {
    font-size: 12px;
    color: #aaa;
    text-align: right;
}

.match-history-empty {
    text-align: center;
    color: #aaa;
    font-style: italic;
    padding: 20px 0;
}

.load-more-button {
    width: 100%;
    margin-top: 10px;
}

/* Match Details Modal */
.match-details-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.match-result {
    font-size: 18px;
    font-weight: bold;
}

.match-result.draw {
    color: #ff9800;
}

.match-players-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.match-player-detail {
    flex: 1;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.match-player-detail.winner {
    background-color: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.match-vs-detail {
    margin: 0 15px;
    font-size: 20px;
    color: #aaa;
}

.match-actions {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

/* Profile Customization */
#profile-customization {
    max-height: 500px;
    overflow-y: auto;
}

.customization-section {
    margin-bottom: 20px;
}

.customization-section h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #fff;
    font-size: 16px;
}

.customization-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.customization-item {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.customization-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.customization-item.selected {
    background-color: rgba(74, 144, 226, 0.2);
    border: 1px solid #4a90e2;
}

.customization-preview {
    margin-bottom: 10px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.banner-preview {
    width: 100%;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

.avatar-preview {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.title-preview {
    font-style: italic;
    color: #fff;
    padding: 5px;
}

.status-icon-preview {
    font-size: 24px;
}

.customization-name {
    font-size: 12px;
    color: #ccc;
}

.save-customization-button {
    width: 100%;
    margin-top: 20px;
}

/* Achievements */
.profile-achievements-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.profile-achievement {
    width: 60px;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}

.profile-achievement.locked {
    opacity: 0.5;
    filter: grayscale(1);
}

.profile-achievement-icon {
    font-size: 24px;
}

.profile-achievement-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 10;
}

.profile-achievement:hover .profile-achievement-tooltip {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 5px);
}

/* Recent Activity */
.profile-activity-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.activity-icon {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.activity-details {
    flex: 1;
}

.activity-title {
    font-size: 14px;
    color: #fff;
    margin-bottom: 3px;
}

.activity-time {
    font-size: 12px;
    color: #aaa;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    #profile-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .match-players {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .match-vs {
        display: none;
    }

    .match-players-details {
        flex-direction: column;
        gap: 10px;
    }

    .match-vs-detail {
        margin: 10px 0;
    }

    .customization-items {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
}