/* Grid View Styles */
.entity-list.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1rem;
    align-items: start;
    padding: 0.5rem;
    /* Ensure padding inside container */
}

/* Ensure expanded corpse container spans full width */
.corpse-container {
    display: contents;
    /* Allows the card to be a direct grid child when not expanded */
}

.corpse-container.expanded {
    display: flex;
    flex-direction: column;
    grid-column: 1 / -1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--game-border-color);
    padding: 1rem;
    gap: 1rem;
}

/* When expanded, the card inside should probably behave differently or just be the header */
.corpse-container.expanded .entity-card.grid-card {
    width: 150px;
    /* Fixed size for the header icon when expanded */
    margin: 0 auto;
    aspect-ratio: 1;
}

.entity-card.grid-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    padding: 0;
    /* Remove padding to let image fill */
    text-align: center;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--game-border-color);
    border-radius: 0;
    /* User requested NO radius */
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    height: auto;
    min-width: 0;
    width: 100%;
}

.entity-card.grid-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    border-color: var(--game-text-highlight);
    z-index: 5;
}

.grid-card .entity-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.grid-card .entity-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Fill the square 1:1 */
}

/* Overlay for text or stats on hover could be improved, 
   but for now we keep the tooltip */

.grid-card .grid-quantity {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 0.75rem;
    padding: 2px 6px;
    font-weight: bold;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

.grid-corpse-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    height: 100%;
    width: 100%;
}

/* Specific Border Colors for Grid Cards */
.enemy-card.grid-card {
    border-color: rgba(244, 67, 54, 0.5);
}

.enemy-card.grid-card:hover {
    border-color: rgba(244, 67, 54, 1);
}

.corpse-card.grid-card {
    border-color: rgba(156, 39, 176, 0.5);
}

.corpse-card.grid-card:hover {
    border-color: rgba(156, 39, 176, 1);
}

.npc-card.grid-card {
    border-color: rgba(107, 185, 240, 0.5);
}

.npc-card.grid-card:hover {
    border-color: rgba(107, 185, 240, 1);
}

.item-card.grid-card {
    border-color: rgba(76, 175, 80, 0.5);
}

.item-card.grid-card:hover {
    border-color: rgba(76, 175, 80, 1);
}

/* Styles for the expanded corpse details (loot list) */
.corpse-details {
    width: 100%;
    background: var(--game-bg-app);
    border: 1px solid var(--game-border-color);
    padding: 1rem;
    margin-top: 1rem;
}

.corpse-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--game-border-color);
    padding-bottom: 0.5rem;
}

.corpse-details-header h4 {
    margin: 0;
    color: var(--game-text-highlight);
}

.corpse-items-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}