/* assets/css/battle.css - Turn-Based Combat Arena & Battle Animations */

.battle-container {
    background: #0f121a;
    border: 2px solid var(--border-gold);
    border-radius: var(--radius-lg);
    box-shadow: 0 0 30px rgba(0,0,0,0.8), inset 0 0 50px rgba(0,0,0,0.6);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ======================================================== */
/* BATTLE HEADER & STATUS */
/* ======================================================== */
.battle-header {
    background: rgba(10, 11, 16, 0.85);
    padding: 10px 20px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.battle-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--primary-gold);
    letter-spacing: 1px;
}

/* ======================================================== */
/* BATTLE ARENA (16:9 RATIO ON DESKTOP) */
/* ======================================================== */
.battle-arena {
    position: relative;
    height: 380px;
    background: radial-gradient(circle at 50% 30%, #1e293b 0%, #090c13 85%);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 20px 40px;
    overflow: hidden;
}

/* Arena Ground Floor */
.battle-floor {
    position: absolute;
    bottom: 0;
    left: -10%;
    width: 120%;
    height: 140px;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 50%, #020617 100%);
    border-top: 2px solid rgba(251, 191, 36, 0.3);
    transform: perspective(400px) rotateX(45deg);
    box-shadow: inset 0 20px 30px rgba(0,0,0,0.8);
    pointer-events: none;
}

/* Combatant Wrappers */
.combatant-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
}

.combatant-status-card {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    min-width: 180px;
    margin-bottom: 14px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.combatant-name {
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.boss-tag {
    background: #dc2626;
    color: #ffffff;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 800;
    letter-spacing: 1px;
    animation: bossPulse 1.5s infinite;
}

@keyframes bossPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.08); }
}

.combatant-bar-box {
    margin-bottom: 4px;
}

.combatant-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.combatant-bar-track {
    width: 100%;
    height: 8px;
    background: #020617;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}

.combatant-bar-fill {
    height: 100%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.combatant-bar-fill.hp-enemy {
    background: linear-gradient(90deg, #ef4444, #f97316);
}

.combatant-sprite-box {
    width: 150px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    filter: drop-shadow(0 15px 20px rgba(0,0,0,0.7));
}

.hero-sprite-anim {
    animation: heroIdleBattle 2.8s ease-in-out infinite;
}

@keyframes heroIdleBattle {
    0%, 100% { transform: translateY(0) scaleX(1); }
    50% { transform: translateY(-5px) scaleX(1.02); }
}

.enemy-sprite-anim {
    animation: enemyFloat 3.2s ease-in-out infinite;
}

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

/* SVGs inside sprite box */
.hero-svg, .enemy-svg {
    width: 100%;
    height: 100%;
}

.boss-svg {
    width: 125%;
    height: 125%;
    filter: drop-shadow(0 0 15px rgba(220, 38, 38, 0.5));
}

/* VS Emblem */
.battle-vs-badge {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 900;
    color: rgba(255,255,255,0.15);
    pointer-events: none;
    letter-spacing: 4px;
}

/* ======================================================== */
/* FLOATING COMBAT NUMBERS & ANIMATIONS */
/* ======================================================== */
.float-combat-text {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-retro);
    font-size: 1.3rem;
    font-weight: 800;
    pointer-events: none;
    z-index: 100;
    animation: floatCombatAnim 1.1s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

@keyframes floatCombatAnim {
    0% {
        opacity: 0;
        transform: translate(-50%, 0) scale(0.6);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -20px) scale(1.3);
    }
    70% {
        opacity: 1;
        transform: translate(-50%, -45px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -65px) scale(0.8);
    }
}

.float-damage {
    color: #ef4444;
    text-shadow: 0 0 8px rgba(0,0,0,0.9), 0 0 4px #ef4444;
}

.float-crit {
    color: #facc15;
    font-size: 1.5rem;
    text-shadow: 0 0 10px #f59e0b, 0 0 5px #000;
}

.float-heal {
    color: #4ade80;
    text-shadow: 0 0 8px rgba(0,0,0,0.9), 0 0 4px #22c55e;
}

.float-shield {
    color: #60a5fa;
    text-shadow: 0 0 8px rgba(0,0,0,0.9), 0 0 4px #3b82f6;
}

/* Screen and sprite shake */
.anim-shake {
    animation: shakeEffect 0.35s ease-in-out;
}

@keyframes shakeEffect {
    0% { transform: translate(0, 0); }
    20% { transform: translate(-8px, 4px); }
    40% { transform: translate(8px, -4px); }
    60% { transform: translate(-5px, 2px); }
    80% { transform: translate(5px, -2px); }
    100% { transform: translate(0, 0); }
}

/* Hit Flashes */
.flash-white {
    filter: brightness(3) !important;
}
.flash-red {
    filter: drop-shadow(0 0 20px #ef4444) brightness(2) !important;
}
.flash-fire {
    filter: drop-shadow(0 0 30px #f97316) brightness(2.2) !important;
}

/* Shield Badge */
.shield-active-badge {
    background: #1e3a8a;
    border: 1px solid #60a5fa;
    color: #93c5fd;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
}

/* ======================================================== */
/* BATTLE COMMANDS & LOG PANEL (DESKTOP FIRST) */
/* ======================================================== */
.battle-controls-panel {
    background: #090c13;
    border-top: 2px solid var(--border-color);
    padding: 16px 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Left: Action Buttons */
.battle-menu-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
}

.battle-primary-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.battle-cmd-btn {
    padding: 12px 14px;
    font-size: 0.95rem;
    font-weight: 700;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
}

.battle-btn-icon {
    font-size: 1.2rem;
}

.battle-btn-run {
    grid-column: 1 / -1;
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}

/* Submenu dropdowns (Skills & Items) */
.battle-submenu {
    background: #131926;
    border: 2px solid var(--border-gold);
    border-radius: var(--radius-sm);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.8);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.battle-sub-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 8px 12px;
}

.battle-sub-btn .badge {
    background: rgba(0,0,0,0.5);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* Right: Combat Log */
.battle-log-wrapper {
    background: #05070a;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    height: 180px;
}

.battle-log-title {
    background: #0d121c;
    padding: 6px 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
}

.battle-log-content {
    flex: 1;
    padding: 10px 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.88rem;
    line-height: 1.4;
}

/* Log Colors */
.log-entry {
    padding: 2px 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.log-time {
    color: #64748b;
    font-size: 0.75rem;
}

.log-player { color: #93c5fd; }
.log-enemy { color: #fca5a5; }
.log-skill { color: #fdba74; }
.log-heal { color: #86efac; }
.log-defend { color: #93c5fd; }
.log-item { color: #c4b5fd; }
.log-boss-dialogue { color: #f87171; font-style: italic; }
.log-victory { color: #facc15; font-weight: 700; }
.log-reward { color: #38bdf8; }
.log-level-up { color: #4ade80; font-weight: 700; }
.log-warning { color: #fb923c; }

/* ======================================================== */
/* MOBILE RESPONSIVENESS */
/* ======================================================== */
@media (max-width: 768px) {
    .battle-arena {
        height: 300px;
        padding: 10px;
    }
    .combatant-status-card {
        min-width: 140px;
        padding: 6px 8px;
    }
    .combatant-sprite-box {
        width: 110px;
        height: 110px;
    }
    .battle-controls-panel {
        grid-template-columns: 1fr;
    }
    .battle-log-wrapper {
        height: 130px;
    }
}
