/* =============================== */
/* ITEM TOOLTIP SYSTEM */
/* Para miniaturas com tooltip */
/* =============================== */

/**
 * ESTRUTURA HTML:
 * <img class="item-thumbnail" 
 *      src="path/to/image.png" 
 *      alt="Item Name"
 *      data-title="Nome do Item"
 *      data-description="Descrição do item aqui">
 */

/* =============================== */
/* THUMBNAIL BASE */
/* =============================== */

.item-thumbnail {
    position: relative;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    display: inline-block;
    margin-right: 8px;
    vertical-align: middle;
    border-radius: 6px;
    border: 1px solid rgba(229, 189, 100, 0.3);
    background: rgba(10, 26, 20, 0.5);
    cursor: help;
    transition: all 0.2s ease;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.item-thumbnail:hover {
    border-color: rgba(229, 189, 100, 0.8);
    box-shadow: 0 0 12px rgba(229, 189, 100, 0.3);
    transform: scale(1.1);
}

/* =============================== */
/* TOOLTIP - CSS PURO */
/* =============================== */

.item-thumbnail::after {
    content: attr(data-title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    opacity: 0;
    pointer-events: none;
    z-index: 1000;
    
    /* Styling */
    background: linear-gradient(135deg, rgba(13, 56, 36, 0.95), rgba(20, 70, 45, 0.95));
    border: 1px solid rgba(229, 189, 100, 0.4);
    border-radius: 8px;
    padding: 8px 12px;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
    color: var(--eden-gold-light, #fff0a8);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    
    /* Animação */
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.item-thumbnail::before {
    content: attr(data-description);
    position: absolute;
    bottom: calc(100% + 32px);
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    opacity: 0;
    pointer-events: none;
    z-index: 1001;
    
    /* Styling */
    background: linear-gradient(135deg, rgba(13, 56, 36, 0.98), rgba(20, 70, 45, 0.98));
    border: 1px solid rgba(229, 189, 100, 0.5);
    border-radius: 8px;
    padding: 10px 14px;
    width: 200px;
    max-width: 200px;
    font-size: 11px;
    color: var(--eden-text-secondary, #c9b5a0);
    line-height: 1.5;
    white-space: normal;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    word-wrap: break-word;
    
    /* Animação */
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* SETA DO TOOLTIP (opcional) */
.item-thumbnail::after::marker {
    content: "";
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(13, 56, 36, 0.95);
}

/* =============================== */
/* TOOLTIP ATIVO (HOVER) */
/* =============================== */

.item-thumbnail:hover::after,
.item-thumbnail:focus::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    pointer-events: auto;
}

.item-thumbnail:hover::before,
.item-thumbnail:focus::before {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    pointer-events: auto;
}

/* =============================== */
/* VARIAÇÃO: TOOLTIP GRANDE */
/* Para descrições longas */
/* =============================== */

.item-thumbnail.tooltip-large::before {
    width: 280px;
    max-width: 280px;
    font-size: 12px;
    padding: 12px 16px;
}

/* =============================== */
/* VARIAÇÃO: SEM DESCRIÇÃO */
/* Apenas título */
/* =============================== */

.item-thumbnail.tooltip-title-only::before {
    display: none;
}

/* =============================== */
/* VARIAÇÃO: COLORIDA */
/* Diferentes cores por rarity */
/* =============================== */

/* Comum (cinza) */
.item-thumbnail.rarity-common::after {
    color: #a8a8a8;
    border-color: rgba(168, 168, 168, 0.3);
}

/* Raro (azul) */
.item-thumbnail.rarity-rare::after {
    color: #66b3ff;
    border-color: rgba(102, 179, 255, 0.3);
}

/* Épico (roxo) */
.item-thumbnail.rarity-epic::after {
    color: #cc66ff;
    border-color: rgba(204, 102, 255, 0.3);
}

/* Lendário (ouro) */
.item-thumbnail.rarity-legendary::after {
    color: #fff0a8;
    border-color: rgba(255, 240, 168, 0.3);
}

/* =============================== */
/* VARIAÇÃO: POSIÇÃO DO TOOLTIP */
/* =============================== */

/* Tooltip abaixo */
.item-thumbnail.tooltip-bottom::after {
    bottom: auto;
    top: calc(100% + 8px);
}

.item-thumbnail.tooltip-bottom::before {
    bottom: auto;
    top: calc(100% + 32px);
}

/* Tooltip à esquerda */
.item-thumbnail.tooltip-left::after {
    left: auto;
    right: calc(100% + 8px);
    transform: translateY(-50%);
}

.item-thumbnail.tooltip-left:hover::after {
    transform: translateY(-50%) scale(1);
}

/* Tooltip à direita */
.item-thumbnail.tooltip-right::after {
    left: calc(100% + 8px);
    transform: translateY(-50%);
}

.item-thumbnail.tooltip-right:hover::after {
    transform: translateY(-50%) scale(1);
}

/* =============================== */
/* EFEITO BRILHO - RARITY */
/* =============================== */

.item-thumbnail.rarity-legendary {
    background: rgba(229, 189, 100, 0.15);
    animation: legendary-glow 2s ease-in-out infinite;
}

@keyframes legendary-glow {
    0%, 100% {
        box-shadow: 0 0 8px rgba(229, 189, 100, 0.3);
    }
    50% {
        box-shadow: 0 0 16px rgba(229, 189, 100, 0.6);
    }
}

.item-thumbnail.rarity-epic {
    animation: epic-glow 2s ease-in-out infinite;
}

@keyframes epic-glow {
    0%, 100% {
        box-shadow: 0 0 8px rgba(204, 102, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 16px rgba(204, 102, 255, 0.6);
    }
}

/* =============================== */
/* RESPONSIVO */
/* =============================== */

@media (max-width: 720px) {
    .item-thumbnail {
        width: 28px;
        height: 28px;
        min-width: 28px;
        min-height: 28px;
    }

    .item-thumbnail::after {
        font-size: 11px;
        padding: 6px 10px;
        bottom: calc(100% + 6px);
    }

    .item-thumbnail::before {
        width: 180px;
        max-width: 180px;
        font-size: 10px;
        padding: 8px 12px;
        bottom: calc(100% + 28px);
    }

    .item-thumbnail.tooltip-large::before {
        width: 200px;
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    .item-thumbnail {
        width: 24px;
        height: 24px;
        min-width: 24px;
        min-height: 24px;
        margin-right: 6px;
    }

    .item-thumbnail::after {
        font-size: 10px;
        padding: 5px 8px;
        bottom: calc(100% + 4px);
        white-space: normal;
        width: 150px;
        max-width: 150px;
    }

    .item-thumbnail::before {
        width: 160px;
        max-width: 160px;
        font-size: 9px;
        padding: 6px 10px;
        bottom: calc(100% + 24px);
    }
}

/* =============================== */
/* ACESSIBILIDADE */
/* =============================== */

.item-thumbnail:focus {
    outline: 2px solid rgba(229, 189, 100, 0.6);
    outline-offset: 2px;
}

/* Usuários que preferem sem animação */
@media (prefers-reduced-motion: reduce) {
    .item-thumbnail {
        transition: none;
    }

    .item-thumbnail::after,
    .item-thumbnail::before {
        transition: none;
    }

    .item-thumbnail:hover {
        transform: none;
    }

    .item-thumbnail.rarity-legendary {
        animation: none;
    }

    .item-thumbnail.rarity-epic {
        animation: none;
    }
}

/* Dark mode (Se aplicável) */
@media (prefers-color-scheme: dark) {
    .item-thumbnail::after,
    .item-thumbnail::before {
        background: linear-gradient(135deg, rgba(5, 20, 15, 0.95), rgba(10, 30, 20, 0.95));
        color: var(--eden-text, #f4ead0);
    }
}

/* =============================== */
/* CONTAINER - Opcional */
/* Para alinhar itens */
/* =============================== */

.items-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.item-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}
.eden-item-hover {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}

.eden-item-hover img {
    width: 28px;
    height: 28px;
    image-rendering: pixelated;
    cursor: pointer;
    transition: transform .2s ease;
}

.eden-item-hover:hover img {
    transform: scale(1.12);
}

/* Caixa principal */
.eden-item-hover::after {
    content: attr(data-title) "\A" attr(data-desc);
    white-space: pre-line;

    position: absolute;
    left: 50%;
    bottom: calc(100% + 12px);

    transform: translateX(-50%) translateY(8px);
    opacity: 0;
    visibility: hidden;

    width: 260px;
    padding: 12px 14px;

    background: linear-gradient(
        180deg,
        rgba(7, 31, 20, 0.98),
        rgba(3, 16, 10, 0.98)
    );

    border: 1px solid rgba(229,189,100,.35);
    border-radius: 12px;

    color: #d8d0b2;
    font-size: 13px;
    line-height: 1.45;

    box-shadow:
        0 12px 25px rgba(0,0,0,.55),
        0 0 20px rgba(229,189,100,.15);

    transition: .25s ease;
    z-index: 9999;
}

/* Seta */
.eden-item-hover::before {
    content: "";

    position: absolute;
    left: 50%;
    bottom: calc(100% + 4px);

    transform: translateX(-50%) translateY(8px);

    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid rgba(229,189,100,.35);

    opacity: 0;
    visibility: hidden;

    transition: .25s ease;
    z-index: 9999;
}

.eden-item-hover:hover::after,
.eden-item-hover:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}
.eden-item-hover::after {
    color: #d6d0b5;
}

.eden-item-hover[data-title]::after {
    font-weight: 500;
}
.eden-item-hover::after {
    color: #d6d0b5;
}

.eden-item-hover[data-title]::after {
    font-weight: 500;
}