/* attacks.css - Attack system styles */

/* Attack Inventory */
.attack-inventory {
    background: transparent;
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 0;
    margin-top: 0;
    display: none;
    /* Add width constraints */
    width: fit-content;
    min-width: 36px;
    max-width: 200px;
}

.attack-inventory-title {
    text-align: left;
    margin-bottom: 0.5rem;
    /* Ensure title doesn't affect width */
    white-space: nowrap;
}

.attack-inventory-items {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-start;
    /* Add flex wrapping */
    flex-wrap: wrap;
    width: 100%;
    align-items: flex-start;
}

.attack-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Fix dimensions */
    width: 36px;
    height: 36px;
    min-width: 36px;
    max-width: 36px;
    flex: 0 0 36px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: help;
    transition: all 0.2s ease;
}

.attack-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.attack-item.empty {
    background: rgba(255, 255, 255, 0.05);
    cursor: default;
    opacity: 0.5;
}

.attack-item.empty:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.05);
}

.attack-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.attack-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;
}

.attack-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);
}

.attack-item:hover .attack-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-4px);
}

/* Attack Dialog */
.attack-dialog .modal-content {
    max-width: 400px;
}

.attack-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1rem 0;
}

.attack-option {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.attack-option:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(4px);
}

.attack-option-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.attack-option .attack-icon {
    font-size: 1.5rem;
}

.attack-name {
    font-weight: 600;
    color: #ffffff;
}

.attack-description {
    font-size: 0.875rem;
    color: #9ca3af;
}

/* Attack Notifications */
.attack-notification {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(37, 99, 235, 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;
}

.attack-notification.discovery {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.95), rgba(67, 56, 202, 0.95));
}

.attack-notification .notification-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.attack-notification .notification-icon {
    font-size: 2rem;
    animation: icon-bounce 0.5s ease-out;
}

.attack-notification .notification-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.attack-notification .notification-description {
    font-size: 0.875rem;
    opacity: 0.9;
}

.attack-notification.fade-out {
    animation: notification-slide-out 0.3s ease-in forwards;
}

/* Cell Attack Visual */
.cell.attack {
    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;
}

/* Attack icon styling */
.cell.attack .attack-icon {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    animation: attack-reveal 1.5s ease-in-out forwards;
}

@keyframes attack-reveal {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    20% {
        transform: scale(1.1);
        opacity: 1;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0.9);
        opacity: 0;
    }
}

@keyframes number-reveal {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Number count styling */
.cell.attack .number-count {
    position: absolute;
    opacity: 0;
    animation: number-reveal 0.5s ease-in-out forwards;
    animation-delay: 1s; /* Start after attack icon starts fading */
}

/* Specific attack type styles */
.cell.attack-attack1 {
    background: linear-gradient(45deg, rgba(37, 99, 235, 0.1), rgba(37, 99, 235, 0.2));
}

.cell.attack-attack2 {
    background: linear-gradient(45deg, rgba(74, 85, 104, 0.1), rgba(74, 85, 104, 0.2));
}

.cell.attack-attack3 {
    background: linear-gradient(45deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.2));
}

.cell.attack-attack4 {
    background: linear-gradient(45deg, rgba(37, 99, 235, 0.1), rgba(37, 99, 235, 0.2));
}

.cell.attack-attack5 {
    background: linear-gradient(45deg, rgba(37, 99, 235, 0.1), rgba(37, 99, 235, 0.2));
}

/* Hover effects */
.cell.attack:hover {
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.3);
}

/* Discovery animation */
@keyframes attack-discovery {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.cell.attack:not(.collected) {
    animation: attack-discovery 0.3s ease-out forwards;
}

/* Collection animation */
@keyframes attack-collect {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0.8);
        opacity: 0;
    }
}

.cell.attack.collected {
    animation: attack-collect 0.3s ease-out forwards;
}

/* Theme-specific adjustments */
.theme-light .cell.attack {
    background: rgba(37, 99, 235, 0.05);
}

.theme-light .cell.attack:hover {
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.2);
}

.attack-sparkle {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, transparent 70%);
    animation: sparkle 1s ease-out forwards;
    pointer-events: none;
}

.attack-effect-overlay.flashBomb {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ffffff;
    opacity: 0;
    pointer-events: none;
    z-index: 1000;
    animation: flash-bang var(--total-time) ease-out forwards;
}

@keyframes flash-bang {
    0% {
        opacity: 0;
    }
    2% {  /* Quick initial flash */
        opacity: 1;
    }
    /* Hold white for specified duration */
    calc(var(--white-time) / var(--total-time) * 100%) {
        opacity: 1;
    }
    /* Fade out over remaining time */
    100% {
        opacity: 0;
    }
}

@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 icon-bounce {
    0% { transform: scale(0.5); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes sparkle {
    0% {
        opacity: 1;
        transform: scale(0);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.2);
    }
    100% {
        opacity: 0;
        transform: scale(1.5);
    }
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
    .attack-inventory {
        padding: 0.5rem;
    }

    .attack-item {
        width: 32px;
        height: 32px;
    }

    .attack-icon {
        font-size: 1rem;
    }

    .attack-notification {
        width: 90%;
        padding: 0.75rem 1rem;
    }
}

@keyframes parachute-descend {
    0% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: 
            translate(
                calc(-50% + var(--drift-x)), 
                calc(-50% + var(--drift-y))
            )
            scale(0.2)
            rotate(var(--rotation));
        opacity: 0.8;
    }
}

.parachute-sprite svg path:first-child {
    transform-origin: center top;
    animation: parachute-swing 3s ease-in-out infinite;
}

.parachute-explosion {
    z-index: 1001;
}

@keyframes parachute-swing {
    0%, 100% { 
        transform: rotate(calc(-5deg + var(--rotation) * 0.5)); 
    }
    50% { 
        transform: rotate(calc(5deg + var(--rotation) * 0.5)); 
    }
}

.parachute-sprite {
    position: absolute;
    pointer-events: none;
    z-index: 1000;
    transform-origin: center center;
    transform: translate(-50%, -50%);
    animation: parachute-descend 2s ease-out forwards;
}

/* Shadow effect that grows as parachute descends */
.parachute-sprite::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 50%;
    width: 20px;
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    transform: translateX(-50%);
    filter: blur(2px);
    opacity: 0;
    animation: shadow-grow 2s ease-out forwards;
}

@keyframes shadow-grow {
    0% {
        transform: translateX(-50%) scale(0.5);
        opacity: 0;
    }
    100% {
        transform: translateX(-50%) scale(2);
        opacity: 0.5;
    }
}