.equipment-popup, .inventory-popup, .stash-popup {
    position: fixed;
    top: 150px;
    right: 300px;
    width: 320px;
    background-color: rgba(0, 0, 0, 0.9);
    border: 2px solid #333;
    border-radius: 10px;
    z-index: 1000;
    overflow: hidden;
    resize: both;
    min-width: 250px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.stash-popup {
    width: 400px;
    height: 500px;
    max-height: 80vh;
}

.popup-header {
    background-color: #222;
    padding: 8px;
    cursor: move;
    text-align: center;
    font-weight: bold;
    border-bottom: 1px solid #444;
    position: relative;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.popup-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.popup-body {
    padding: 15px;
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    display: block;
    scrollbar-width: thin;
    scrollbar-color: #444 #1a1a1a;
    min-height: 0;
    z-index: 1;
    position: relative;
    padding-bottom: 25px;
}

.popup-body::-webkit-scrollbar {
    width: 12px;
}

.popup-body::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

.popup-body::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
    border: 2px solid #1a1a1a;
}

.popup-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Equipment Grid Styles (Copied/Adapted from stash.html context) */
.raid-equipment-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.equipment-row {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.equipment-slot {
    width: 60px;
    height: 60px;
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    cursor: pointer;
}

.equipment-slot img {
    width: 80%;
    height: 80%;
    object-fit: contain;
}

.equipment-slot.occupied {
    background-color: #2a2a2a;
    border-color: #444;
}

.equipment-slot.empty-placeholder {
    visibility: hidden;
    pointer-events: none;
}

.equipped-item-img {
    width: 90% !important;
    height: 90% !important;
}

.item-amount {
    position: absolute;
    bottom: 2px;
    right: 4px;
    background-color: rgba(0,0,0,0.7);
    color: #fff;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: bold;
    pointer-events: none;
}

/* Inventory Grid Styles */
.raid-inventory-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
}

.inventory-slot {
    aspect-ratio: 1 / 1;
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    cursor: pointer;
    min-width: 45px;
}

.inventory-slot img {
    width: 85%;
    height: 85%;
    object-fit: contain;
}

.inventory-slot:hover {
    background-color: #252525;
}

/* Stash Popup Specific Styles */
.stash-popup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
    padding: 5px;
    min-height: min-content;
}

.stash-popup-item {
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    aspect-ratio: 1/1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    cursor: pointer;
}

.stash-popup-item:hover {
    background-color: #252525;
}

.stash-popup-item img {
    width: 85%;
    height: 85%;
    object-fit: contain;
}

.stash-search-container {
    padding: 10px;
    display: flex;
    gap: 5px;
    background: #111;
    border-bottom: 1px solid #333;
}

.stash-search-input {
    flex-grow: 1;
    background: #222;
    border: 1px solid #444;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
}

/* XP Gain Floating Text */
.xp-gain-float {
    position: fixed;
    color: #00ff00;
    font-weight: bold;
    font-size: 1.2rem;
    pointer-events: none;
    z-index: 2000;
    text-shadow: 1px 1px 2px #000;
    animation: floatUpFade 2s forwards;
}

@keyframes floatUpFade {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(-50px);
        opacity: 0;
    }
}

/* Level Up Popup */
.level-up-popup {
    position: fixed;
    top: 100px;
    right: 20px;
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid #00ff00;
    border-radius: 15px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 2000;
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 255, 0, 0.3);
    animation: slideInRight 0.5s ease-out, fadeOut 0.5s ease-in 4.5s forwards;
}

.level-up-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.level-up-text {
    display: flex;
    flex-direction: column;
}

.level-up-title {
    font-weight: bold;
    color: #00ff00;
    font-size: 1.1rem;
}

.level-up-subtitle {
    font-size: 0.9rem;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}
