/* public/css/battle-replay.css */

/* --- Layout Containers --- */
.battle-center {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    z-index: 10;
    /* ensure it sits above any particle effects */
}

.battle-summary {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    min-height: 48px;
}

.in-play-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* 4 concise stats per row */
    gap: 4px 8px;
    background: rgba(0, 0, 0, 0.4);
    padding: 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color, #333);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
}

.in-play-stats .stat-label {
    color: #888;
}

.in-play-stats .stat-val {
    color: #fff;
    font-weight: bold;
}

.in-play-stats .stat-delta {
    font-size: 10px;
    margin-left: 2px;
}

/* Delta stack for floating stat/hp changes */
.delta-stack {
    position: absolute;
    right: 8px;
    top: 8px;
    display: flex;
    flex-direction: column-reverse;
    gap: 6px;
    pointer-events: none;
    z-index: 80;
}

.delta-float {
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 12px;
    opacity: 0.95;
    transform: translateY(0);
    animation: floatUp 0.9s ease forwards;
}

.delta-float.delta-up {
    background: rgba(28, 140, 72, 0.85);
}

.delta-float.delta-down {
    background: rgba(200, 40, 40, 0.9);
}

.delta-float.neutral {
    background: rgba(100, 100, 100, 0.9);
}

@keyframes floatUp {
    0% {
        transform: translateY(10px);
        opacity: 0;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }

    100% {
        transform: translateY(-24px);
        opacity: 0;
    }
}

.delta-pos {
    color: #0f0;
}

.delta-neg {
    color: #f00;
}

.replay-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: rgba(10, 10, 14, 0.8);
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color, #444);
    position: sticky;
    top: 12px;
    z-index: 60;
}

.replay-btn-row {
    display: flex;
    gap: 12px;
}

/* --- Button Overrides (Prevent Shift) --- */
.replay-controls .btn,
.replay-controls button {
    min-width: 44px;
    height: 44px;
    padding: 0 14px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    /* Kill layout-breaking animations from global theme */
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease !important;
    transform: none !important;
    margin: 0 !important;
    /* ensure no margin shifts */
}

.replay-controls .btn::before,
.replay-controls .btn::after {
    content: none !important;
    /* remove fancy brackets/decorations that might animate size */
    display: none !important;
}

.replay-controls .btn:hover,
.replay-controls .btn:active,
.replay-controls .btn:focus {
    transform: none !important;
    box-shadow: none !important;
    /* avoid shadow expansion layout triggers if any */
}

.replay-time-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
}

.replay-slider {
    flex: 1;
    accent-color: var(--primary-color, #ffd534);
    cursor: pointer;
}

.replay-round-display {
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    color: var(--primary-color, #ffd534);
    min-width: 100px;
    text-align: center;
}


/* --- Round Cards (Log) --- */
#battle-timeline {
    /* Previously .round-list */
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 420px;
    /* Reduced from 500px to avoid button overlap */
    overflow-y: auto;
    padding-right: 4px;
}

.round-card {
    background: rgba(30, 30, 35, 0.95);
    /* Dark background */
    border: 1px solid #444;
    border-radius: 6px;
    padding: 14px 16px;
    /* Increased padding */
    font-family: 'Oxanium', sans-serif;
    position: relative;
    transition: border-color 0.2s;
    color: #eee;
    /* Light text */
    margin-bottom: 6px;
    min-height: 80px;
    /* Ensure minimum size */
}

/* Ensure buttons have space */
.battle-actions {
    margin-top: 20px;
}

.round-card:hover {
    border-color: #666;
}

.round-card.active {
    border-color: var(--primary-color, #ffd534);
    background: rgba(45, 40, 25, 0.95);
}

.round-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #ccc;
    border-bottom: 1px solid #444;
    padding-bottom: 4px;
}

.round-hp-summary {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #888;
}

.round-damage {
    margin: 4px 0;
    font-size: 13px;
    color: #ddd;
}

.round-events {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.event-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #ccc;
    padding: 2px 0;
}

.event-main {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Event Pills */
.pill {
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: bold;
    text-transform: uppercase;
}

.pill.ab {
    background: #553311;
    color: #ffaa44;
    border: 1px solid #774411;
}

.event-text {
    color: #bdc3c7;
    line-height: 1.4;
}

.ability-name-tag {
    color: #ffd534;
    font-weight: bold;
}

.ev-values {
    font-family: 'JetBrains Mono', monospace;
    color: #aaa;
    margin-left: 4px;
}

/* Result Tags */
.tag-hit {
    color: #ff6b6b;
}

/* Strong overrides to ensure mobile stacking and independent timeline scrolling */
@media (max-width: 900px) {
    .battle-arena {
        grid-template-columns: 1fr !important;
    }

    .fighter-panel {
        padding-bottom: 20px !important;
    }

    .timeline-wrap {
        max-height: calc(100vh - 240px) !important;
        overflow: auto !important;
    }

    .replay-controls {
        position: static !important;
        top: auto !important;
    }
}

.tag-crit {
    color: #ff00ff;
    text-shadow: 0 0 5px rgba(255, 0, 255, 0.5);
}

.tag-evade {
    color: #4deeea;
}

.tag-win {
    color: #ffd534;
}

.tag-loss {
    color: #888;
}

/* Ability Lines */
.round-abilities {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ability-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.02);
    padding: 6px 8px;
    border-radius: 4px;
    color: #e6eef5;
}

/* Small Chips */
.chip {
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 3px;
    text-transform: uppercase;
    font-weight: bold;
}

.chip-owner.my {
    background: #1a3a5e;
    color: #a0cfff;
}

.chip-owner.op {
    background: #5e1a1a;
    color: #ffb3b3;
}

.chip-dmg {
    background: rgba(255, 69, 58, 0.2);
    color: #ff453a;
    border: 1px solid rgba(255, 69, 58, 0.4);
}

.chip-heal {
    background: rgba(48, 209, 88, 0.2);
    color: #30d158;
    border: 1px solid rgba(48, 209, 88, 0.4);
}

.chip-trigger {
    background: #333;
    color: #ccc;
}

.chip-effect {
    background: #222;
    border: 1px solid #444;
    color: #eee;
}

.ability-name {
    font-weight: bold;
    color: #ffd534;
}

.ability-deltas {
    color: #ddd;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
}

.ability-notes {
    color: #888;
    font-style: italic;
    font-size: 11px;
}

/* Extra Counters/Caps */
.counter-chip {
    background: #332b00;
    border: 1px solid #665500;
    color: #ffd534;
    font-size: 9px;
    padding: 1px 3px;
    border-radius: 2px;
    margin-left: 4px;
}

/* Animation Fixes: Isolate specific elements */
@media (prefers-reduced-motion: reduce) {

    .fighter-image-wrapper,
    .stat-tile {
        animation: none !important;
        transition: none !important;
    }
}

/* Stats Deltas on Cards (Absolute) */
.stat-delta-arrow {
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 14px;
    font-weight: bold;
    z-index: 20;
}

.arrow-up {
    color: #0f0;
    content: "↑";
}

.arrow-down {
    color: #f00;
    content: "↓";
}

/* --- Hidden class for simplicity --- */
.hidden {
    display: none !important;
}