/**
 * MyLocalLeague Team Statistics - CSS
 *
 * Styling for the team statistics page
 */

.mll-team-stats-container {
    max-width: 1200px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    position: relative;
    min-height: 200px;
}

/* Filters */
.mll-team-stats-filters {
    background-color: #f5f5f5;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.mll-team-stats-filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.filter-group {
    display: flex;
    align-items: center;
    margin-right: 10px;
}

.filter-group label {
    margin-right: 8px;
    font-weight: 600;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-width: 180px;
}

/* Team selection message */
.mll-team-select-message {
    text-align: center;
    padding: 50px 20px;
    background-color: #f9f9f9;
    border-radius: 5px;
    font-size: 16px;
    color: #555;
}

/* Stats cards */
.mll-stats-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.mll-stats-card {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.mll-stats-value {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 5px;
    color: #2271b1;
}

.mll-stats-label {
    font-size: 14px;
    color: #666;
}

/* Charts container */
.mll-charts-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.mll-chart-card {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.wide-chart {
    grid-column: span 2;
}

.mll-chart-card h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    color: #23282d;
    font-weight: 600;
    text-align: center;
}

/* Tables */
.mll-tables-container {
    margin-bottom: 30px;
}

.mll-stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.mll-stats-table th {
    background-color: #f5f5f5;
    padding: 10px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #e0e0e0;
}

.mll-stats-table td {
    padding: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.mll-stats-table tr:last-child td {
    border-bottom: none;
}

.mll-stats-table tr:hover {
    background-color: #f9f9f9;
}

/* Match result classes */
.match-win {
    background-color: rgba(76, 175, 80, 0.1);
}

.match-loss {
    background-color: rgba(244, 67, 54, 0.1);
}

.match-draw {
    background-color: rgba(255, 193, 7, 0.1);
}

.match-upcoming {
    background-color: rgba(33, 150, 243, 0.1);
}

/* Loading indicator */
.mll-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.mll-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #2271b1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .mll-charts-container {
        grid-template-columns: 1fr;
    }
    
    .wide-chart {
        grid-column: span 1;
    }
    
    .mll-stats-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .mll-stats-table {
        display: block;
        overflow-x: auto;
    }
    
    .mll-division-tracker canvas {
        max-height: 400px;
    }
}

/* Division Tracker specific styles */
.mll-division-tracker {
    background-color: #fff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mll-division-tracker h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #374151;
    font-size: 1.25rem;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 10px;
}

.mll-division-tracker canvas {
    width: 100% !important;
    height: 400px !important;
    max-height: 500px;
}

/* Loading indicator styles */
.mll-loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.mll-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: mll-spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes mll-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.mll-loading-indicator p {
    color: #6b7280;
    font-size: 14px;
    margin: 0;
}

/* Error message styles */
.mll-error-message {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.mll-error-message p {
    color: #dc2626;
    font-size: 14px;
    margin: 0;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 12px 16px;
}

@media (max-width: 480px) {
    .mll-stats-summary-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-group {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .filter-select {
        width: 100%;
    }
    
    .mll-division-tracker canvas {
        height: 300px !important;
    }
}

/* Fixtures Section */
.mll-fixtures-section {
    background-color: #fff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mll-fixtures-section h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #374151;
    font-size: 1.25rem;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 10px;
}

.mll-fixtures-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mll-fixture-item {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.mll-fixture-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mll-fixture-item.match-win {
    border-left: 4px solid #10b981;
    background-color: rgba(16, 185, 129, 0.05);
}

.mll-fixture-item.match-loss {
    border-left: 4px solid #ef4444;
    background-color: rgba(239, 68, 68, 0.05);
}

.mll-fixture-item.match-draw {
    border-left: 4px solid #f59e0b;
    background-color: rgba(245, 158, 11, 0.05);
}

.mll-fixture-item.match-upcoming {
    border-left: 4px solid #3b82f6;
    background-color: rgba(59, 130, 246, 0.05);
}

.mll-fixture-summary {
    display: grid;
    grid-template-columns: 120px 1fr 100px 80px 120px 100px 30px;
    gap: 10px;
    padding: 15px;
    cursor: pointer;
    align-items: center;
    transition: background-color 0.2s ease;
}

.mll-fixture-summary:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.mll-fixture-date {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

.mll-fixture-teams {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.mll-fixture-teams .team-name {
    color: #374151;
}

.mll-fixture-teams .vs {
    color: #9ca3af;
    font-size: 12px;
}

.mll-fixture-teams .opponent-name {
    color: #374151;
}

.mll-fixture-score {
    text-align: center;
    font-weight: 600;
    font-size: 16px;
}

.mll-fixture-score .score {
    color: #374151;
}

.mll-fixture-score .upcoming {
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
}

.mll-fixture-result {
    text-align: center;
}

.result-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-badge.match-win {
    background-color: #10b981;
    color: white;
}

.result-badge.match-loss {
    background-color: #ef4444;
    color: white;
}

.result-badge.match-draw {
    background-color: #f59e0b;
    color: white;
}

.result-badge.match-upcoming {
    background-color: #3b82f6;
    color: white;
}

.mll-fixture-type {
    font-size: 12px;
    color: #6b7280;
    text-align: center;
}

.mll-fixture-type small {
    display: block;
    font-size: 10px;
    margin-top: 2px;
}

.mll-fixture-location {
    text-align: center;
    font-size: 12px;
}

.home-indicator,
.away-indicator {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
    text-align: center;
    line-height: 18px;
    margin-bottom: 2px;
}

.home-indicator {
    background-color: #10b981;
    color: white;
}

.away-indicator {
    background-color: #6b7280;
    color: white;
}

.mll-fixture-location small {
    display: block;
    color: #9ca3af;
    font-size: 10px;
}

.mll-fixture-expand {
    text-align: center;
}

.expand-icon {
    color: #9ca3af;
    font-size: 12px;
    transition: transform 0.2s ease;
}

.mll-fixture-details {
    border-top: 1px solid #e5e7eb;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.02);
}

.mll-fixture-breakdown h5 {
    margin: 0 0 15px 0;
    color: #374151;
    font-size: 16px;
    font-weight: 600;
}

.mll-legs-breakdown {
    background-color: white;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.leg-header {
    display: grid;
    grid-template-columns: 100px 1fr 1fr 100px;
    gap: 10px;
    padding: 12px 15px;
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    font-size: 14px;
    color: #374151;
}

.leg-row {
    display: grid;
    grid-template-columns: 100px 1fr 1fr 100px;
    gap: 10px;
    padding: 10px 15px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
    align-items: center;
}

.leg-row:last-child {
    border-bottom: none;
}

.leg-row.leg-win {
    background-color: rgba(16, 185, 129, 0.05);
}

.leg-row.leg-loss {
    background-color: rgba(239, 68, 68, 0.05);
}

.leg-row.leg-draw {
    background-color: rgba(245, 158, 11, 0.05);
}

.leg-totals {
    display: grid;
    grid-template-columns: 100px 1fr 1fr 100px;
    gap: 10px;
    padding: 12px 15px;
    background-color: #f9fafb;
    border-top: 2px solid #e5e7eb;
    font-size: 14px;
}

.leg-number {
    color: #6b7280;
    font-weight: 500;
}

.team-score,
.opponent-score {
    text-align: center;
    font-weight: 500;
}

.leg-winner {
    text-align: center;
    font-weight: 500;
    color: #374151;
}

.mll-fixture-venue {
    margin-top: 15px;
    padding: 10px;
    background-color: #f9fafb;
    border-radius: 4px;
    font-size: 14px;
    color: #374151;
}

.mll-tournament-info {
    margin-top: 15px;
    padding: 10px;
    background-color: #fef3c7;
    border-radius: 4px;
    font-size: 14px;
    color: #92400e;
}

.mll-tournament-info div {
    margin-bottom: 5px;
}

.mll-tournament-info div:last-child {
    margin-bottom: 0;
}

.mll-upcoming-details {
    text-align: center;
    color: #6b7280;
    font-style: italic;
}

/* Responsive adjustments for fixtures */
@media (max-width: 768px) {
    .mll-fixture-summary {
        grid-template-columns: 1fr;
        gap: 8px;
        text-align: center;
    }
    
    .mll-fixture-teams {
        justify-content: center;
    }
    
    .leg-header,
    .leg-row,
    .leg-totals {
        grid-template-columns: 80px 1fr 1fr 80px;
        gap: 5px;
        padding: 8px 10px;
        font-size: 12px;
    }
    
    .mll-fixture-location {
        order: -1;
    }
}

@media (max-width: 480px) {
    .mll-fixture-summary {
        padding: 12px;
    }
    
    .leg-header,
    .leg-row,
    .leg-totals {
        grid-template-columns: 60px 1fr 1fr 60px;
        gap: 3px;
        padding: 6px 8px;
        font-size: 11px;
    }
}