/* ============================================
   TEAM BATTLE STYLES
   Professional gaming UI for Team Battle modes
   ============================================ */

/* Header Section */
.team-battle-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 32px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 12px 24px;
    border-radius: 50px;
    margin-bottom: 16px;
}

.mode-icon {
    font-size: 32px;
    line-height: 1;
}

.mode-title {
    font-size: 24px;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mode-description {
    color: rgba(255, 255, 255, 0.8);
    font-size: 16px;
    margin: 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Winner Banner */
.winner-banner {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    border-radius: 20px;
    padding: 48px 32px;
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 12px 48px rgba(22, 163, 74, 0.3);
}

.winner-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.winner-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

.trophy-animation {
    font-size: 64px;
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.winner-text {
    text-align: center;
}

.winner-title {
    font-size: 42px;
    font-weight: 900;
    color: white;
    margin: 0 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.winner-team {
    font-size: 24px;
    color: rgba(255, 255, 255, 0.95);
    margin: 0;
}

.winner-team strong {
    font-weight: 800;
    color: #fef08a;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.confetti {
    font-size: 48px;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Teams Container */
.teams-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 24px;
    margin-bottom: 48px;
}

@media (max-width: 768px) {
    .teams-container {
        grid-template-columns: 1fr;
    }
}

/* Team Cards */
.team-card {
    background: white;
    border-radius: 20px;
    padding: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    overflow: hidden;
    border: 3px solid transparent;
}

.team-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.12);
}

.team-card.team-blue {
    border-color: #3b82f6;
}

.team-card.team-red {
    border-color: #ef4444;
}

.team-card.is-winner {
    border-color: #fbbf24;
    box-shadow: 0 12px 48px rgba(251, 191, 36, 0.3);
    position: relative;
}

.team-card.is-winner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #fbbf24, #f59e0b, #fbbf24);
    animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
    0% { background-position: -200px; }
    100% { background-position: 200px; }
}

/* Team Card Header */
.team-card-header {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.team-card.team-blue .team-card-header {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.team-card.team-red .team-card-header {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

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

.crown-icon {
    font-size: 32px;
    animation: bounce 1s ease-in-out infinite;
}

.team-name {
    font-size: 28px;
    font-weight: 800;
    color: white;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.team-score-badge {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-radius: 50px;
    text-align: center;
}

.score-number {
    display: block;
    font-size: 32px;
    font-weight: 900;
    color: white;
    line-height: 1;
}

.score-label {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

/* Team Stats Row */
.team-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: #e5e7eb;
    margin: 0;
}

.stat-box {
    background: white;
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: #1e293b;
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 6px;
}

/* Team Members */
.team-members {
    padding: 24px;
}

.members-title {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #e5e7eb;
}

.members-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 12px;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.member-item.active {
    border-color: #16a34a;
    background: #f0fdf4;
}

.member-item.eliminated {
    opacity: 0.5;
    background: #fef2f2;
    border-color: #fecaca;
}

.member-item:hover {
    transform: translateX(4px);
}

.member-order {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
}

.member-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.member-details {
    flex: 1;
}

.member-name {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 2px;
}

.member-club {
    font-size: 13px;
    color: #64748b;
}

.status-badge {
    font-size: 20px;
}

/* ============================================
   MATCH HISTORY SECTION - REDESIGNED
   ============================================ */

.matches-section {
    margin-top: 48px;
}

.section-header {
    margin-bottom: 32px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 16px;
    padding: 24px 32px;
    border: 2px solid #e2e8f0;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 28px;
    font-weight: 800;
    color: #1e293b;
    margin: 0;
}

.title-icon {
    font-size: 32px;
}

.title-count {
    font-size: 16px;
    font-weight: 600;
    color: #64748b;
    background: #f1f5f9;
    padding: 4px 12px;
    border-radius: 20px;
}

/* Matches Grid */
.matches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 24px;
}

/* Battle Card */
.battle-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.battle-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.battle-card.completed {
    border-color: #16a34a;
}

.battle-card.upcoming {
    border-color: #f59e0b;
    opacity: 0.85;
}

/* Battle Header */
.battle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 2px solid #e2e8f0;
}

.match-badge {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.badge-number {
    letter-spacing: 0.5px;
}

.match-status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.match-status-badge.completed {
    background: #dcfce7;
    color: #15803d;
}

.match-status-badge.upcoming {
    background: #fef3c7;
    color: #b45309;
}

/* Battle Arena */
.battle-arena {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 12px;
    padding: 20px 16px;
    align-items: center;
}

/* Fighters */
.fighter {
    transition: all 0.3s ease;
}

.fighter.winner {
    transform: scale(1.05);
}

.fighter.winner .fighter-content {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border: 2px solid #16a34a;
    box-shadow: 0 8px 24px rgba(22, 163, 74, 0.2);
}

.fighter.draw .fighter-content {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
}

.fighter-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.fighter-left .fighter-content {
    flex-direction: row;
}

.fighter-right .fighter-content {
    flex-direction: row-reverse;
}

.fighter-avatar {
    position: relative;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
}

.fighter-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    object-fit: cover;
    border: 3px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
}

.winner-crown {
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 24px;
    animation: crownBounce 0.8s ease-in-out infinite;
}

@keyframes crownBounce {
    0%, 100% { transform: translateY(0) rotate(-15deg); }
    50% { transform: translateY(-4px) rotate(-15deg); }
}

.fighter-info {
    flex: 1;
    min-width: 0;
}

.fighter-left .fighter-info {
    text-align: left;
}

.fighter-right .fighter-info {
    text-align: right;
}

.fighter-name {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.team-indicator {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

.team-indicator.team-blue {
    background: #dbeafe;
    color: #1e40af;
}

.team-indicator.team-red {
    background: #fee2e2;
    color: #991b1b;
}

/* VS Divider */
.vs-divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.vs-circle {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(100, 116, 139, 0.4);
    position: relative;
    flex-shrink: 0;
}

.vs-circle::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: linear-gradient(45deg, #3b82f6, #ec4899, #8b5cf6);
    z-index: -1;
    opacity: 0;
    animation: vsGlow 2s ease-in-out infinite;
}

@keyframes vsGlow {
    0%, 100% { opacity: 0; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
}

.vs-text {
    color: white;
    font-weight: 900;
    font-size: 16px;
    letter-spacing: 0.5px;
}

.match-result-display {
    text-align: center;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: 0.5px;
    padding: 6px 12px;
    border-radius: 8px;
}

.result-winner {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #15803d;
    padding: 6px 14px;
    border-radius: 20px;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.2);
}

.result-draw {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #b45309;
    padding: 6px 14px;
    border-radius: 20px;
    display: inline-block;
}

/* Battle Footer */
.battle-footer {
    padding: 16px 20px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-top: 2px solid #bbf7d0;
}

.result-summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #15803d;
}

.result-summary i {
    color: #16a34a;
    font-size: 18px;
}
/* Responsive Design */
@media (max-width: 768px) {
    .team-battle-header {
        padding: 24px 16px;
    }

    .mode-title {
        font-size: 20px;
    }

    .mode-description {
        font-size: 14px;
    }

    .winner-banner {
        padding: 32px 16px;
    }

    .winner-content {
        flex-direction: column;
        gap: 16px;
    }

    .trophy-animation {
        font-size: 48px;
    }

    .winner-title {
        font-size: 32px;
    }

    .winner-team {
        font-size: 18px;
    }

    .team-name {
        font-size: 22px;
    }

    .score-number {
        font-size: 24px;
    }

    /* Match History Responsive */
    .matches-grid {
        grid-template-columns: 1fr;
    }

    .battle-arena {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .vs-divider {
        order: 2;
    }

    .fighter-right {
        order: 3;
    }

    .fighter-right .fighter-content {
        flex-direction: row;
    }

    .fighter-right .fighter-info {
        text-align: left;
    }

    .section-title {
        font-size: 22px;
        flex-wrap: wrap;
    }

    .title-count {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .fighter-avatar {
        width: 48px;
        height: 48px;
    }

    .fighter-name {
        font-size: 14px;
    }

    .vs-circle {
        width: 48px;
        height: 48px;
    }

    .vs-text {
        font-size: 16px;
    }
}