/* power-ups.css - In-game power-up styles only */

/* Power-Ups Container */
.power-ups-inventory {
    border-radius: 12px;
    padding: 0;
    margin-top: 0;
    display: none;
}

.power-ups-inventory-title {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    text-align: left;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.power-ups-inventory-items {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-start;
}

/* In-game power-up item */
.power-up-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.power-up-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.power-up-item.empty {
    background: rgba(255, 255, 255, 0.05);
    cursor: default;
    opacity: 0.5;
}

.power-up-item.empty:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.05);
}

/* Active/Selected power-up state */
.power-up-item.active {
    background: rgba(77, 255, 121, 0.3);
    border: 2px solid #4dff79;
    box-shadow:
        0 0 10px rgba(77, 255, 121, 0.5),
        0 0 20px rgba(77, 255, 121, 0.3),
        inset 0 0 10px rgba(77, 255, 121, 0.2);
    animation: power-up-selected-pulse 1.5s ease-in-out infinite;
}

.power-up-item.active:hover {
    background: rgba(77, 255, 121, 0.4);
    box-shadow:
        0 0 15px rgba(77, 255, 121, 0.6),
        0 0 25px rgba(77, 255, 121, 0.4),
        inset 0 0 10px rgba(77, 255, 121, 0.3);
}

@keyframes power-up-selected-pulse {
    0%, 100% {
        box-shadow:
            0 0 10px rgba(77, 255, 121, 0.5),
            0 0 20px rgba(77, 255, 121, 0.3),
            inset 0 0 10px rgba(77, 255, 121, 0.2);
    }
    50% {
        box-shadow:
            0 0 15px rgba(77, 255, 121, 0.7),
            0 0 30px rgba(77, 255, 121, 0.5),
            inset 0 0 15px rgba(77, 255, 121, 0.3);
    }
}

.power-up-item::after {
    content: attr(data-count);
    position: absolute;
    bottom: -4px;
    right: -4px;
    background: rgba(37, 99, 235, 0.9);
    color: white;
    font-size: 0.625rem;
    padding: 2px 4px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
}

.power-up-item.empty::after {
    display: none;
}

/* In-game power-up cell styles */
.cell.power-up {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    background: rgba(37, 99, 235, 0.1);
    transition: all 0.3s ease;
}

/* Burned-in icon - always visible underneath */
.cell.power-up .power-up-burn {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.25;
    transform: scale(1.1);
    filter: grayscale(1) brightness(0.7) contrast(1.2);
    z-index: 1;
}

/* Fade out burn icon before showing neighbor count */
.cell.power-up .power-up-burn.fade-out {
    animation: burn-fade-out 1s ease-out forwards;
}

@keyframes burn-fade-out {
    from { opacity: 0.25; }
    to { opacity: 0; }
}

/* Animated icon - plays on top then disappears */
.cell.power-up .power-up-icon {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    animation: power-up-reveal 1.5s ease-in-out forwards;
    pointer-events: none;
    z-index: 2;
}

/* Collected power-up cell - sunken/flat appearance */
.cell.power-up.collected {
    background: linear-gradient(180deg,
        rgba(35, 48, 72, 0.95) 0%,
        rgba(30, 42, 65, 0.95) 100%);
    border-color: rgba(60, 85, 130, 0.3);
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 -1px 0 rgba(255, 255, 255, 0.05);
    cursor: default;
}

/* Light theme - burn icon */
.theme-light .cell.power-up .power-up-burn {
    opacity: 0.2;
    filter: grayscale(1) brightness(0.6) contrast(1.1);
}

/* Light theme collected cells */
.theme-light .cell.power-up.collected {
    background: linear-gradient(180deg,
        rgba(100, 130, 175, 0.95) 0%,
        rgba(110, 140, 185, 0.95) 100%);
    border-color: rgba(60, 90, 140, 0.3);
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.15),
        inset 0 -1px 0 rgba(255, 255, 255, 0.1);
}

/* Animations */
@keyframes power-up-reveal {
    0% {
        transform: scale(0.5);
        opacity: 0;
        filter: brightness(1);
    }
    15% {
        transform: scale(1.8);
        opacity: 1;
        filter: brightness(1.5);
    }
    30% {
        transform: scale(1.4);
        filter: brightness(1.2);
    }
    50%, 75% {
        transform: scale(1.5);
        opacity: 1;
        filter: brightness(1);
    }
    100% {
        transform: scale(0.9);
        opacity: 0;
        visibility: hidden;
    }
}

/* Inventory item added animation */
@keyframes inventory-item-added {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    30% {
        transform: scale(1.3);
        opacity: 1;
    }
    50% {
        transform: scale(0.95);
    }
    70% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Glitter sparkle effect */
@keyframes glitter-sparkle {
    0%, 100% {
        box-shadow: 0 0 4px rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 12px rgba(255, 255, 255, 0.8), 0 0 20px rgba(100, 200, 255, 0.5);
    }
}

.power-up-item.just-added {
    animation: inventory-item-added 0.4s ease-out, glitter-sparkle 0.5s ease-in-out;
}

/* Tooltips */
.power-up-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    font-size: 0.75rem;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
}

.power-up-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(0, 0, 0, 0.9);
}

.power-up-item:hover .power-up-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-4px);
}

/* Notifications */
.power-up-notification {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.95), rgba(67, 56, 202, 0.95));
    backdrop-filter: blur(8px);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    color: white;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    animation: notification-slide-in 0.3s ease-out forwards;
}

.power-up-notification.fade-out {
    animation: notification-slide-out 0.3s ease-in forwards;
}

/* Effects */
.power-up-sparkle {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.8) 0%, transparent 70%);
    animation: sparkle 1s ease-out forwards;
    pointer-events: none;
}

/* Defense Turret styles */
.defense-turret-overlay {
    transform-origin: center center;
    transition: opacity 0.3s ease-out;
}

.defense-turret-overlay.defense-turret-clear {
    animation: turret-clear-animation 0.5s ease-out forwards;
}

.defense-turret-overlay svg {
    width: 100%;
    height: 100%;
}

.turret-base-layer,
.turret-weapon-layer {
    will-change: transform;
}

.turret-weapon-layer {
    transition: transform 0.1s linear;
}

/* Theme light adjustments */
.theme-light .power-ups-inventory-title {
    color: rgba(0, 0, 0, 0.8);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.1);
}

.theme-light .power-up-item {
    background: rgba(0, 0, 0, 0.1);
}

.theme-light .power-up-item:hover {
    background: rgba(0, 0, 0, 0.15);
}

.theme-light .power-up-item.empty {
    background: rgba(0, 0, 0, 0.05);
}

.theme-light .power-up-item.active {
    background: rgba(37, 99, 235, 0.2);
}

.theme-light .power-up-item.active:hover {
    background: rgba(37, 99, 235, 0.3);
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
    .power-ups-inventory {
        padding: 0.5rem;
    }

    .power-up-item {
        width: 32px;
        height: 32px;
    }

    .power-up-icon {
        font-size: 1rem;
    }
    
    .power-up-item::after {
        font-size: 0.5rem;
        padding: 1px 3px;
        min-width: 14px;
    }
}

/* Animations */
@keyframes notification-slide-in {
    0% { 
        opacity: 0;
        transform: translate(-50%, -20px);
    }
    100% { 
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes notification-slide-out {
    0% { 
        opacity: 1;
        transform: translate(-50%, 0);
    }
    100% { 
        opacity: 0;
        transform: translate(-50%, -20px);
    }
}

@keyframes sparkle {
    0% {
        opacity: 1;
        transform: scale(0);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.2);
    }
    100% {
        opacity: 0;
        transform: scale(1.5);
    }
}

@keyframes turret-clear-animation {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}