/*
=============================================================================
CLASH OF CLANS DASHBOARD - WAR MANAGEMENT STYLES
=============================================================================
Styles for Phase 3: War Management system including:
- Current war display with live timers
- War statistics and performance metrics
- War history and analytics
- Battle-themed design elements
*/

/* 
=============================================================================
WAR MANAGEMENT LAYOUT
=============================================================================
*/

.war-management {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 20px 0;
}

.war-section {
    background: linear-gradient(135deg, var(--card-background), rgba(255, 255, 255, 0.05));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.section-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.section-btn:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* 
=============================================================================
CURRENT WAR SECTION
=============================================================================
*/

.current-war-section {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.1), var(--card-background));
    border-left: 4px solid #e74c3c;
}

.war-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.war-status.inWar {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    border: 1px solid #e74c3c;
}

.war-status.preparation {
    background: rgba(241, 196, 15, 0.2);
    color: #f1c40f;
    border: 1px solid #f1c40f;
}

.war-status.warEnded {
    background: rgba(149, 165, 166, 0.2);
    color: #95a5a6;
    border: 1px solid #95a5a6;
}

.current-war-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
}

.war-teams {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
}

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

.our-team {
    text-align: left;
}

.opponent-team {
    text-align: right;
}

.team-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.team-name {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-primary);
}

.team-level {
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.8;
}

.team-stats {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 14px;
}

.stars {
    color: #f1c40f;
    font-weight: bold;
}

.destruction {
    color: #e67e22;
    font-weight: 500;
}

.vs-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.vs-text {
    font-size: 20px;
    font-weight: bold;
    color: var(--accent-color);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.war-timer {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid #e74c3c;
    border-radius: 8px;
    padding: 8px 12px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #e74c3c;
    font-size: 14px;
    min-width: 80px;
}

.war-progress {
    margin-bottom: 16px;
}

.progress-bar {
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #e74c3c, #c0392b);
    border-radius: 6px;
    transition: width 1s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progressShimmer 2s ease-in-out infinite;
}

.progress-text {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
}

.war-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.war-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.war-btn:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: translateY(-1px);
}

/* No Current War State */
.no-current-war {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.no-war-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.7;
}

.no-war-message {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.no-war-description {
    font-size: 14px;
    opacity: 0.8;
}

/* 
=============================================================================
WAR STATISTICS OVERVIEW
=============================================================================
*/

.war-stats-overview {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.1), var(--card-background));
    border-left: 4px solid #3498db;
}

/* 
=============================================================================
RECENT WARS SECTION
=============================================================================
*/

.recent-wars-section {
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.1), var(--card-background));
    border-left: 4px solid #9b59b6;
}

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

.war-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.war-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.war-card.victory {
    border-left: 4px solid #27ae60;
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.1), rgba(255, 255, 255, 0.05));
}

.war-card.defeat {
    border-left: 4px solid #e74c3c;
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.1), rgba(255, 255, 255, 0.05));
}

.war-card.tie {
    border-left: 4px solid #f39c12;
    background: linear-gradient(135deg, rgba(243, 156, 18, 0.1), rgba(255, 255, 255, 0.05));
}

.war-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.war-result {
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-icon {
    font-size: 20px;
}

.result-text {
    font-size: 12px;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
}

.victory .result-text {
    background: rgba(39, 174, 96, 0.2);
    color: #27ae60;
}

.defeat .result-text {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.tie .result-text {
    background: rgba(243, 156, 18, 0.2);
    color: #f39c12;
}

.war-date {
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.8;
}

.war-matchup {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: center;
    margin-bottom: 12px;
    text-align: center;
}

.clan-score, .opponent-score {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.clan-score {
    text-align: left;
}

.opponent-score {
    text-align: right;
}

.clan-name, .opponent-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.score {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.vs {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: bold;
    opacity: 0.6;
}

.war-card-stats {
    display: flex;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    font-size: 11px;
}

.stat-item {
    display: flex;
    gap: 4px;
    color: var(--text-secondary);
}

.stat-label {
    opacity: 0.8;
}

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

/* 
=============================================================================
WAR WIDGET (DASHBOARD)
=============================================================================
*/

.war-widget {
    background: linear-gradient(135deg, var(--card-background), rgba(255, 255, 255, 0.05));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    max-height: 300px;
    overflow: hidden;
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.widget-title {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-primary);
}

.widget-expand {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.widget-expand:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-color);
    transform: scale(1.1);
}

.current-war-widget {
    text-align: center;
    padding: 16px;
}

.widget-war-status {
    font-size: 14px;
    font-weight: bold;
    color: #e74c3c;
    margin-bottom: 12px;
    padding: 6px 12px;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 20px;
    display: inline-block;
}

.widget-war-teams {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 12px 0;
    font-size: 13px;
}

.widget-team {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.team-name {
    font-weight: 600;
    color: var(--text-primary);
}

.team-score {
    color: var(--text-secondary);
    font-size: 12px;
}

.widget-war-timer {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid #e74c3c;
    border-radius: 6px;
    padding: 6px 10px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #e74c3c;
    font-size: 12px;
    display: inline-block;
    margin-top: 8px;
}

.no-current-war-widget {
    text-align: center;
    padding: 16px;
}

.widget-status {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 500;
}

.widget-stats {
    display: flex;
    justify-content: space-around;
    font-size: 11px;
    color: var(--text-secondary);
}

.widget-stats span {
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.widget-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.widget-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.widget-btn:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* 
=============================================================================
RESPONSIVE DESIGN
=============================================================================
*/

@media (max-width: 768px) {
    .war-management {
        gap: 16px;
    }
    
    .war-section {
        padding: 16px;
    }
    
    .war-teams {
        grid-template-columns: 1fr;
        gap: 16px;
        text-align: center;
    }
    
    .our-team, .opponent-team {
        text-align: center;
    }
    
    .vs-section {
        order: -1;
    }
    
    .war-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .war-btn {
        justify-content: center;
        width: 100%;
    }
    
    .war-matchup {
        grid-template-columns: 1fr;
        gap: 8px;
        text-align: center;
    }
    
    .clan-score, .opponent-score {
        text-align: center;
    }
    
    .war-card-stats {
        flex-direction: column;
        gap: 4px;
    }
    
    .widget-war-teams {
        flex-direction: column;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .section-btn {
        align-self: flex-end;
    }
    
    .current-war-card {
        padding: 16px;
    }
    
    .war-widget {
        padding: 16px;
    }
}

/* 
=============================================================================
ANIMATIONS & EFFECTS
=============================================================================
*/

@keyframes progressShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

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

.war-card {
    animation: warCardFadeIn 0.3s ease forwards;
}

.war-card:nth-child(1) { animation-delay: 0.1s; }
.war-card:nth-child(2) { animation-delay: 0.2s; }
.war-card:nth-child(3) { animation-delay: 0.3s; }
.war-card:nth-child(4) { animation-delay: 0.4s; }
.war-card:nth-child(5) { animation-delay: 0.5s; }

/* War timer pulse animation */
.war-timer {
    animation: timerPulse 2s ease-in-out infinite;
}

@keyframes timerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* 
=============================================================================
ACCESSIBILITY
=============================================================================
*/

@media (prefers-reduced-motion: reduce) {
    .progress-fill::after,
    .war-card,
    .war-timer {
        animation: none;
    }
    
    .war-card:hover,
    .war-btn:hover {
        transform: none;
    }
}

/* 
=============================================================================
PRINT STYLES
=============================================================================
*/

@media print {
    .war-actions,
    .widget-actions,
    .widget-expand {
        display: none;
    }
    
    .war-section {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .war-widget {
        max-height: none;
        overflow: visible;
    }
}