/* Battle Mode Styles */
.battle-mode-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: battleFadeIn 0.3s ease-in;
}

@keyframes battleFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.battle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(15, 12, 41, 0.8);
    border-bottom: 1px solid var(--card-border);
}

.battle-title {
    color: var(--secondary);
    margin: 0;
    font-size: 1.6rem;
    text-shadow: 0 0 10px rgba(255, 158, 0, 0.3);
}

.exit-battle-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: linear-gradient(to right, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 50px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(90, 24, 154, 0.4);
    z-index: 1001;
}

.exit-battle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(90, 24, 154, 0.6);
}

.battle-selection-area {
    flex: 1;
    display: flex;
    gap: 20px;
    padding: 20px;
    overflow-y: auto;
    max-height: calc(100vh - 170px);
}

@media (max-width: 768px) {
    .battle-selection-area {
        flex-direction: column;
    }
}

.character-selection-section {
    flex: 1;
    background: rgba(15, 12, 41, 0.6);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.character-selection-section h3 {
    color: var(--secondary);
    margin: 0 0 10px 0;
    text-align: center;
}

.selection-type-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.selection-type-btn {
    background: rgba(36, 0, 70, 0.7);
    color: white;
    border: 1px solid var(--card-border);
    border-radius: 5px;
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.selection-type-btn:hover {
    background: rgba(123, 44, 191, 0.4);
    transform: translateY(-2px);
}

.selection-panel {
    background: rgba(36, 0, 70, 0.3);
    border-radius: 10px;
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.hidden {
    display: none;
}

.character-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.canon-character-grid {
    max-height: 250px;
    overflow-y: auto;
}

.character-selection-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.character-selection-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.character-selection-card.selected {
    background: rgba(123, 44, 191, 0.4);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(123, 44, 191, 0.5);
}

.character-selection-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

.character-icon {
    font-size: 2.5rem;
    margin-bottom: 5px;
}

.character-selection-name {
    margin: 5px 0;
    font-size: 0.9rem;
    text-align: center;
}

.character-traits {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
}

.character-trait {
    background: rgba(36, 0, 70, 0.5);
    border-radius: 15px;
    padding: 2px 6px;
    font-size: 0.65rem;
}

.series-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.series-tab {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 50px;
    padding: 5px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.series-tab:hover {
    background: rgba(36, 0, 70, 0.7);
}

.series-tab.active {
    background: var(--primary);
    color: white;
}

.selected-character-display {
    margin-top: 15px;
    background: rgba(36, 0, 70, 0.4);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    min-height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.selected-character-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.selected-character-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

.selected-character-icon {
    font-size: 3rem;
}

.character-tier, .character-series {
    font-size: 0.8rem;
    color: var(--secondary);
}

.battle-submit-btn {
    background: linear-gradient(to right, var(--secondary), #ff5e62);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    margin: 0 auto 20px;
    box-shadow: 0 4px 15px rgba(255, 94, 98, 0.4);
}

.battle-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 94, 98, 0.6);
}

.battle-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.battle-results-area {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: rgba(15, 12, 41, 0.4);
    border-radius: 15px;
    margin: 0 20px 20px;
}

.battle-loading {
    text-align: center;
    padding: 40px;
    font-style: italic;
    color: rgba(255, 255, 255, 0.7);
}

.battle-result-title {
    text-align: center;
    color: var(--secondary);
    margin-bottom: 20px;
}

.battle-introduction {
    background: rgba(36, 0, 70, 0.5);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: justify;
    line-height: 1.5;
}

.tier-comparison {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: rgba(36, 0, 70, 0.3);
    border-radius: 10px;
    padding: 15px;
}

.fighter-tier {
    text-align: center;
    flex: 1;
}

.fighter-tier h4 {
    margin: 0 0 10px 0;
    color: var(--light);
}

.fighter-tier .tier-name {
    display: inline-block;
    background: linear-gradient(to right, rgba(123, 44, 191, 0.2), rgba(255, 158, 0, 0.2));
    border-radius: 10px;
    padding: 5px 10px;
    font-weight: bold;
    color: var(--secondary);
}

.versus {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--secondary);
    margin: 0 20px;
}

.battle-round {
    background: rgba(36, 0, 70, 0.4);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
}

.battle-round h3 {
    color: var(--primary);
    margin-top: 0;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 5px;
}

.battle-conclusion {
    background: rgba(36, 0, 70, 0.5);
    border-radius: 10px;
    padding: 15px;
    margin: 20px 0;
    text-align: justify;
    line-height: 1.5;
}

.battle-winner {
    background: rgba(255, 158, 0, 0.1);
    border-left: 3px solid var(--secondary);
    border-radius: 0 5px 5px 0;
    padding: 15px;
    margin: 20px 0;
}

.battle-winner h3 {
    margin-top: 0;
    color: var(--secondary);
}

.battle-effects, .power-ups {
    background: rgba(36, 0, 70, 0.3);
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
}

.battle-effects h4, .power-ups h4 {
    color: var(--secondary);
    margin-top: 0;
}

.battle-replay-btn {
    background: linear-gradient(to right, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    margin: 30px auto 10px;
    box-shadow: 0 4px 15px rgba(90, 24, 154, 0.4);
}

.battle-replay-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(90, 24, 154, 0.6);
}

/* Mobile optimization */
@media (max-width: 768px) {
    .tier-comparison {
        flex-direction: column;
        gap: 15px;
    }
    
    .versus {
        margin: 10px 0;
    }
    
    .battle-results-area {
        margin: 0 10px 10px;
        padding: 15px;
    }
}