/* 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;
}

/* Burned-in icon - always visible underneath */
.cell.attack .attack-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.attack .attack-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.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;
    pointer-events: none;
    z-index: 2;
}

/* Collected attack cell - sunken/flat appearance */
.cell.attack.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.attack .attack-burn {
    opacity: 0.2;
    filter: grayscale(1) brightness(0.6) contrast(1.1);
}

/* Light theme collected cells */
.theme-light .cell.attack.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);
}

@keyframes attack-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;
    }
}

/* Attack inventory item added animation */
.attack-item.just-added {
    animation: inventory-item-added 0.4s ease-out, glitter-sparkle 0.5s ease-in-out;
}

@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; }
}

@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(255, 100, 100, 0.5); }
}
/* ========================================
   MOBILE PORTRAIT - 2x3 ATTACK GRID
   ======================================== */

@media (max-width: 768px) and (orientation: portrait) {
    .attack-inventory {
        padding: 0.25rem;
    }
    
    .attack-inventory-items {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(2, 1fr);
        gap: 0.25rem;
        width: auto;
    }
    
    .attack-item {
        width: 28px;
        height: 28px;
        min-width: 28px;
        max-width: 28px;
        flex: none;
    }
}

@media (max-width: 380px) and (orientation: portrait) {
    .attack-inventory-items {
        gap: 0.2rem;
    }
    
    .attack-item {
        width: 24px;
        height: 24px;
        min-width: 24px;
        max-width: 24px;
    }
}

/* Disabled attack slots (beyond player's configured max) */
.attack-item.disabled {
    background: rgba(50, 50, 60, 0.3);
    cursor: not-allowed;
    opacity: 0.35;
    border: 1px dashed rgba(100, 100, 120, 0.3);
}

.attack-item.disabled:hover {
    transform: none;
    background: rgba(50, 50, 60, 0.3);
}

.attack-item.disabled .attack-icon {
    color: rgba(120, 120, 140, 0.5);
    font-size: 0.9rem;
}

/* Light theme */
.theme-light .attack-item.disabled {
    background: rgba(200, 200, 210, 0.3);
    border-color: rgba(150, 150, 170, 0.3);
}

.theme-light .attack-item.disabled .attack-icon {
    color: rgba(100, 100, 120, 0.4);
}

/* ========================================
   PARACHUTE ATTACK ANIMATION
   ======================================== */

.parachute-sprite {
    animation: parachuteDrop 3s ease-out forwards;
}

@keyframes parachuteDrop {
    0% {
        transform: scale(2.5) translate(0, 0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    100% {
        transform: scale(0.6) translate(var(--drift-x, 0), var(--drift-y, 50px)) rotate(var(--rotation, 0deg));
        opacity: 1;
    }
}

/* Parachute explosion on landing */
.parachute-explosion {
    animation: explosionFlash 0.7s ease-out forwards;
}

@keyframes explosionFlash {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* ========================================
   FLASH BOMB EFFECT
   ======================================== */

.attack-effect-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.attack-effect-overlay.flashBomb {
    background: white;
    animation: flashBomb-effect var(--total-time) ease-out forwards;
}

@keyframes flashBomb-effect {
    0% {
        opacity: 0;
    }
    5% {
        opacity: 1;
        background: white;
    }
    50% {
        opacity: 1;
        background: white;
    }
    100% {
        opacity: 0;
        background: rgba(255, 255, 255, 0.3);
    }
}
