/* Kampf-Modal */
.battle-content {
    padding: 15px;
    border-radius: 15px;
    border: 5px solid #3b4cca;
}

.battle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.battle-title {
    margin: 0;
    font-size: 1.6rem;
    font-weight: bold;
    color: #3b4cca;
}

.battle-loading,
.battle-error {
    text-align: center;
    padding: 80px 0;
}

/* Arena */
.battle-arena {
    position: relative;
    height: 320px;
    border-radius: 10px;
    overflow: hidden;
    background: linear-gradient(180deg, #87ceeb 0%, #c8ecf7 55%, #8fd16a 55%, #6ab04c 100%);
}

.battle-side {
    position: absolute;
    display: flex;
    align-items: flex-end;
    gap: 15px;
}

.battle-side.opponent {
    top: 15px;
    right: 15px;
    align-items: flex-start;
}

.battle-side.player {
    bottom: 15px;
    left: 15px;
}

.battle-sprite {
    width: 130px;
    height: 130px;
    object-fit: contain;
    image-rendering: pixelated;
}

.battle-side.player .battle-sprite {
    width: 160px;
    height: 160px;
}

.fighter-info {
    min-width: 190px;
    padding: 8px 12px;
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.fighter-name {
    font-weight: bold;
}

.hp-bar {
    height: 10px;
    margin-top: 6px;
    border-radius: 5px;
    background-color: #ddd;
    overflow: hidden;
}

.hp-bar-fill {
    height: 100%;
    transition: width 0.6s ease-out, background-color 0.6s;
}

.hp-high {
    background-color: #4caf50;
}

.hp-medium {
    background-color: #f8d030;
}

.hp-low {
    background-color: #e3350d;
}

.hp-text {
    font-size: 0.8rem;
}

/* Attacken-Buttons */
.battle-moves {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
}

.battle-move-button {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    color: #fff;
    text-align: left;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: transform 0.15s;
}

.battle-move-button:hover:not(:disabled) {
    transform: scale(1.03);
}

.battle-move-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.battle-move-name {
    font-weight: bold;
}

.move-key {
    position: absolute;
    top: 4px;
    right: 8px;
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Kampflog */
.battle-log {
    min-height: 100px;
    margin-top: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    background-color: #222;
    color: #fff;
    font-family: monospace;
}

.battle-log p {
    margin: 2px 0;
}

.battle-log p:not(:first-child) {
    opacity: 0.55;
}

.battle-actions {
    margin-top: 12px;
    text-align: center;
}

/* Animationen */
.battle-sprite.attacking {
    animation: attack-lunge 0.4s ease-in-out;
}

.battle-side.opponent .battle-sprite.attacking {
    animation-name: attack-lunge-opponent;
}

.battle-sprite.hit {
    animation: hit-blink 0.5s steps(2) 2;
}

.battle-sprite.fainted {
    animation: faint 0.8s ease-in forwards;
}

@keyframes attack-lunge {
    50% {
        transform: translate(30px, -20px);
    }
}

@keyframes attack-lunge-opponent {
    50% {
        transform: translate(-30px, 20px);
    }
}

@keyframes hit-blink {
    50% {
        opacity: 0.2;
    }
}

@keyframes faint {
    to {
        transform: translateY(60px);
        opacity: 0;
    }
}

/* Handy */
@media (max-width: 576px) {
    .battle-arena {
        height: 300px;
    }

    .fighter-info {
        min-width: 140px;
        font-size: 0.85rem;
    }

    .battle-sprite {
        width: 90px;
        height: 90px;
    }

    .battle-side.player .battle-sprite {
        width: 110px;
        height: 110px;
    }

    .battle-moves {
        grid-template-columns: 1fr;
    }
}

/* Kampf-Header & Setup */
.battle-header {
    gap: 10px;
}

.battle-record {
    margin-left: auto;
    font-weight: bold;
    color: #3b4cca;
}

.battle-setup h5 {
    margin-top: 10px;
    font-weight: bold;
}

.team-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 260px;
    overflow-y: auto;
}

.team-chip {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100px;
    padding: 6px;
    border: 2px solid #ddd;
    border-radius: 10px;
    background-color: #fff;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}

.team-chip:hover {
    transform: scale(1.04);
}

.team-chip.selected {
    border-color: #3b4cca;
    background-color: #eef0ff;
}

.team-chip img {
    width: 64px;
    height: 64px;
    image-rendering: pixelated;
}

.team-chip-name {
    font-weight: bold;
    font-size: 0.85rem;
    text-align: center;
}

.team-order {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: #3b4cca;
    color: #fff;
    font-size: 0.8rem;
    line-height: 22px;
}

.setup-hint {
    margin-top: 8px;
    font-size: 0.85rem;
    opacity: 0.7;
}

.battle-error-text {
    min-height: 1.2em;
    margin: 6px 0;
    color: #e3350d;
}

.battle-start {
    font-size: 1.1rem;
    padding: 10px 24px;
}

.battle-start:disabled,
#catchButton:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.battle-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* Kämpfer-Info: Status & Team */
.status-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 6px;
    font-size: 0.7rem;
    color: #fff;
}

.status-badge.paralysis {
    background-color: #c9a800;
}

.status-badge.sleep {
    background-color: #888;
}

.status-badge.burn {
    background-color: #e3350d;
}

.status-badge.poison {
    background-color: #a040a0;
}

.fighter-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.team-balls {
    display: flex;
    gap: 3px;
}

.team-ball {
    width: 12px;
    height: 12px;
    border: 1px solid #222;
    border-radius: 50%;
    background: linear-gradient(#e3350d 45%, #222 45% 55%, #fff 55%);
}

.team-ball.fainted {
    filter: grayscale(1);
    opacity: 0.4;
}

/* Fang-Animation */
.battle-sprite.catching {
    animation: catch-wobble 1.5s ease-in-out forwards;
}

@keyframes catch-wobble {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    25% {
        transform: scale(0.2);
        opacity: 0.6;
        filter: brightness(3);
    }
    45%, 85% {
        transform: scale(0.2) rotate(-20deg);
        opacity: 0.6;
    }
    65% {
        transform: scale(0.2) rotate(20deg);
        opacity: 0.6;
    }
    100% {
        transform: scale(0.2);
        opacity: 0.6;
    }
}

@media (max-width: 576px) {
    .battle-header {
        flex-wrap: wrap;
    }

    .battle-title {
        font-size: 1.3rem;
    }

    .battle-record {
        order: 3;
        width: 100%;
        margin-left: 0;
        font-size: 0.85rem;
    }
}
