/* ============================================
   VOIDBORNE LEGACY - COMBAT STYLES
   Arcane Ink Productions
   ============================================ */

/* ==========================================
   COMBAT UI OVERLAY
   ========================================== */
#combat-ui {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, rgba(20, 10, 30, 0.9) 0%, rgba(5, 0, 10, 0.98) 100%);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

#combat-ui::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 80% 20%, rgba(220, 38, 38, 0.1) 0%, transparent 40%);
    pointer-events: none;
}

#combat-ui.active {
    opacity: 1;
    pointer-events: auto;
}

/* ==========================================
   COMBAT CONTAINER
   ========================================== */
.combat-container {
    width: 90%;
    max-width: 850px;
    max-height: 90vh;
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(18, 12, 28, 0.98) 0%, rgba(8, 5, 15, 0.99) 100%);
    border: 2px solid transparent;
    border-image: linear-gradient(180deg, var(--arcane-purple), var(--border-dark), var(--blood-crimson)) 1;
    border-radius: 0;
    position: relative;
    box-shadow: 
        0 0 40px rgba(139, 92, 246, 0.3),
        0 0 60px rgba(0, 0, 0, 0.8),
        inset 0 0 60px rgba(0, 0, 0, 0.5);
}

.combat-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--arcane-purple), var(--gold-ancient), var(--arcane-purple), transparent);
}

.combat-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--blood-crimson), var(--gold-ancient), var(--blood-crimson), transparent);
}

/* ==========================================
   ENEMY DISPLAY
   ========================================== */
.combat-enemy {
    padding: 24px 30px;
    text-align: center;
    background: 
        radial-gradient(ellipse at 50% 0%, rgba(139, 92, 246, 0.15) 0%, transparent 60%),
        linear-gradient(180deg, rgba(30, 20, 45, 0.8) 0%, transparent 100%);
    border-bottom: 2px solid var(--border-dark);
    position: relative;
}

.combat-enemy::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
    pointer-events: none;
    animation: enemyAura 4s ease-in-out infinite;
}

@keyframes enemyAura {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.8; }
}

.combat-enemy-icon {
    font-size: 4.5rem;
    display: block;
    margin-bottom: 12px;
    filter: drop-shadow(0 8px 20px rgba(0,0,0,0.8));
    transition: transform 0.1s ease;
    position: relative;
    z-index: 2;
}

.combat-enemy-icon.damage-flash {
    animation: damageShake 0.3s ease, enemyHurt 0.3s ease;
}

@keyframes damageShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-15px) rotate(-5deg); }
    40% { transform: translateX(15px) rotate(5deg); }
    60% { transform: translateX(-10px) rotate(-3deg); }
    80% { transform: translateX(10px) rotate(3deg); }
}

@keyframes enemyHurt {
    0%, 100% { filter: drop-shadow(0 10px 30px rgba(0,0,0,0.8)); }
    50% { filter: drop-shadow(0 10px 30px rgba(220, 38, 38, 0.8)) brightness(1.5); }
}

.combat-enemy-name {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 4px;
    text-shadow: 0 0 20px rgba(212, 165, 116, 0.3);
    position: relative;
    z-index: 2;
}

.combat-enemy-level {
    font-family: var(--font-ui);
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 12px;
    position: relative;
    z-index: 2;
}

/* Enemy HP Bar */
.combat-enemy-hp-bar {
    width: 60%;
    max-width: 350px;
    margin: 0 auto;
    height: 22px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, rgba(20, 10, 10, 0.9) 100%);
    border: 2px solid #4a1010;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    box-shadow: 
        inset 0 2px 10px rgba(0, 0, 0, 0.8),
        0 0 20px rgba(220, 38, 38, 0.2);
    z-index: 2;
}

.combat-enemy-hp-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
    pointer-events: none;
    z-index: 3;
}

.combat-enemy-hp-fill {
    height: 100%;
    background: linear-gradient(180deg, #dc2626 0%, #991b1b 50%, #7f1d1d 100%);
    transition: width 0.4s ease;
    position: relative;
    box-shadow: 0 0 15px rgba(220, 38, 38, 0.5);
}

.combat-enemy-hp-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.2) 50%, transparent 100%);
    animation: hpShimmer 2s ease-in-out infinite;
}

@keyframes hpShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.combat-enemy-hp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-heading);
    font-size: 0.9375rem;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.9);
    z-index: 4;
    letter-spacing: 0.05em;
}

/* ==========================================
   COMBAT LOG
   ========================================== */
.combat-log {
    height: 100px;
    overflow-y: auto;
    padding: 10px 16px;
    background: linear-gradient(180deg, rgba(8, 5, 15, 0.95) 0%, rgba(12, 8, 20, 0.98) 100%);
    border-bottom: 2px solid var(--border-dark);
    position: relative;
}

.combat-log::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(180deg, rgba(8, 5, 15, 1) 0%, transparent 100%);
    pointer-events: none;
    z-index: 5;
}

.combat-log-entry {
    font-family: var(--font-body);
    font-size: 0.8125rem;
    padding: 5px 0;
    border-bottom: 1px solid rgba(139, 92, 246, 0.1);
    position: relative;
    padding-left: 16px;
}

.combat-log-entry::before {
    content: '›';
    position: absolute;
    left: 0;
    color: var(--arcane-purple);
    opacity: 0.5;
}

.combat-log-entry:last-child {
    border-bottom: none;
}

.combat-log-entry.player { 
    color: #4ade80;
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.3);
}
.combat-log-entry.player::before { color: #4ade80; }

.combat-log-entry.player-crit { 
    color: #fcd34d;
    font-weight: bold;
    text-shadow: 0 0 15px rgba(252, 211, 77, 0.5);
    font-size: 1rem;
}
.combat-log-entry.player-crit::before { content: '⚔'; color: #fcd34d; }

.combat-log-entry.player-magic { 
    color: var(--arcane-glow);
    text-shadow: 0 0 15px var(--arcane-glow);
}
.combat-log-entry.player-magic::before { content: '✦'; color: var(--arcane-glow); }

.combat-log-entry.enemy { 
    color: #f87171;
    text-shadow: 0 0 10px rgba(248, 113, 113, 0.3);
}
.combat-log-entry.enemy::before { color: #f87171; }

.combat-log-entry.system { 
    color: var(--text-muted);
    font-style: italic;
}

.combat-log-entry.victory { 
    color: #fcd34d;
    font-weight: bold;
    font-size: 1.0625rem;
    text-shadow: 0 0 20px rgba(252, 211, 77, 0.6);
}
.combat-log-entry.victory::before { content: '★'; color: #fcd34d; }

.combat-log-entry.defeat { 
    color: #dc2626;
    font-weight: bold;
    text-shadow: 0 0 15px rgba(220, 38, 38, 0.5);
}
.combat-log-entry.defeat::before { content: '✝'; color: #dc2626; }

.combat-log-entry.reward { 
    color: var(--gold-ancient);
    text-shadow: 0 0 10px rgba(212, 165, 116, 0.4);
}
.combat-log-entry.reward::before { content: '◆'; color: var(--gold-ancient); }

.combat-log-entry.loot { 
    color: var(--arcane-glow);
    text-shadow: 0 0 10px var(--arcane-glow);
}
.combat-log-entry.loot::before { content: '✧'; color: var(--arcane-glow); }

.combat-log-entry.heal { 
    color: #4ade80;
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.4);
}
.combat-log-entry.heal::before { content: '+'; color: #4ade80; }

.combat-log-entry.buff { 
    color: #60a5fa;
    text-shadow: 0 0 10px rgba(96, 165, 250, 0.4);
}
.combat-log-entry.buff::before { content: '↑'; color: #60a5fa; }

/* ==========================================
   TURN INDICATOR
   ========================================== */
.combat-turn {
    text-align: center;
    padding: 10px 16px;
    font-family: var(--font-heading);
    font-size: 0.9375rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    border-bottom: 2px solid var(--border-dark);
    position: relative;
}

.combat-turn::before,
.combat-turn::after {
    content: '—';
    margin: 0 20px;
    opacity: 0.3;
}

.combat-turn.player {
    background: linear-gradient(90deg, transparent, rgba(34, 197, 94, 0.15), transparent);
    color: #4ade80;
    text-shadow: 0 0 20px rgba(74, 222, 128, 0.5);
}

.combat-turn.enemy {
    background: linear-gradient(90deg, transparent, rgba(220, 38, 38, 0.15), transparent);
    color: #f87171;
    text-shadow: 0 0 20px rgba(248, 113, 113, 0.5);
    animation: enemyTurnPulse 1s ease-in-out infinite;
}

@keyframes enemyTurnPulse {
    0%, 100% { background: linear-gradient(90deg, transparent, rgba(220, 38, 38, 0.15), transparent); }
    50% { background: linear-gradient(90deg, transparent, rgba(220, 38, 38, 0.25), transparent); }
}

/* ==========================================
   COMBAT ACTIONS
   ========================================== */
.combat-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 14px 20px;
    background: linear-gradient(180deg, rgba(15, 10, 25, 0.9) 0%, rgba(20, 15, 30, 0.95) 100%);
}

.combat-action-btn {
    padding: 14px 10px;
    background: linear-gradient(180deg, rgba(30, 25, 45, 0.9) 0%, rgba(20, 15, 35, 0.95) 100%);
    border: 2px solid var(--border-dark);
    border-radius: 6px;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
    overflow: hidden;
}

.combat-action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--border-dark), transparent);
    transition: background 0.2s ease;
}

.combat-action-btn:hover:not(:disabled) {
    transform: translateY(-4px);
    color: var(--text-primary);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.combat-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.combat-action-btn .action-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    transition: transform 0.2s ease;
}

.combat-action-btn:hover:not(:disabled) .action-icon {
    transform: scale(1.15);
}

/* Attack Button */
.combat-action-btn.attack {
    border-color: rgba(220, 38, 38, 0.3);
}
.combat-action-btn.attack::before {
    background: linear-gradient(90deg, transparent, rgba(220, 38, 38, 0.5), transparent);
}
.combat-action-btn.attack:hover:not(:disabled) {
    border-color: #dc2626;
    background: linear-gradient(180deg, rgba(220, 38, 38, 0.15) 0%, rgba(127, 29, 29, 0.2) 100%);
    box-shadow: 0 10px 30px rgba(220, 38, 38, 0.3);
}
.combat-action-btn.attack:hover:not(:disabled)::before {
    background: linear-gradient(90deg, transparent, #dc2626, transparent);
}

/* Defend Button */
.combat-action-btn.defend {
    border-color: rgba(59, 130, 246, 0.3);
}
.combat-action-btn.defend::before {
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.5), transparent);
}
.combat-action-btn.defend:hover:not(:disabled) {
    border-color: #3b82f6;
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.15) 0%, rgba(29, 78, 216, 0.2) 100%);
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.3);
}
.combat-action-btn.defend:hover:not(:disabled)::before {
    background: linear-gradient(90deg, transparent, #3b82f6, transparent);
}

/* Skill Button */
.combat-action-btn.skill {
    border-color: rgba(139, 92, 246, 0.3);
}
.combat-action-btn.skill::before {
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.5), transparent);
}
.combat-action-btn.skill:hover:not(:disabled) {
    border-color: var(--arcane-purple);
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.15) 0%, rgba(109, 40, 217, 0.2) 100%);
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.3);
}
.combat-action-btn.skill:hover:not(:disabled)::before {
    background: linear-gradient(90deg, transparent, var(--arcane-purple), transparent);
}

/* Flee Button */
.combat-action-btn.flee {
    border-color: rgba(212, 165, 116, 0.3);
}
.combat-action-btn.flee::before {
    background: linear-gradient(90deg, transparent, rgba(212, 165, 116, 0.5), transparent);
}
.combat-action-btn.flee:hover:not(:disabled) {
    border-color: var(--gold-ancient);
    background: linear-gradient(180deg, rgba(212, 165, 116, 0.15) 0%, rgba(180, 120, 60, 0.2) 100%);
    box-shadow: 0 10px 30px rgba(212, 165, 116, 0.3);
}
.combat-action-btn.flee:hover:not(:disabled)::before {
    background: linear-gradient(90deg, transparent, var(--gold-ancient), transparent);
}

/* ==========================================
   COMBAT SKILLS SUBMENU
   ========================================== */
.combat-skills-menu {
    display: none;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(180deg, rgba(30, 20, 50, 0.95) 0%, rgba(20, 15, 35, 0.98) 100%);
    border-top: 2px solid var(--arcane-purple);
    max-height: 150px;
    overflow-y: auto;
}

.combat-skills-menu.active {
    display: grid;
}

.combat-skill-btn {
    padding: 10px 8px;
    background: linear-gradient(180deg, rgba(40, 30, 60, 0.9) 0%, rgba(25, 20, 40, 0.95) 100%);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 4px;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

.combat-skill-btn:hover:not(:disabled) {
    border-color: var(--arcane-purple);
    color: var(--text-primary);
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.2) 0%, rgba(109, 40, 217, 0.15) 100%);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
    transform: translateY(-2px);
}

.combat-skill-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.combat-skill-btn .skill-cost {
    display: block;
    font-size: 0.6875rem;
    color: var(--arcane-glow);
    margin-top: 4px;
    text-shadow: 0 0 10px var(--arcane-glow);
}

/* ==========================================
   DEATH SCREEN
   ========================================== */
#death-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, rgba(30, 0, 0, 0.95) 0%, rgba(5, 0, 0, 0.99) 100%);
    z-index: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease;
}

#death-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 30% 70%, rgba(139, 0, 0, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 70% 30%, rgba(100, 0, 0, 0.15) 0%, transparent 50%);
    pointer-events: none;
    animation: deathAmbient 8s ease-in-out infinite;
}

@keyframes deathAmbient {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

#death-screen.active {
    opacity: 1;
    pointer-events: auto;
}

.death-icon {
    font-size: 8rem;
    margin-bottom: 30px;
    animation: deathPulse 3s ease-in-out infinite;
    filter: drop-shadow(0 0 40px rgba(220, 38, 38, 0.5));
    position: relative;
    z-index: 2;
}

@keyframes deathPulse {
    0%, 100% { opacity: 0.6; transform: scale(1); filter: drop-shadow(0 0 40px rgba(220, 38, 38, 0.5)); }
    50% { opacity: 1; transform: scale(1.1); filter: drop-shadow(0 0 60px rgba(220, 38, 38, 0.8)); }
}

.death-title {
    font-family: var(--font-display);
    font-size: 4rem;
    color: #dc2626;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    margin-bottom: 20px;
    text-shadow: 0 0 50px rgba(220, 38, 38, 0.8);
    position: relative;
    z-index: 2;
}

.death-message {
    font-family: var(--font-body);
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 50px;
    font-style: italic;
    position: relative;
    z-index: 2;
}

.death-btn {
    padding: 18px 50px;
    background: linear-gradient(135deg, #450a0a 0%, #7f1d1d 50%, #450a0a 100%);
    background-size: 200% 100%;
    border: 2px solid #dc2626;
    border-radius: 6px;
    font-family: var(--font-heading);
    font-size: 1.125rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
    animation: deathBtnPulse 2s ease-in-out infinite;
}

@keyframes deathBtnPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(220, 38, 38, 0.3); }
    50% { box-shadow: 0 0 40px rgba(220, 38, 38, 0.6); }
}

.death-btn:hover {
    transform: translateY(-3px);
    background-position: 100% 0;
    box-shadow: 0 0 50px rgba(220, 38, 38, 0.7);
}

/* ==========================================
   DAMAGE & LEVEL EFFECTS
   ========================================== */
.damage-flash {
    animation: damageFlash 0.4s ease;
}

@keyframes damageFlash {
    0%, 100% { filter: brightness(1); }
    25% { filter: brightness(2) sepia(1) hue-rotate(-50deg); }
    50% { filter: brightness(0.8); }
    75% { filter: brightness(1.5) sepia(0.5) hue-rotate(-30deg); }
}

.level-up-flash {
    animation: levelUpFlash 0.8s ease;
}

@keyframes levelUpFlash {
    0%, 100% { 
        text-shadow: 0 0 0 transparent;
        transform: scale(1);
    }
    50% { 
        text-shadow: 0 0 30px var(--gold-ancient), 0 0 60px var(--gold-ancient);
        transform: scale(1.3);
    }
}

/* Floating Damage Numbers */
.damage-number {
    position: fixed;
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: bold;
    color: #dc2626;
    text-shadow: 0 0 10px rgba(220, 38, 38, 0.8), 2px 2px 0 #000;
    pointer-events: none;
    z-index: 700;
    animation: floatUp 1s ease-out forwards;
}

.damage-number.heal {
    color: #4ade80;
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.8), 2px 2px 0 #000;
}

.damage-number.crit {
    font-size: 2.5rem;
    color: #fcd34d;
    text-shadow: 0 0 15px rgba(252, 211, 77, 0.8), 2px 2px 0 #000;
}

@keyframes floatUp {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    50% { opacity: 1; transform: translateY(-30px) scale(1.2); }
    100% { opacity: 0; transform: translateY(-60px) scale(0.8); }
}
