/* Player Profile Styles */

/* Game Mode Tabs */
.game-mode-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    gap: 10px;
}

/* Inline loading for profile components */
.inline-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #6b7280;
    font-weight: 600;
    font-size: 14px;
    padding: 6px 12px;
}

.inline-loading i { 
    color: #f59e0b; 
}

.tab-button {
    background: white;
    border: 2px solid #ddd;
    color: #666;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
    justify-content: center;
}

.tab-button.active {
    background: linear-gradient(135deg, #FFD700, #FF8C00);
    color: white;
    border: 2px solid transparent;
    background-clip: padding-box;
    -webkit-background-clip: padding-box;
    outline: none;
    position: relative;
    z-index: 1;
    box-shadow: 0 6px 12px rgba(255, 140, 0, 0.35);
}

.tab-button:hover:not(.active) {
    border-color: #f59e0b;
    background: #fff8e1;
}

.tab-button i {
    font-size: 14px;
}

/* Fonts for Premier League */
@font-face {
    font-family: 'PremierLeague';
    src: url('/fonts/PremierLeagueW01-Bold.woff2') format('woff2'),
         url('/fonts/PremierLeagueW01-Bold.woff') format('woff');
    font-weight: bold;
    font-style: normal;
}

@font-face {
    font-family: 'PremierLeague';
    src: url('/fonts/PremierLeagueW01-Regular.woff2') format('woff2'),
         url('/fonts/PremierLeagueW01-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

/* Keyframes for animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hero Section */
.profile-hero {
    background: linear-gradient(135deg, #00c6ff 0%, #7767ff 100%);
    color: white;
    padding: 100px 40px 40px;
    margin-top: -20px;
    position: relative;
    overflow: hidden;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    /* Hide elements initially if needed, handled by animation */
}

/* Pattern Background */
.profile-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('/images/pattern.svg');
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    opacity: 1.0;
    z-index: 1;
    width: 100%;
}

/* Color Overlay */
.profile-hero::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* Only apply background and blend mode if --avatar-color is set */
    background-color: var(--avatar-color, transparent) !important; /* Default to transparent if variable not set */
    mix-blend-mode: var(--avatar-blend-mode, normal); /* Default to normal blend mode */
    z-index: 2;
    width: 100%;
}

/* Apply blend mode only when the color variable is actually set by Handlebars */
.profile-hero[style*="--avatar-color:"]::after {
     /* --- EXPERIMENT WITH BLEND MODES --- */
    /* Change which line is uncommented to test different effects */
    mix-blend-mode: color;        /* Strongest colorization - takes hue & saturation */
    /* mix-blend-mode: hue; */        /* Only changes the hue */
    /* mix-blend-mode: saturation; */ /* Only changes the saturation */
    /* mix-blend-mode: soft-light; */ /* Softer tinting effect */
    /* mix-blend-mode: multiply; */   /* Darkens based on color */
    /* mix-blend-mode: screen; */     /* Lightens based on color */
    /* mix-blend-mode: overlay; */    /* Mix of multiply/screen */

    /* Set the blend mode variable to match the active mode */
    --avatar-blend-mode: color; 
}

.profile-hero-container {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 3;
}

.player-image-container {
    width: 200px;
    height: 200px;
    margin-right: 40px;
    flex-shrink: 0;
    position: relative;
    animation-delay: 0.1s;
}

.player-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.player-info-container {
    flex-grow: 1;
}

.player-identity h1 {
    font-size: 3.5rem;
    margin: 0 0 10px;
    font-weight: bold;
    font-family: 'PremierLeague', Arial, sans-serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    animation-delay: 0.2s;
}

.player-id {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 10px;
    animation-delay: 0.3s;
}

.player-tags {
    display: flex;
    margin-bottom: 20px;
}

.position-tag,
.country-tag {
    padding: 8px 20px;
    margin-right: 10px;
    border-radius: 30px;
    background-color: rgba(255, 255, 255, 0.2);
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation-delay: 0.4s;
}

.position-tag i {
    margin-right: 8px;
    font-size: 1.8rem;
}

.position-tag::before {
    content: '';
    display: none;
}

.country-tag img {
    width: 36px;
    height: 27px;
    margin-right: 12px;
}

.player-metrics {
    display: flex;
    margin-bottom: 20px;
}

.metric {
    text-align: center;
    margin-right: 30px;
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 5px;
    font-family: 'PremierLeague', Arial, sans-serif;
}

.metric-label {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
}

.player-form {
    display: flex;
    align-items: center;
}

.form-label {
    font-size: 1.4rem;
    margin-right: 15px;
    animation-delay: 1.0s;
}

.form-indicators {
    display: flex;
}

.form-indicator {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-weight: bold;
    font-size: 1.2rem;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    animation-delay: 1.1s;
}

.form-indicator.win {
    background-color: #00E676;
}

.form-indicator.loss {
    background-color: #E91E63;
}

.form-indicator.draw {
    background-color: #BDBDBD;
}

.no-form {
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
}

/* Main content area */
.profile-content {
    padding: 30px 20px;
    background-color: #f0f0f0;
}

/* Stats container layout */
.stats-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    max-width: 1200px;
    margin: 0 auto;
}

.full-width {
    grid-column: 1 / -1;
}

/* Stats card styling */
.stats-card {
    background-color: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 25px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: static; /* Attempt to prevent card from creating positioning context */
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.stats-card h2 {
    font-size: 1.8rem;
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #00c6ff;
    padding-bottom: 10px;
    color: #333;
    font-family: 'PremierLeague', Arial, sans-serif;
}

/* Stats overview */
.stats-overview {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-bottom: 30px;
}

/* Position section header inside the stats card */
.position-section-header {
    font-size: 1.5rem;
    margin: 20px 0 15px;
    padding-top: 15px;
    color: #333;
    font-family: 'PremierLeague', Arial, sans-serif;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.stat-item {
    text-align: center;
    flex: 1 1 18%;
    padding: 20px 15px;
    margin: 8px;
    background-color: #f8f8f8;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease;
}

.stat-item:hover {
    transform: translateY(-3px);
    background-color: #f0f0f0;
}

.stat-item i {
    font-size: 2rem;
    margin-bottom: 15px;
    color: #E91E63;

}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 5px;
    font-family: 'PremierLeague', Arial, sans-serif;
    color: #333;
}

.stat-label {
    display: block;
    font-size: 1.1rem;
    color: #777;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Performance Rates */
.stat-rate {
    display: block;
    font-size: 0.8rem;
    color: #aaa;
    margin-top: 2px;
}

/* Position-specific Stats */
.position-stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-top: 10px;
}

.position-stats-table th {
    padding: 12px 8px;
    text-align: center;
    border-bottom: 2px solid #00c6ff;
    color: #333;
    font-weight: bold;
    background-color: #f8f9fa;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.position-stats-table th i {
    margin-right: 6px;
    opacity: 0.7;
}

.position-stats-table td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.position-stats-table tr.main-position {
    background-color: rgba(4, 217, 255, 0.1);
    font-weight: bold;
}

.position-stats-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.position-stats-table tr:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.no-data {
    color: #aaa;
    text-align: center;
    padding: 20px;
}

/* Chart Controls */
.chart-controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: #333;
    align-items: center;
}

.chart-controls select {
    background-color: #f5f5f5;
    color: #333;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 5px 10px;
    border-radius: 4px;
    margin-left: 8px;
}

/* Chart containers */
.chart-container {
    height: 300px;
    min-height: 250px;
    position: relative;
    width: 100%;
    overflow: visible;
    background-color: rgba(245, 245, 245, 0.5);
    border-radius: 8px;
    margin-top: 15px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Ensure canvas takes full height of container */
.chart-container canvas {
    height: 100% !important;
    width: 100% !important;
}

/* Add a fallback message for empty charts */
.chart-container:empty::before {
    content: 'No data available';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #999;
    font-style: italic;
}

/* Table styling */
.recent-matches-wrapper {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.05);
    /* margin-top: -40px; */ /* Temporarily removed for sticky test */
    overflow: visible;
    position: relative;
}

.recent-matches-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    margin: 0px 0;
}

.recent-matches-table th, .recent-matches-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 2px solid #ddd;
}

.recent-matches-table tr:nth-child(even) {
    background-color: #f2f2f2;
}

.recent-matches-table th {
    background-color: #000;
    color: white;
    padding: 10px;
    text-align: center;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'PremierLeague', Arial, sans-serif;
    font-weight: bold;
    border-bottom: 2px solid #a4a4a4;
    transition: none;
}

/* Prevent hover effects on header cells */
.recent-matches-table th:hover {
    background-color: #000 !important;
    color: white !important;
}


/* Apply sticky styles specifically to thead th */
.recent-matches-table thead th {
    position: sticky;
    background-color: #000;
    color: #fff;
    z-index: 10;
    box-shadow: 0 2px 2px -1px rgba(0,0,0,0.4);
    text-align: center;
}

.recent-matches-table td { /* Reverted styles */
    padding: 12px;
    border-bottom: 2px solid #ddd;
    font-size: 0.95rem; /* Reverted font size */
    color: #444; /* Reverted color */
    transition: color 0.3s ease; /* Reverted transition */
    font-family: 'PremierLeague', Arial, sans-serif;
    font-weight: bold !important; /* Reverted font-weight */
    text-align: center;
}

/* Explicit styles for each column */
.recent-matches-table tr td:nth-child(1),
.recent-matches-table tr td:nth-child(2),
.recent-matches-table tr td:nth-child(3),
.recent-matches-table tr td:nth-child(4),
.recent-matches-table tr td:nth-child(5),
.recent-matches-table tr td:nth-child(6),
.recent-matches-table tr td:nth-child(7),
.recent-matches-table tr td:nth-child(8),
.recent-matches-table tr td:nth-child(9) {
    font-weight: bold;
    font-size: 1.1em;
    color: #333;
    text-align: center;
    transition: color 0.5s ease;
}

/* Row Hover effects */
.recent-matches-table tbody tr:hover {
    background: linear-gradient(90deg, #21cfff, #8f4fff);
    color: #fff;
    transition: background 0.5s ease, color 0.5s ease;
}

.recent-matches-table tbody tr:hover td {
    color: #fff !important;
}

/* Ensure icons change color on hover */
.recent-matches-table tbody tr:hover td i.fa-check-circle,
.recent-matches-table tbody tr:hover td i.fa-times-circle,
.recent-matches-table tbody tr:hover td i.fa-star,
.recent-matches-table tbody tr:hover td i.fas {
    color: #fff !important;
}

/* Ensure score text color changes correctly on hover */
.recent-matches-table tbody tr:hover td:nth-child(4) {
  color: inherit;
}

/* Make clickable rows look interactive */
.recent-matches-table tr.clickable-match-row {
    cursor: pointer;
}

.result-text,
.result-rating-change {
    display: block;      /* Force onto separate lines */
    text-align: center;  /* Ensure text is centered within the block */
    line-height: 1.5;    /* Slightly reduce line height for tighter packing */
    padding: 0 20px;     /* Added horizontal padding width to fix box padding issues */
}

.match-result {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.match-result.win {
    background-color: #4CAF50;
    color: white;
}

.match-result.loss {
    background-color: #F44336;
    color: white;
}

.match-result.draw {
    background-color: #FFC107;
    color: black;
}

.match-result.unranked {
    background-color: #9E9E9E;
    color: white;
}

.recent-matches-table td.rating-positive {
    /* Removed - styling now handled by .match-result */
}

.recent-matches-table td.rating-negative {
    /* Removed - styling now handled by .match-result */
}

.recent-matches-table td .fa-check-circle,
.recent-matches-table td .fa-times-circle {
    font-size: 1.2rem; /* Increased icon size */
}

.mvp-star {
    color: gold;
    font-size: 1.2rem;
}

.no-matches {
    text-align: center;
    padding: 30px;
    color: #777;
    font-style: italic;
}

/* Main Position Tag */
.position-tag.main-position {
    background-color: #ffd700;
    color: #000;
    font-weight: 800;
    font-size: 2.5rem;
}

.position-tag.main-position i {
    margin-right: 10px;
    font-size: 2.2rem;
}

/* Make tables more responsive on mobile */
@media (max-width: 768px) {
    .position-stats-table {
        font-size: 0.8rem;
    }
    
    .position-stats-table th,
    .position-stats-table td {
        padding: 6px 4px;
    }
    
    .chart-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .chart-controls select {
        margin-top: 5px;
        margin-left: 0;
        width: 100%;
    }
}

/* Responsive Layout */
@media (max-width: 960px) {
    .stats-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .profile-hero-container {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .player-image-container {
        justify-self: center;
        margin-bottom: 20px;
    }
    
    .player-metrics {
        justify-content: center;
    }
    
    .player-form {
        justify-content: center;
    }
    
    .player-tags {
        justify-content: center;
    }
    
    .stats-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .profile-hero {
        padding: 100px 20px 30px;
    }

    .player-identity h1 {
        font-size: 2.5rem;
    }

    .metric {
        margin-right: 15px;
    }

    .metric-value {
        font-size: 1.8rem;
    }
    
    .stat-item {
        flex: 1 1 45%;
    }
}

/* Apply animation base to direct children and key nested elements */
.profile-hero-container > *,
.player-identity > *,
.player-tags > *,
.player-metrics > *,
.player-form > *,
.form-indicators > * {
  opacity: 0; /* Start hidden */
  animation: fadeInUp 0.6s ease-out forwards; /* Apply animation */
}

/* Staggered Animation Delays */
.player-image-container {
  animation-delay: 0.1s;
}
.player-identity h1 {
  animation-delay: 0.2s;
}
.player-id {
  animation-delay: 0.3s;
}
.position-tag {
  animation-delay: 0.4s;
}
.country-tag {
  animation-delay: 0.5s;
}
.player-metrics .metric:nth-child(1) {
  animation-delay: 0.6s;
}
.player-metrics .metric:nth-child(2) {
  animation-delay: 0.7s;
}
.player-metrics .metric:nth-child(3) {
  animation-delay: 0.8s;
}
.player-metrics .metric:nth-child(4) {
  animation-delay: 0.9s;
}
.player-form .form-label {
    animation-delay: 1.0s;
}
.form-indicators .form-indicator:nth-child(1) {
    animation-delay: 1.1s;
}
.form-indicators .form-indicator:nth-child(2) {
    animation-delay: 1.2s;
}
.form-indicators .form-indicator:nth-child(3) {
    animation-delay: 1.3s;
}
.form-indicators .form-indicator:nth-child(4) {
    animation-delay: 1.4s;
}
.form-indicators .form-indicator:nth-child(5) {
    animation-delay: 1.5s;
}

/* Position table cell styling */
.position-stats-table .win-rate-cell,
.position-stats-table .mvp-rate-cell {
    font-weight: bold;
}

.position-stats-table .positive-rate {
    color: #4CAF50;
}

.position-stats-table .negative-rate {
    color: #F44336;
}

.no-data {
    color: #aaa;
    text-align: center;
    padding: 20px;
}

/* Last Match Summary Styles */
.last-match-summary {
    margin-top: 25px;
    padding-top: 20px;
}

.last-match-summary h3 {
    font-size: 1.2rem;
    color: #333; /* Darker color */
    margin-bottom: 15px;
    font-family: 'PremierLeague', Arial, sans-serif;
    border-bottom: 1px solid #eee; /* Add a light separator */
    padding-bottom: 10px; /* Space below separator */
    display: flex;
    align-items: center;
}

.last-match-summary h3 i {
    margin-right: 12px; /* Increased space */
    color: #00c6ff;
}

.last-match-summary p {
    font-size: 0.9rem; /* Slightly smaller text */
    color: #555; /* Grey color */
    line-height: 1.7; /* Increased line height */
    margin-bottom: 12px; /* Increased spacing */
    display: flex; /* Use flex for alignment */
    justify-content: space-between; /* Space out label and value */
    align-items: center;
}

.last-match-summary p strong.summary-label {
    color: #333;
    margin-right: 10px; /* Space after label */
    display: flex;
    align-items: center;
    font-weight: 600; /* Slightly bolder */
}

.last-match-summary p strong.summary-label i {
    margin-right: 6px;
    width: 16px; /* Fixed width for alignment */
    text-align: center;
    opacity: 0.8;
}

.last-match-summary p span:not(.match-result) {
    font-weight: 500; /* Make value slightly bolder */
    color: #333;
}

/* Style the last line with stats differently */
.last-match-summary p.match-stats {
    justify-content: flex-start; /* Align left */
    flex-wrap: wrap; /* Allow wrapping if needed */
    gap: 15px; /* Adjusted space between stat items */
    border-top: 1px dashed #eee; /* Add dashed separator above */
    padding-top: 12px; /* Space above separator */
    margin-top: 15px;
}

.last-match-summary p.match-stats .stat-detail {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: #555;
}

.last-match-summary p.match-stats .stat-detail i {
    margin-right: 5px;
    color: #E91E63; /* Use accent color for icons */
    width: 16px;
    text-align: center;
}

.last-match-summary p.match-stats .stat-detail strong {
    color: #333;
    font-weight: 700; /* Bolder stat number */
    margin-left: 4px;
}

.last-match-summary .match-result {
    padding: 3px 8px;
    font-size: 0.85rem;
    margin-left: 5px;
} 