/* Стили для ссылок на предметы */
.poe-item-link {
    color: #af6025;
    text-decoration: none !important;
    box-shadow: none !important;
    border: none !important;
    border-bottom: none !important;
    cursor: pointer;
    transition: color 0.2s;
    position: relative;
    display: inline;
}

.poe-item-link:hover {
    color: #ff9800 !important;
}

/* Иконки в ссылках */
.poe-item-link .poe-item-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    vertical-align: -3px;
    display: inline-block;
    margin-right: 4px;
}

/* Иконки в карточках Gutenberg */
.poe-gutenberg-item-icon {
    width: 32px;
    height: 32px;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.poe-gutenberg-item-header {
    display: flex;
    align-items: center;
}

/* Цвета в зависимости от редкости */
.poe-item-link[data-rarity="normal"] {
    color: #c8c8c8 !important;
}

.poe-item-link[data-rarity="magic"] {
    color: #8888ff !important;
}

.poe-item-link[data-rarity="rare"] {
    color: #ffff77 !important;
}

.poe-item-link[data-rarity="unique"] {
    color: #af6025 !important;
}

.poe-item-link[data-rarity="gem"] {
    color: #1aa29b !important;
}

.poe-item-link[data-rarity="currency"] {
    color: #aa9e82 !important;
}

/* Контейнер для центрированного контента */
.poe-tooltip-content-centered {
    text-align: center;
}

.poe-tooltip-content-centered .poe-tooltip-name {
    font-size: 1.2em;
    font-weight: bold;
    word-wrap: break-word;
}

.poe-tooltip-content-centered .poe-tooltip-name-en {
    color: #7f7f7f;
    font-size: 0.85em;
    margin-top: 2px;
}

.poe-tooltip-content-centered .poe-tooltip-type {
    color: #7f7f7f;
    font-size: 0.9em;
    margin-bottom: 10px;
    margin-top: 5px;
}

/* Контейнер тултипа */
.poe-tooltip {
    position: absolute;
    background-color: #0a0a0a;
    border: 2px solid #8b4513;
    border-radius: 4px;
    padding: 15px;
    min-width: 300px;
    max-width: 400px;
    z-index: 999999;
    pointer-events: auto;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.9);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #d4d4d4;
}

/* Цвета границ в зависимости от редкости */
.poe-tooltip[data-rarity="normal"] {
    border-color: #c8c8c8;
}

.poe-tooltip[data-rarity="magic"] {
    border-color: #8888ff;
}

.poe-tooltip[data-rarity="rare"] {
    border-color: #ffff77;
}

.poe-tooltip[data-rarity="unique"] {
    border-color: #af6025;
}

.poe-tooltip[data-rarity="gem"] {
    border-color: #1aa29b;
}

.poe-tooltip[data-rarity="currency"] {
    border-color: #aa9e82;
}

.poe-tooltip.hidden {
    display: none;
}

/* Загрузка */
.poe-tooltip.loading {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.poe-tooltip-loader {
    border: 3px solid #333;
    border-top: 3px solid #ff9800;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: poe-spin 1s linear infinite;
}

@keyframes poe-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Заголовок тултипа */
.poe-tooltip-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #444;
}

.poe-tooltip-icon {
    width: 64px;
    height: 64px;
    margin-right: 12px;
    background-color: #2a2a2a;
    border: 1px solid #555;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.poe-tooltip-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 3px;
}

.poe-tooltip-names {
    flex: 1;
    min-width: 0;
}

.poe-tooltip-name {
    font-size: 1.2em;
    font-weight: bold;
    word-wrap: break-word;
}

.poe-tooltip-name-en {
    color: #7f7f7f;
    font-size: 0.85em;
    margin-top: 2px;
}

/* Цвета названий по редкости */
.poe-tooltip-name.normal {
    color: #c8c8c8;
}

.poe-tooltip-name.magic {
    color: #8888ff;
}

.poe-tooltip-name.rare {
    color: #ffff77;
}

.poe-tooltip-name.unique {
    color: #af6025;
}

.poe-tooltip-name.gem {
    color: #1aa29b;
}

.poe-tooltip-name.currency {
    color: #aa9e82;
}

/* Тип предмета */
.poe-tooltip-type {
    color: #7f7f7f;
    font-size: 0.9em;
    margin-bottom: 10px;
}

/* Разделитель */
.poe-tooltip-separator {
    height: 1px;
    background-color: #444;
    margin: 10px 0;
}

/* Характеристики */
.poe-tooltip-stats {
    margin-bottom: 5px;
}

.poe-tooltip-stat {
    color: #8888ff;
    margin-bottom: 5px;
    line-height: 1.4;
}

/* Характеристики для камней, талантов и пантеона в PoE стиле должны быть белыми */
.poe-tooltip[data-rarity="gem"] .poe-tooltip-stat,
.poe-tooltip[data-rarity="passive"] .poe-tooltip-stat,
.poe-tooltip[data-rarity="ascendancy"] .poe-tooltip-stat,
.poe-tooltip[data-rarity="pantheon"] .poe-tooltip-stat {
    color: #ffffff;
}

/* Описание */
.poe-tooltip-description {
    color: #d4d4d4;
    font-style: italic;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #444;
    line-height: 1.5;
}

/* Описание для династических камней */
.poe-tooltip-gem-lineage-description {
    color: #baad85;
    font-style: italic;
    margin-top: 10px;
    margin-bottom: 5px;
    line-height: 1.5;
}

/* Требования */
.poe-tooltip-requirement {
    color: #7f7f7f;
    font-size: 0.85em;
    margin-top: 10px;
}

/* Стили для камней */
.poe-tooltip-gem-support {
    color: #1aa29b;
    font-weight: bold;
    margin-bottom: 8px;
    text-align: center;
    padding: 5px;
    background-color: rgba(26, 162, 155, 0.1);
    border-radius: 3px;
}

.poe-tooltip-gem-level,
.poe-tooltip-gem-multiplier,
.poe-tooltip-gem-cooldown {
    color: #d4d4d4;
    margin-bottom: 5px;
}

.poe-tooltip-gem-tags {
    color: #7f7f7f;
    font-size: 0.9em;
    margin-bottom: 10px;
    font-style: italic;
}

.poe-tooltip-gem-quality {
    color: #ffffff;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #444;
    line-height: 1.5;
}

.poe-tooltip-gem-quality strong {
    color: #1aa29b;
}

/* Стили для экипировки */
.poe-tooltip-equipment-stat {
    color: #d4d4d4;
    margin-bottom: 5px;
}

.poe-tooltip-equipment-requirements {
    color: #7f7f7f;
    font-size: 0.9em;
    margin-top: 5px;
    margin-bottom: 5px;
}

.poe-tooltip-flavor-text {
    color: #af6025;
    font-style: italic;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #444;
    line-height: 1.5;
}

.poe-tooltip-implicit-mod {
    color: #8888ff;
    margin-top: 10px;
    margin-bottom: 10px;
    font-weight: 500;
}

/* Стили для валюты */
.poe-tooltip-currency-stack {
    color: #d4d4d4;
    margin-bottom: 10px;
    font-size: 0.9em;
}

.poe-tooltip-currency-effect {
    color: #ffffff;
    margin-bottom: 10px;
    line-height: 1.5;
}

.poe-tooltip-currency-usage {
    color: #7f7f7f;
    font-size: 0.85em;
    margin-top: 10px;
    line-height: 1.5;
    font-style: italic;
}

/* Стили для связанных свойств рун */
.poe-tooltip-bonded-mod {
    color: #a3ffb4;
    margin-top: 5px;
    margin-bottom: 5px;
    font-weight: 500;
    text-shadow: 0 0 6px rgba(163, 255, 180, 0.4);
}

/* Стили для талантов */
.poe-tooltip-talent-metadata {
    color: #7f7f7f;
    font-size: 0.9em;
    margin-top: 5px;
    margin-bottom: 0;
}

.poe-tooltip-note {
    color: #7f7f7f;
    font-size: 0.85em;
    font-style: italic;
    margin-top: 10px;
    line-height: 1.5;
}

.poe-tooltip-name.passive {
    color: #af6025;
}

.poe-tooltip-name.ascendancy {
    color: #af6025;
}

.poe-tooltip[data-rarity="passive"] {
    border-color: #af6025;
}

.poe-tooltip[data-rarity="ascendancy"] {
    border-color: #af6025;
}

.poe-item-link[data-rarity="passive"] {
    color: #af6025 !important;
}

.poe-item-link[data-rarity="ascendancy"] {
    color: #af6025 !important;
}

/* Стили для пантеона */
.poe-tooltip-name.pantheon {
    color: #af6025;
}

.poe-tooltip[data-rarity="pantheon"] {
    border-color: #af6025;
}

.poe-item-link[data-rarity="pantheon"] {
    color: #af6025 !important;
}

.poe-tooltip-pantheon-subtitle {
    color: #7f7f7f;
    font-size: 0.85em;
    margin-top: 3px;
    line-height: 1.3;
}

.poe-tooltip-pantheon-effect {
    color: #ffffff;
    margin-bottom: 5px;
    line-height: 1.5;
}

.poe-tooltip-pantheon-unlock {
    color: #d4d4d4;
    font-size: 0.9em;
    margin-bottom: 10px;
    line-height: 1.5;
}

.poe-tooltip-pantheon-upgrade {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #444;
}

/* Стили для флаконов */
.poe-tooltip-name.flask {
    color: #c8c8c8;
}

.poe-tooltip-name.unique_flask {
    color: #af6025;
}

.poe-tooltip[data-rarity="flask"] {
    border-color: #c8c8c8;
}

.poe-tooltip[data-rarity="unique_flask"] {
    border-color: #af6025;
}

.poe-item-link[data-rarity="flask"] {
    color: #c8c8c8 !important;
}

.poe-item-link[data-rarity="unique_flask"] {
    color: #af6025 !important;
}

.poe-tooltip-flask-recovery {
    color: #d4d4d4;
    margin-bottom: 5px;
    line-height: 1.5;
}

.poe-tooltip-flask-recovery strong {
    color: #ffffff;
}

.poe-tooltip-flask-stat {
    color: #d4d4d4;
    margin-bottom: 5px;
    line-height: 1.5;
}

.poe-tooltip-flask-requirement {
    color: #7f7f7f;
    font-size: 0.9em;
    margin-top: 10px;
    line-height: 1.5;
}

.poe-tooltip-flask-implicit {
    color: #8888ff;
    margin-top: 10px;
    margin-bottom: 10px;
    font-weight: 500;
}

.poe-tooltip-flask-flavor-text {
    color: #af6025;
    font-style: italic;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #444;
    line-height: 1.5;
}

.poe-tooltip-flask-usage {
    color: #7f7f7f;
    font-size: 0.85em;
    margin-top: 10px;
    line-height: 1.5;
    font-style: italic;
}

/* Адаптивность */
.poe-tooltip-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 999998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.poe-tooltip-backdrop.visible {
    display: block;
    opacity: 1;
}

/* Close button - hidden on desktop */
.poe-tooltip-close {
    display: none;
}

@media (max-width: 768px) {
    body.poe-tooltip-open .poe-tooltip:not(.hidden) {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 90% !important;
        max-width: 380px !important;
        max-height: 80vh !important;
        overflow-y: auto !important;
        z-index: 999999 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        border-radius: 12px !important;
        padding: 20px !important;
        display: block !important;
        animation: poe-tooltip-fade-in 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        background: #0d0d11 !important;
    }
    
    /* Colored shadows representing item rarity */
    body.poe-tooltip-open .poe-tooltip[data-rarity="normal"]:not(.hidden) {
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8), 0 0 15px rgba(200, 200, 200, 0.15) !important;
    }
    body.poe-tooltip-open .poe-tooltip[data-rarity="magic"]:not(.hidden) {
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8), 0 0 15px rgba(136, 136, 255, 0.2) !important;
    }
    body.poe-tooltip-open .poe-tooltip[data-rarity="rare"]:not(.hidden) {
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8), 0 0 15px rgba(255, 255, 119, 0.2) !important;
    }
    body.poe-tooltip-open .poe-tooltip[data-rarity="unique"]:not(.hidden) {
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8), 0 0 15px rgba(175, 96, 37, 0.25) !important;
    }
    body.poe-tooltip-open .poe-tooltip[data-rarity="unique_flask"]:not(.hidden) {
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8), 0 0 15px rgba(175, 96, 37, 0.25) !important;
    }
    body.poe-tooltip-open .poe-tooltip[data-rarity="gem"]:not(.hidden) {
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8), 0 0 15px rgba(26, 162, 155, 0.2) !important;
    }
    
    body.poe-tooltip-open .poe-tooltip-close {
        position: absolute;
        top: 12px;
        right: 12px;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.15);
        color: #a0a0a0;
        font-size: 20px;
        font-weight: 300;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s ease;
        z-index: 1001000;
        padding: 0;
        line-height: 1;
    }
    body.poe-tooltip-open .poe-tooltip-close:hover,
    body.poe-tooltip-open .poe-tooltip-close:active {
        background: rgba(255, 255, 255, 0.2);
        color: #fff;
        transform: scale(1.08);
    }
}

@keyframes poe-tooltip-fade-in {
    from {
        opacity: 0;
        transform: translate(-50%, -46%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* ========================================
   Стили для Path of Exile 2
   ======================================== */

/* PoE 2 - более современный дизайн с градиентами */
.poe-tooltip[data-game="poe2"] {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border: 2px solid #4a4a4a;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8), 0 0 20px rgba(74, 74, 74, 0.3);
}

/* PoE 2 - заголовок с градиентом */
.poe-tooltip[data-game="poe2"] .poe-tooltip-header {
    background: linear-gradient(90deg, rgba(74, 74, 74, 0.3) 0%, rgba(74, 74, 74, 0.1) 100%);
    border-bottom: 2px solid #4a4a4a;
}

/* PoE 2 - цвета редкости (такие же как PoE 1) */
.poe-tooltip[data-game="poe2"] .poe-tooltip-name.normal {
    color: #c8c8c8;
}

.poe-tooltip[data-game="poe2"] .poe-tooltip-name.magic {
    color: #8888ff;
}

.poe-tooltip[data-game="poe2"] .poe-tooltip-name.rare {
    color: #ffff77;
}

.poe-tooltip[data-game="poe2"] .poe-tooltip-name.unique {
    color: #af6025;
}

.poe-tooltip[data-game="poe2"] .poe-tooltip-name.gem {
    color: #1aa29b;
}

.poe-tooltip[data-game="poe2"] .poe-tooltip-name.currency {
    color: #aa9e82;
}

/* PoE 2 - характеристики с улучшенным контрастом */
.poe-tooltip[data-game="poe2"] .poe-tooltip-stat {
    color: #b8e986;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* PoE 2 - разделители */
.poe-tooltip[data-game="poe2"] .poe-tooltip-separator {
    background: linear-gradient(90deg, transparent 0%, #4a4a4a 50%, transparent 100%);
    height: 2px;
}

/* PoE 2 - описание */
.poe-tooltip[data-game="poe2"] .poe-tooltip-description {
    color: #9e9e9e;
    font-style: italic;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* PoE 2 - требования */
.poe-tooltip[data-game="poe2"] .poe-tooltip-equipment-requirements {
    color: #9e9e9e;
    background: rgba(74, 74, 74, 0.2);
    border-radius: 4px;
    padding: 8px;
}

/* PoE 2 - камни умений */
.poe-tooltip[data-game="poe2"] .poe-tooltip-gem-support {
    background: linear-gradient(90deg, rgba(107, 157, 255, 0.2) 0%, rgba(107, 157, 255, 0.05) 100%);
    color: #6b9dff;
    font-weight: bold;
    text-shadow: 0 0 6px rgba(107, 157, 255, 0.5);
}

/* PoE 2 - теги камней */
.poe-tooltip[data-game="poe2"] .poe-tooltip-gem-tags {
    color: #9e9e9e;
    background: rgba(74, 74, 74, 0.3);
    border-radius: 4px;
    padding: 6px 10px;
}

/* PoE 2 - закрепленные свойства */
.poe-tooltip[data-game="poe2"] .poe-tooltip-implicit-mod {
    color: #6b9dff;
    text-shadow: 0 0 6px rgba(107, 157, 255, 0.4);
}

/* PoE 2 - флейвор текст */
.poe-tooltip[data-game="poe2"] .poe-tooltip-flavor-text {
    color: #ff9800;
    font-style: italic;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

/* PoE 2 - ссылки на предметы */
.poe-item-link[data-game="poe2"] {
    font-weight: 500;
}

.poe-item-link[data-game="poe2"]:hover {
    text-shadow: 0 0 8px currentColor;
}

/* Стили для разделов Вестников */
.poe-tooltip-section-header {
    color: #7f7f7f;
    font-size: 0.85em;
    font-weight: bold;
    margin-top: 12px;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.poe-tooltip-quality-label {
    color: #1aa29b;
    font-size: 0.85em;
    font-style: italic;
    margin-left: 5px;
}

/* Дополнительные стили для значений характеристик предметов */
.poe-value-white {
    color: #ffffff !important;
}
.poe-value-blue {
    color: #8888ff !important;
}
.poe-value-ele {
    color: #9696ff !important;
}

/* Оскверненные предметы */
.poe-tooltip-corrupted {
    color: #d20000 !important;
}

/* Выделение важных аффиксов в билдах */
.poe-tooltip-stat.poe-tooltip-stat-important {
    color: #ffaa00 !important;
    font-weight: bold;
    text-shadow: 0 0 4px rgba(255, 170, 0, 0.4);
}
.poe-tooltip-stat.poe-tooltip-stat-important::before {
    content: "★ ";
    color: #ffaa00;
    margin-right: 4px;
    font-weight: bold;
}

/* ========================================
   Стили для камней Path of Exile 1
   ======================================== */

.poe-tooltip[data-game="poe1"][data-rarity="gem"] {
    border-color: #1aa29b;
}

.poe-tooltip[data-game="poe1"][data-rarity="gem"] .poe-tooltip-name.gem {
    color: #42d7cb;
}

.poe-tooltip[data-game="poe1"][data-rarity="gem"] .poe-tooltip-name-en {
    color: #8f8165;
}

.poe-tooltip-gem-variant {
    display: inline-block;
    margin: 0 0 8px;
    padding: 3px 9px;
    border-radius: 3px;
    font-size: 0.82em;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
}

.poe-tooltip-gem-variant-awakened {
    color: #fff2b8;
    background: rgba(171, 119, 35, 0.28);
    border: 1px solid rgba(255, 209, 92, 0.55);
    box-shadow: 0 0 10px rgba(255, 174, 44, 0.22);
}

.poe-tooltip-gem-variant-vaal {
    color: #ffcaca;
    background: rgba(124, 19, 25, 0.38);
    border: 1px solid rgba(226, 54, 62, 0.58);
    box-shadow: 0 0 10px rgba(204, 34, 43, 0.22);
}

.poe-tooltip-gem-variant-transfigured {
    color: #d8e5ff;
    background: rgba(74, 83, 132, 0.34);
    border: 1px solid rgba(136, 156, 226, 0.52);
}

.poe-tooltip-gem-variant-exceptional {
    color: #f0dcff;
    background: rgba(100, 55, 142, 0.34);
    border: 1px solid rgba(190, 129, 236, 0.55);
}

.poe-tooltip[data-game="poe1"][data-rarity="gem"] .poe-tooltip-description {
    color: #8f9dff;
    font-style: normal;
    margin: 8px 0 10px;
    padding: 0;
    border-top: 0;
    line-height: 1.45;
    text-shadow: 0 0 6px rgba(88, 117, 207, 0.18);
}

/* ========================================
   Гнезда для рун (Rune Sockets)
   ======================================== */
.poe-item-with-runes {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    vertical-align: middle;
}

.poe-item-runes-container {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    vertical-align: middle;
}

.poe-rune-socket {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid #555;
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.8), 0 1px 3px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease-in-out;
    padding: 0;
    margin: 0;
}

.poe-rune-socket:hover {
    border-color: #ffd700;
    background: rgba(0, 0, 0, 0.65);
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.9), 0 0 6px rgba(255, 215, 0, 0.3);
}

.poe-rune-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    display: block;
}

/* Адаптивный мобильный рендер */
@media (max-width: 480px) {
    .poe-item-with-runes {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .poe-item-runes-container {
        margin-left: 24px;
        margin-top: 2px;
    }
    .poe-rune-socket {
        width: 28px;
        height: 28px;
    }
    .poe-rune-icon {
        width: 22px;
        height: 22px;
    }
}
