/* ============================================
   MONSTER HUNTER RPG - Système de Combat
   ============================================ */

/* ============================================
   ÉCRAN DE COMBAT
   ============================================ */

.combat-screen {
    padding: 0 !important;
    min-height: 100vh;
    justify-content: flex-start !important;
}

.combat-container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #0a0a15 0%, #151530 50%, #0a0a15 100%);
    position: relative;
    overflow: hidden;
}

/* Fond animé du combat */
.combat-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
}

.combat-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(255, 0, 100, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 80% 20%, rgba(0, 200, 255, 0.1) 0%, transparent 40%);
}

/* Particules de combat */
.combat-particles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
}

.combat-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--neon-cyan);
    border-radius: 50%;
    animation: floatParticle 8s linear infinite;
}

@keyframes floatParticle {
    0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    10% { opacity: 0.6; }
    90% { opacity: 0.6; }
    100% { transform: translateY(-100px) rotate(360deg); opacity: 0; }
}

/* ============================================
   BARRES DE VIE COMBATTANTS
   ============================================ */

.combat-hud {
    display: flex;
    justify-content: space-between;
    padding: 20px 30px;
    position: relative;
    z-index: 10;
}

.combatant-info {
    width: 300px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--neon-cyan);
    padding: 15px;
    clip-path: polygon(0 0, calc(100% - 15px) 0, 100% 15px, 100% 100%, 0 100%);
}

.combatant-info.enemy {
    border-color: var(--neon-red);
    clip-path: polygon(15px 0, 100% 0, 100% 100%, 0 100%, 0 15px);
}

.combatant-name {
    font-family: 'Orbitron', monospace;
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 5px;
}

.combatant-level {
    font-size: 0.8rem;
    color: var(--neon-yellow);
    margin-bottom: 10px;
}

.combatant-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.combat-bar {
    height: 22px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.combat-bar-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.combat-bar.hp .combat-bar-fill {
    background: linear-gradient(90deg, #cc0000, #ff3333);
    box-shadow: inset 0 0 10px rgba(255, 100, 100, 0.5);
}

.combat-bar.mp .combat-bar-fill {
    background: linear-gradient(90deg, #0033cc, #3366ff);
    box-shadow: inset 0 0 10px rgba(100, 150, 255, 0.5);
}

.combat-bar-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Orbitron', monospace;
    font-size: 0.75rem;
    color: white;
    text-shadow: 1px 1px 2px black;
}

/* Effet de dégâts sur la barre */
.combat-bar.damage .combat-bar-fill {
    animation: barDamage 0.3s ease;
}

@keyframes barDamage {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(2); }
}

/* ============================================
   ZONE DE COMBAT (ARÈNE)
   ============================================ */

.combat-arena {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 50px;
    position: relative;
    z-index: 5;
}

/* Sol de l'arène */
.arena-floor {
    position: absolute;
    bottom: 150px;
    left: 0;
    right: 0;
    height: 200px;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(100, 50, 150, 0.1) 30%,
        rgba(50, 0, 100, 0.3) 100%
    );
    transform: perspective(500px) rotateX(60deg);
    transform-origin: bottom;
}

/* ============================================
   SPRITES DES COMBATTANTS
   ============================================ */

.combatant-sprite {
    width: 150px;
    height: 200px;
    position: relative;
    image-rendering: pixelated;
    transition: transform 0.1s ease;
}

.combatant-sprite.player {
    animation: playerIdle 1s ease-in-out infinite;
}

.combatant-sprite.enemy {
    animation: enemyIdle 1.2s ease-in-out infinite;
}

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

@keyframes enemyIdle {
    0%, 100% { transform: translateY(0) scaleX(-1); }
    50% { transform: translateY(-8px) scaleX(-1); }
}

/* Animation d'attaque */
.combatant-sprite.attacking {
    animation: attackAnim 0.3s ease-out;
}

@keyframes attackAnim {
    0% { transform: translateX(0); }
    50% { transform: translateX(30px); }
    100% { transform: translateX(0); }
}

.combatant-sprite.enemy.attacking {
    animation: attackAnimEnemy 0.3s ease-out;
}

@keyframes attackAnimEnemy {
    0% { transform: translateX(0) scaleX(-1); }
    50% { transform: translateX(-30px) scaleX(-1); }
    100% { transform: translateX(0) scaleX(-1); }
}

/* Animation de dégâts */
.combatant-sprite.hit {
    animation: hitAnim 0.4s ease;
}

@keyframes hitAnim {
    0%, 100% { filter: brightness(1); transform: translateX(0); }
    25% { filter: brightness(3) sepia(1) saturate(5) hue-rotate(-30deg); transform: translateX(-10px); }
    50% { filter: brightness(1.5); transform: translateX(5px); }
    75% { filter: brightness(2) sepia(0.5) saturate(3); transform: translateX(-5px); }
}

.combatant-sprite.enemy.hit {
    animation: hitAnimEnemy 0.4s ease;
}

@keyframes hitAnimEnemy {
    0%, 100% { filter: brightness(1); transform: scaleX(-1) translateX(0); }
    25% { filter: brightness(3) sepia(1) saturate(5) hue-rotate(-30deg); transform: scaleX(-1) translateX(10px); }
    50% { filter: brightness(1.5); transform: scaleX(-1) translateX(-5px); }
    75% { filter: brightness(2) sepia(0.5) saturate(3); transform: scaleX(-1) translateX(5px); }
}

/* Animation de mort */
.combatant-sprite.dead {
    animation: deathAnim 1s ease-out forwards;
}

@keyframes deathAnim {
    0% { opacity: 1; filter: brightness(1); }
    30% { filter: brightness(3) saturate(0); }
    100% { opacity: 0; transform: translateY(50px) scale(0.8); filter: brightness(0); }
}

/* ============================================
   INDICATEURS DE DÉGÂTS
   ============================================ */

.damage-indicator {
    position: absolute;
    font-family: 'Orbitron', monospace;
    font-weight: 900;
    font-size: 1.5rem;
    pointer-events: none;
    animation: damageFloat 1s ease-out forwards;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    z-index: 100;
}

.damage-indicator.physical {
    color: #ff4444;
}

.damage-indicator.magic {
    color: #44aaff;
}

.damage-indicator.heal {
    color: #44ff44;
}

.damage-indicator.critical {
    font-size: 2rem;
    color: #ffaa00;
    animation: criticalFloat 1s ease-out forwards;
}

@keyframes damageFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    20% {
        transform: translateY(-20px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(-80px) scale(0.8);
    }
}

@keyframes criticalFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(-5deg);
    }
    20% {
        transform: translateY(-30px) scale(1.5) rotate(5deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(0.6) rotate(-10deg);
    }
}

/* ============================================
   BARRE D'ACTIONS / SORTS
   ============================================ */

.combat-actions {
    position: relative;
    z-index: 10;
    padding: 20px 30px 30px;
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.8));
}

.action-bar {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.action-btn {
    width: 80px;
    height: 80px;
    background: rgba(0, 0, 0, 0.6);
    border: 3px solid var(--neon-cyan);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.action-btn:hover:not(:disabled) {
    border-color: var(--neon-magenta);
    transform: translateY(-5px);
    box-shadow: var(--glow-magenta);
}

.action-btn:active:not(:disabled) {
    transform: translateY(-2px);
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.action-btn.basic-attack {
    border-color: var(--neon-orange);
}

.action-btn.basic-attack:hover:not(:disabled) {
    border-color: var(--neon-yellow);
    box-shadow: 0 0 15px var(--neon-orange);
}

.action-icon {
    font-size: 2rem;
    margin-bottom: 5px;
}

.action-key {
    font-family: 'Orbitron', monospace;
    font-size: 0.7rem;
    color: var(--text-dim);
}

.action-name {
    font-size: 0.7rem;
    color: var(--text-light);
    text-align: center;
}

/* Cooldown overlay */
.cooldown-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', monospace;
    font-size: 1.5rem;
    color: var(--text-light);
}

.cooldown-sweep {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: conic-gradient(
        rgba(0, 0, 0, 0.8) var(--cooldown-percent, 100%),
        transparent var(--cooldown-percent, 100%)
    );
}

/* Coût en mana */
.mana-cost {
    position: absolute;
    bottom: 5px;
    right: 5px;
    font-family: 'Orbitron', monospace;
    font-size: 0.65rem;
    color: #66aaff;
    background: rgba(0, 0, 50, 0.8);
    padding: 2px 5px;
    border-radius: 3px;
}

/* Message de combat */
.combat-message {
    text-align: center;
    font-size: 1.1rem;
    color: var(--text-light);
    min-height: 24px;
}

/* ============================================
   EFFETS DE SORTS
   ============================================ */

.spell-effect {
    position: absolute;
    pointer-events: none;
    z-index: 50;
}

/* Boule de feu */
.spell-fireball {
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, #ffaa00, #ff4400, transparent);
    border-radius: 50%;
    box-shadow: 0 0 30px #ff4400, 0 0 60px #ff8800;
    animation: fireballMove 0.5s ease-out forwards;
}

@keyframes fireballMove {
    0% { transform: translateX(0) scale(0.5); }
    50% { transform: translateX(200px) scale(1.2); }
    100% { transform: translateX(350px) scale(0.3); opacity: 0; }
}

/* Éclair */
.spell-lightning {
    width: 400px;
    height: 100px;
    background: linear-gradient(90deg,
        transparent,
        rgba(100, 200, 255, 0.8) 20%,
        white 50%,
        rgba(100, 200, 255, 0.8) 80%,
        transparent
    );
    animation: lightningFlash 0.3s ease-out forwards;
}

@keyframes lightningFlash {
    0% { opacity: 0; transform: scaleY(0.1); }
    20% { opacity: 1; transform: scaleY(1); }
    100% { opacity: 0; transform: scaleY(0.1); }
}

/* Soin */
.spell-heal {
    width: 100px;
    height: 150px;
    background: linear-gradient(180deg, transparent, rgba(100, 255, 100, 0.5), transparent);
    animation: healRise 1s ease-out forwards;
}

@keyframes healRise {
    0% { opacity: 0; transform: translateY(50px); }
    30% { opacity: 1; }
    100% { opacity: 0; transform: translateY(-100px); }
}

/* ============================================
   ÉCRANS DE FIN DE COMBAT
   ============================================ */

.combat-result-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease;
}

.combat-result-overlay.active {
    opacity: 1;
    visibility: visible;
}

.result-title {
    font-family: 'Orbitron', monospace;
    font-size: 3rem;
    margin-bottom: 30px;
    letter-spacing: 0.2em;
    animation: resultPulse 1s ease-in-out infinite;
}

.result-title.victory {
    color: var(--neon-green);
    text-shadow: 0 0 20px var(--neon-green), 0 0 40px var(--neon-green);
}

.result-title.defeat {
    color: var(--neon-red);
    text-shadow: 0 0 20px var(--neon-red), 0 0 40px var(--neon-red);
}

@keyframes resultPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.result-content {
    background: var(--bg-card);
    border: 2px solid var(--neon-cyan);
    padding: 30px 50px;
    text-align: center;
    min-width: 400px;
}

.result-xp {
    font-family: 'Orbitron', monospace;
    font-size: 1.5rem;
    color: var(--neon-yellow);
    margin-bottom: 20px;
}

.result-loot {
    margin-bottom: 25px;
}

.result-loot-title {
    font-size: 1rem;
    color: var(--text-dim);
    margin-bottom: 15px;
    letter-spacing: 0.2em;
}

.result-loot-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.loot-item {
    padding: 8px 20px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 1rem;
}

.loot-item.common { color: var(--rarity-common); border-color: var(--rarity-common); }
.loot-item.uncommon { color: var(--rarity-uncommon); border-color: var(--rarity-uncommon); }
.loot-item.rare { color: var(--rarity-rare); border-color: var(--rarity-rare); }
.loot-item.epic { color: var(--rarity-epic); border-color: var(--rarity-epic); }
.loot-item.legendary { color: var(--rarity-legendary); border-color: var(--rarity-legendary); }

.result-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

/* Level up notification */
.level-up-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Orbitron', monospace;
    font-size: 2.5rem;
    color: var(--neon-yellow);
    text-shadow: 0 0 30px var(--neon-yellow), 0 0 60px var(--neon-yellow);
    animation: levelUpAnim 2s ease-out forwards;
    z-index: 300;
    pointer-events: none;
}

@keyframes levelUpAnim {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); }
}

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

@media (max-width: 768px) {
    .combat-hud {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }

    .combatant-info {
        width: 100%;
        padding: 10px;
    }

    .combat-arena {
        padding: 0 20px;
    }

    .combatant-sprite {
        width: 100px;
        height: 140px;
    }

    .action-btn {
        width: 60px;
        height: 60px;
    }

    .action-icon {
        font-size: 1.5rem;
    }

    .result-content {
        min-width: auto;
        width: 90%;
        padding: 20px;
    }
}
