/* Team Dashboard Modal Styles */

.team-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 10, 16, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.team-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.team-modal-content {
    background: var(--surface);
    border-radius: 18px;
    border: 1px solid var(--border);
    width: 90%;
    max-width: 860px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.team-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(209, 181, 122, 0.18), rgba(111, 138, 168, 0.14));
    border-radius: 18px 18px 0 0;
}

.team-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.team-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 10px;
    padding: 6px;
    display: none;
}

.team-info h2 {
    color: var(--accent);
    margin: 0;
    font-size: 1.8em;
}

.player-name {
    color: var(--muted);
    margin: 5px 0 0 0;
    font-size: 1.05em;
}

.close-btn {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 2em;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: var(--surface-2);
    color: var(--text);
}

.team-modal-body {
    padding: 30px;
}

.team-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-box {
    background: var(--surface-2);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--border);
}

.stat-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 2.2em;
    font-weight: bold;
    color: var(--accent-2);
    display: block;
    margin-bottom: 8px;
}

.stat-label {
    color: var(--muted);
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.team-form {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-bottom: 8px;
}

.form-badge {
    display: inline-block;
    width: 26px;
    height: 26px;
    line-height: 26px;
    text-align: center;
    border-radius: 6px;
    font-size: 0.8em;
    font-weight: bold;
}

.form-badge.win {
    background: var(--accent-soft);
    color: var(--accent);
}

.form-badge.draw {
    background: var(--warning-soft);
    color: var(--warning);
}

.form-badge.loss {
    background: var(--danger-soft);
    color: var(--danger);
}

.form-badge.unknown {
    background: rgba(154, 163, 173, 0.2);
    color: var(--muted);
}

.team-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.team-section h3 {
    color: var(--accent);
    margin-bottom: 20px;
    font-size: 1.2em;
}

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

.match-item {
    background: var(--surface-2);
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid var(--border);
    border: 1px solid var(--border);
}

.match-item.upcoming {
    border-left-color: var(--accent-2);
}

.match-item.result.win {
    border-left-color: var(--accent);
}

.match-item.result.draw {
    border-left-color: var(--warning);
}

.match-item.result.loss {
    border-left-color: var(--danger);
}

.match-date {
    color: var(--muted);
    font-size: 0.85em;
    margin-bottom: 8px;
}

.match-teams {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 500;
    gap: 8px;
}

.home-team, .away-team {
    color: var(--accent-2);
    font-weight: bold;
}

.vs {
    color: var(--muted);
    font-size: 0.9em;
}

.score {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: bold;
    color: var(--text);
    font-size: 1.1em;
}

.match-competition {
    color: var(--muted);
    font-size: 0.8em;
}

.match-result-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8em;
    font-weight: bold;
    float: right;
}

.match-result-badge.win {
    background: var(--accent-soft);
    color: var(--accent);
}

.match-result-badge.draw {
    background: var(--warning-soft);
    color: var(--warning);
}

.match-result-badge.loss {
    background: var(--danger-soft);
    color: var(--danger);
}

.team-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    border-top: 1px solid var(--border);
    padding-top: 30px;
}

.action-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.highlights-btn {
    background: var(--danger);
    color: white;
}

.highlights-btn:hover {
    filter: brightness(1.05);
    transform: translateY(-2px);
}

.action-btn:not(.highlights-btn) {
    background: var(--surface-2);
    color: var(--muted);
    border: 1px solid var(--border);
}

.action-btn:not(.highlights-btn):hover {
    background: var(--surface-3);
    color: var(--text);
}

.loading, .error, .no-matches {
    text-align: center;
    color: var(--muted);
    padding: 20px;
    font-style: italic;
}

.error {
    color: var(--danger);
}

/* Statistik modal styles */
.stats-modal-content {
    max-width: 1050px;
    width: 95%;
    max-height: 95vh;
}

.stats-modal-body {
    padding: 0;
}

.stats-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.stats-tab {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: none;
    color: var(--muted);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.stats-tab:hover {
    background: var(--surface-2);
    color: var(--text);
}

.stats-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: var(--surface-2);
}

.stats-content {
    padding: 30px;
    min-height: 400px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.stat-section {
    background: var(--surface-2);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.stat-section.highlight {
    border: 1px solid rgba(209, 181, 122, 0.45);
    background: linear-gradient(135deg, rgba(38, 32, 20, 0.85), rgba(18, 22, 30, 0.95));
}

.stat-section.loss-highlight {
    border: 1px solid rgba(201, 109, 114, 0.45);
    background: linear-gradient(135deg, rgba(44, 24, 28, 0.85), rgba(18, 22, 30, 0.95));
}

.stat-section h3 {
    color: var(--accent);
    margin-bottom: 15px;
    font-size: 1.1em;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
}

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

.stat-label {
    color: var(--muted);
    font-size: 0.85em;
}

.stat-value {
    font-weight: bold;
    color: var(--text);
}

.win-color {
    color: var(--accent) !important;
}

.draw-color {
    color: var(--warning) !important;
}

.loss-color {
    color: var(--danger) !important;
}

.loading-stats {
    text-align: center;
    color: var(--muted);
    padding: 60px 20px;
    font-size: 1.1em;
}

/* Form section styles */
.form-section {
    margin-bottom: 30px;
}

.form-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.form-item h4 {
    color: var(--muted);
    margin-bottom: 10px;
    font-size: 0.95em;
}

.form-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.month-stats {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.month-stats:last-child {
    border-bottom: none;
}

.month-stats h4 {
    color: var(--text);
    margin-bottom: 5px;
}

.month-record {
    color: var(--accent);
    font-weight: bold;
    margin-bottom: 5px;
}

.month-goals {
    color: var(--muted);
    font-size: 0.9em;
}

/* Records section */
.records-section {
    margin-bottom: 30px;
}

.record-item {
    text-align: center;
}

.record-score {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 5px;
    font-family: 'IBM Plex Mono', monospace;
}

.loss-score {
    color: var(--danger);
}

.record-opponent {
    color: var(--muted);
    margin-bottom: 5px;
}

.record-date {
    color: var(--muted);
    font-size: 0.9em;
    margin-bottom: 10px;
}

.record-margin {
    color: var(--accent);
    font-weight: bold;
    font-size: 1.05em;
}

.loss-margin {
    color: var(--danger) !important;
}

.no-record {
    text-align: center;
    color: var(--muted);
    padding: 40px;
    font-style: italic;
}

/* Charts section */
.charts-section {
    margin-bottom: 30px;
}

.chart-container {
    background: var(--surface-2);
    padding: 20px;
    border-radius: 12px;
    position: relative;
    border: 1px solid var(--border);
}

.chart-container.chart-tall {
    height: 260px;
    margin-bottom: 24px;
}

/* Animationer */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsiv design */
@media (max-width: 768px) {
    .team-modal {
        align-items: flex-end;
    }

    .team-modal-content {
        width: 100%;
        margin: 0;
        border-radius: 16px 16px 0 0;
    }

    .stats-modal-content {
        width: 100%;
        margin: 0;
        border-radius: 16px 16px 0 0;
    }

    .team-modal-header {
        padding: 15px 20px;
        border-radius: 16px 16px 0 0;
    }

    .team-info h2 {
        font-size: 1.4em;
    }

    .team-modal-body {
        padding: 20px;
    }

    .team-stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }

    .team-sections {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .team-actions {
        flex-direction: column;
    }

    .stat-value {
        font-size: 2em;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .stats-tabs {
        flex-wrap: wrap;
    }

    .stats-tab {
        flex: 1;
        min-width: 120px;
        font-size: 0.9em;
        padding: 12px 15px;
    }

    .form-display {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .record-score {
        font-size: 2em;
    }

    .chart-container.chart-tall {
        height: 220px;
    }
}
