/* Modal Overlay */
#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 20, 0.7);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Fighter Selection Modal Styles */
#fighter-selection {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 800px;
    background: rgba(15, 15, 30, 0.9);
    backdrop-filter: blur(15px);
    border: 2px solid #4040ff;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 0 30px rgba(96, 240, 255, 0.5);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    margin: auto;
    overflow: hidden;
}

#fighter-selection.visible {
    opacity: 1;
    visibility: visible;
    animation: modalPulse 0.5s ease;
}

@keyframes modalPulse {
    0% { transform: translate(-50%, -50%) scale(0.95); }
    50% { transform: translate(-50%, -50%) scale(1.02); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

#fighter-selection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(96, 240, 255, 0.3);
    padding-bottom: 1rem;
}

#fighter-selection-header h2 {
    margin: 0;
    font-size: 2.2rem;
    color: #60f0ff;
    text-shadow: 0 0 10px rgba(96, 240, 255, 0.7);
    letter-spacing: 1px;
}

#close-fighter-selection {
    background: none;
    border: none;
    color: #60f0ff;
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0.5rem;
    margin: 0;
    box-shadow: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#close-fighter-selection:hover {
    color: #ffcc00;
    background: rgba(96, 240, 255, 0.2);
    box-shadow: 0 0 15px rgba(96, 240, 255, 0.5);
    transform: rotate(90deg);
}

#fighter-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    max-height: 350px;
    overflow-y: auto;
    overflow-x: visible;
    padding-right: 10px;
    padding-top: 5px;
    padding-bottom: 5px;
    /* Stylish scrollbar */
    scrollbar-width: thin;
    scrollbar-color: #4040ff rgba(15, 15, 30, 0.5);
}

#fighter-list::-webkit-scrollbar {
    width: 8px;
}

#fighter-list::-webkit-scrollbar-track {
    background: rgba(15, 15, 30, 0.5);
    border-radius: 10px;
}

#fighter-list::-webkit-scrollbar-thumb {
    background: #4040ff;
    border-radius: 10px;
}

#fighter-list::-webkit-scrollbar-thumb:hover {
    background: #60f0ff;
}

#new-fighter {
    background: linear-gradient(to bottom, #4040ff, #2020aa);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    display: block;
    margin: 0 auto;
    box-shadow: 0 0 15px rgba(64, 64, 255, 0.5);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
    width: fit-content;
}

#new-fighter::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transition: left 0.6s;
}

#new-fighter:hover {
    background: linear-gradient(to bottom, #60f0ff, #4040ff);
    box-shadow: 0 0 25px rgba(96, 240, 255, 0.7);
    transform: translateY(-3px);
}

#new-fighter:hover::before {
    left: 100%;
}

.no-fighters-message {
    text-align: center;
    padding: 2rem;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

/* Training Grounds Modal */
#training-grounds {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #1a1a3a;
    padding: 20px;
    border-radius: 10px;
    z-index: 1000;
    width: 80%;
    max-width: 800px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    color: #fff;
}

#training-grounds.hidden {
    display: none;
}

#training-grounds-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#fighter-preview {
    padding: 10px;
    background: #2a2a5a;
    margin-bottom: 15px;
    border-radius: 5px;
}

#training-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.tab-button {
    padding: 8px 16px;
    background: #404080;
    border: none;
    color: #fff;
    cursor: pointer;
    border-radius: 5px;
}

.tab-button.active {
    background: #60f0ff;
    color: #000;
}

.upgrade-category {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.upgrade-card {
    background: #2a2a5a;
    padding: 10px;
    border-radius: 5px;
    width: 200px;
}

.upgrade-card h4 {
    margin: 0 0 5px;
}

.upgrade-card p {
    margin: 5px 0;
    font-size: 0.9em;
}

.upgrade-card button {
    width: 100%;
    padding: 5px;
    background: #60f0ff;
    border: none;
    color: #000;
    cursor: pointer;
    border-radius: 3px;
}

.upgrade-card button:disabled {
    background: #666;
    cursor: not-allowed;
}

/* Battle Summary Modal */
#summary-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 20, 0.7);
    z-index: 199;
}

#battle-summary {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 600px;
    background: rgba(20, 20, 40, 0.95);
    backdrop-filter: blur(10px);
    border: 2px solid #4040ff;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 0 30px rgba(0, 100, 255, 0.7);
    z-index: 200;
}

.summary-content {
    text-align: center;
}

#summary-title {
    color: #60f0ff;
    text-shadow: 0 0 10px #00a0ff;
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.fighter-results {
    display: flex;
    justify-content: space-around;
    margin-bottom: 1.5rem;
}

.player-result, .opponent-result {
    width: 45%;
}

#player-name, #opponent-name {
    color: #60f0ff;
    font-size: 1.5rem;
}

#player-status, #opponent-status {
    font-size: 1.2rem;
    color: #ffcc00;
}

#rewards {
    margin-bottom: 1.5rem;
}

#credits-earned {
    font-size: 1.2rem;
    color: #ffcc00;
}

.summary-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.summary-actions button {
    background: linear-gradient(to bottom, #4040ff, #2020aa);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 0 10px rgba(64, 64, 255, 0.5);
}

.summary-actions button:hover {
    background: linear-gradient(to bottom, #60f0ff, #4040ff);
    box-shadow: 0 0 20px rgba(96, 240, 255, 0.7);
    transform: translateY(-2px);
}