

/* VillagerLogBubble Component Styles */
/* Floating text bubbles that appear above villagers for log entries */

.villager-log-bubble {
    /* Positioning & Layout */
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1000;
    pointer-events: none;
    user-select: none;
    
    /* Sizing & Spacing */
    max-width: 200px;
    min-width: 120px;
    padding: 8px 12px;
    margin: 0;
    
    /* Visual Appearance */
    background-color: var(--color-panel-bg, rgba(45, 45, 45, 0.95));
    color: var(--color-text-primary, #ffffff);
    border: 1px solid var(--color-border-light, #555);
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--color-shadow-medium, rgba(0, 0, 0, 0.4));
    backdrop-filter: blur(2px);
    
    /* Typography */
    font-family: 'Arial', sans-serif;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.3;
    text-align: center;
    white-space: pre-wrap;
    word-break: break-word;
    word-wrap: break-word;
    
    /* Initial State - Hidden */
    opacity: 0;
    display: none;
    transform: translateY(0px) scale(0.9);
    
    /* Animations */
    transition: 
        opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        background-color 0.2s ease;
}

/* Visible State */
.villager-log-bubble.visible {
    opacity: 1;
    display: block;
    transform: translateY(-5px) scale(1);
}

/* Fade-in Animation */
.villager-log-bubble.fade-in {
    animation: bubbleFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Fade-out Animation */
.villager-log-bubble.fade-out {
    animation: bubbleFadeOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Floating Animation (optional gentle movement) */
.villager-log-bubble.floating {
    animation: bubbleFloat 3s ease-in-out infinite;
}

/* Keyframe Animations */
@keyframes bubbleFadeIn {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.8);
    }
    50% {
        opacity: 0.8;
        transform: translateY(-2px) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translateY(-5px) scale(1);
    }
}

@keyframes bubbleFadeOut {
    0% {
        opacity: 1;
        transform: translateY(-5px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-15px) scale(0.9);
    }
}

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

/* Speech Bubble Arrow (optional enhancement) */
.villager-log-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    width: 0;
    height: 0;
    border: 5px solid transparent;
    border-top-color: var(--color-border-light, #555);
    z-index: -1;
}

.villager-log-bubble::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -4px;
    width: 0;
    height: 0;
    border: 4px solid transparent;
    border-top-color: var(--color-panel-bg, rgba(45, 45, 45, 0.95));
    z-index: 1;
}

/* Category-based Styling */
.villager-log-bubble[data-category="NEEDS_MOOD"] {
    border-color: var(--color-accent-blue, #87ceeb);
    background-color: rgba(135, 206, 235, 0.1);
}

.villager-log-bubble[data-category="COMBAT_INJURY"] {
    border-color: var(--color-error, #F44336);
    background-color: rgba(244, 67, 54, 0.1);
}

.villager-log-bubble[data-category="WORK_TASK"] {
    border-color: var(--color-accent-green, #228B22);
    background-color: rgba(34, 139, 34, 0.1);
}

.villager-log-bubble[data-category="SOCIAL_AMBIENT"] {
    border-color: var(--color-accent-yellow, #DAA520);
    background-color: rgba(218, 165, 32, 0.1);
}

/* Priority/Importance Variants */
.villager-log-bubble.priority-high {
    border-width: 2px;
    box-shadow: 0 3px 12px var(--color-shadow-heavy, rgba(0, 0, 0, 0.6));
    font-weight: 500;
}

.villager-log-bubble.priority-urgent {
    border-color: var(--color-error, #F44336);
    background-color: rgba(244, 67, 54, 0.15);
    animation: bubbleUrgentPulse 2s ease-in-out infinite;
}

@keyframes bubbleUrgentPulse {
    0%, 100% {
        transform: translateY(-5px) scale(1);
        box-shadow: 0 2px 8px var(--color-shadow-medium, rgba(0, 0, 0, 0.4));
    }
    50% {
        transform: translateY(-5px) scale(1.02);
        box-shadow: 0 4px 16px rgba(244, 67, 54, 0.4);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .villager-log-bubble {
        max-width: 160px;
        min-width: 100px;
        font-size: 11px;
        padding: 6px 10px;
    }
}

@media (max-width: 480px) {
    .villager-log-bubble {
        max-width: 140px;
        min-width: 80px;
        font-size: 10px;
        padding: 5px 8px;
        border-radius: 6px;
    }
    
    .villager-log-bubble::after,
    .villager-log-bubble::before {
        border-width: 4px;
    }
    
    .villager-log-bubble::before {
        border-width: 3px;
        margin-left: -3px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .villager-log-bubble {
        border-width: 2px;
        background-color: rgba(0, 0, 0, 0.9);
        color: #ffffff;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .villager-log-bubble {
        transition: opacity 0.1s ease;
    }
    
    .villager-log-bubble.fade-in {
        animation: none;
        opacity: 1;
        transform: translateY(-5px) scale(1);
    }
    
    .villager-log-bubble.fade-out {
        animation: none;
        opacity: 0;
    }
    
    .villager-log-bubble.floating {
        animation: none;
    }
    
    .villager-log-bubble.priority-urgent {
        animation: none;
    }
}

/* Debug Mode Styles (when enabled) */
.debug-mode .villager-log-bubble {
    border: 2px dashed var(--color-accent-orange, #FF9800);
    background-color: rgba(255, 152, 0, 0.1);
}

.debug-mode .villager-log-bubble::after {
    display: none;
}

.debug-mode .villager-log-bubble::before {
    display: none;
}

/* Performance Optimizations */
.villager-log-bubble {
    /* Enable hardware acceleration for smooth animations */
    will-change: transform, opacity;
    
    /* Optimize text rendering */
    text-rendering: optimizeSpeed;
    
    /* Prevent repaints during animations */
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Cleanup for destroyed bubbles */
.villager-log-bubble.destroyed {
    display: none !important;
    pointer-events: none !important;
}

/* Multiple bubbles positioning adjustment */
.villager-log-bubble + .villager-log-bubble {
    margin-top: 35px;
}

/* Container-relative positioning helper */
.game-container .villager-log-bubble {
    position: absolute;
    /* Ensure bubbles stay within game viewport */
    max-width: min(200px, 25vw);
}

