/* Contenedor principal */
.tibia-monster-container {
    max-width: 800px;
    margin: 0;
    padding: 10px;
    animation: fadeIn 0.5s ease-in-out;
}

/* ====
   BANNER DE CARGA - SPINNER
   ==== */
.tibia-monster-loading-banner {
    background: #ffff;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.tibia-monster-spinner-wrapper {
    display: inline-block;
    margin-bottom: 10px;
}

.tibia-monster-loading-banner h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

/* Animación del spinner */
@keyframes tibia-monster-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Estilos para el spinner de carga */
.tibia-monster-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(49,67,226,0.4);
    border-top-color: #3143e2;
    border-radius: 50%;
    animation: tibia-monster-spin 1s linear infinite;
    margin: 0 auto;
}

/* Contenedor AJAX wrapper */
.tibia-monster-ajax-wrapper {
    margin: 0 auto;
}

/* Layout principal: imagen a la izquierda, info a la derecha */
.tibia-monster-content {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
}

/* Imagen del monster */
.tibia-monster-image-wrapper {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.tibia-monster-image {
    max-width: 100%;
    max-height: 100%;
    width: 64px;
    height: 64px;
    margin-bottom: 0 !important;
    object-fit: contain;
    image-rendering: pixelated;
}

/* Información del monster (derecha) */
.tibia-monster-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Nombre del monster */
.tibia-monster-title {
    font-size: 15px;
    font-weight: bold;
    margin: 0;
    letter-spacing: 1px;
    text-align: left;
    line-height: 20px;
}

/* Tipo de monstruo */
.tibia-monster-type {
    font-size: 12px;
    margin: 2px 0;
    text-align: left;
}

/* Monster Points, Experience y Health en la misma línea */
.tibia-monster-stats {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    padding: 5px 0;
    align-items: center;
}

.tibia-monster-stats .stat-group {
    display: flex;
    align-items: center;
    gap: 3px;
}

.tibia-monster-stats .stat-icon {
    object-fit: contain;
    height: 12px;
    width: 12px;
    margin-bottom: 0 !important;
    transition: transform 0.2s ease;
}

.tibia-monster-stats .stat-icon:hover {
    transform: scale(1.15);
}

.tibia-monster-stats .stat-value {
    font-size: 12px;
    color: #3143e2;
    font-weight: bold;
}

.tibia-monster-stats .stat-separator {
    font-weight: normal;
}

/* Difficulty */
.tibia-monster-difficulty {
    font-size: 12px;
    text-align: left;
}

.difficulty-label {
    font-weight: bold;
}

.difficulty-value {
}

/* ============================================
   CAJA DE ELEMENTOS (3 COLUMNAS)
   ============================================ */

/* Caja unificada de elementos */
.tibia-monster-elements-box {
    margin-top: 5px;
    width: 100%;
    overflow: hidden;
}

/* Grid de 3 columnas para elementos */
.elements-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    width: 100%;
}

/* Columna de elementos */
.element-column {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 5px 0;
    min-width: 0;
}

/* Título de cada columna */
.element-title {
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 5px;
    text-align: center;
}

/* Fuerte (0-99%) - Rojo */
.strong-title {
    background: rgba(255, 107, 107, 0.3);
    color: #ff6b6b;
    border-bottom: 2px solid #ff6b6b;
}

/* Neutral (100%) - Blanco */
.neutral-title {
    background: rgba(150, 150, 150, 0.3);
    color: #808080;
    border-bottom: 2px solid #808080;
}

/* Débil (>100%) - Verde */
.weak-title {
    background: rgba(0, 204, 0, 0.3);
    color: #00cc00;
    border-bottom: 2px solid #00cc00;
}

/* Iconos de elementos */
.element-icons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    min-height: 30px;
}

.element-icon {
    object-fit: contain;
    transition: transform 0.2s ease;
    width: 12px;
    height: 12px;
    cursor: pointer;
    image-rendering: pixelated;
    margin-bottom: 0 !important;
}

.element-icon:hover {
    transform: scale(1.2);
}

/* ============================================
   TOOLTIP PERSONALIZADO CON JS
   ============================================ */

.element-wrapper {
    position: relative;
    display: inline-block;
    cursor: pointer;
    padding: 8px; 
    margin: -8px; 
}

.tibia-tooltip {
    position: absolute;
    display: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    transform-origin: center bottom;
}

.tibia-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: inherit;
}

/* ============================================
   BOTÓN DE GUÍA COMPLETA
   ============================================ */

.tibia-guide-button-wrapper {
    margin-top: 10px;
    width: 100%;
}

.tibia-guide-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 5px 10px;
    background: #dddddd;
    color: black;
    text-decoration: none;
    border-radius: 5px;
    border-left: 3px solid #3143e2;
    font-size: 12px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    width: 100%;
}

.tibia-guide-button:hover::before {
    left: 100%;
}

.tibia-guide-button:hover {
    color: #3143e2;
    text-decoration: none;
}

.guide-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ============================================
   MENSAJES DE ERROR
   ============================================ */
   
/* Mensajes de error */
.tibia-monster-error {
    background: rgba(139, 0, 0, 0.2);
    border: 2px solid #8b0000;
    border-radius: 8px;
    padding: 20px;
}

.tibia-monster-error-text {
    color: #ff6b6b;
    text-align: center;
    font-size: 16px;
    margin: 0;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablets y móviles - Apilar columnas */
@media (max-width: 768px) {
    .tibia-monster-container {
        padding: 10px;
        max-width: 100%;
    }

    .tibia-monster-content {
        flex-direction: column;
        align-items: center;
    }

    .tibia-monster-title {
        font-size: 15px;
        text-align: center;
    }

    .tibia-monster-type {
        font-size: 12px;
        margin: 2px 0;
        text-align: center;
    }

    .tibia-monster-stats {
        justify-content: center;
    }

    .tibia-monster-difficulty {
        font-size: 12px;
        text-align: center;
    }

    /* CAMBIO IMPORTANTE: Forzar 1 columna en tablets */
    .elements-grid {
        grid-template-columns: 1fr !important;
        gap: 10px;
        max-width: 100%;
    }

    .element-column {
        width: 100%;
        max-width: 100%;
    }

    .element-title {
        font-size: 13px;
    }

    .guide-icon {
        width: 18px;
        height: 18px;
    }
}

/* Móviles pequeños */
@media (max-width: 480px) {
    .tibia-monster-container {
        padding: 10px;
        margin: 5px;
        max-width: 100%;
    }

    .tibia-monster-title {
        font-size: 14px;
    }

    .tibia-monster-type {
        font-size: 11px;
        text-align: center;
    }

    .tibia-monster-stats {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
    }

    .tibia-monster-stats .stat-icon {
        width: 12px;
        height: 12px;
    }

    /* Asegurar 1 columna en móviles */
    .elements-grid {
        grid-template-columns: 1fr !important;
        gap: 8px;
    }

    .element-title {
        font-size: 12px;
        padding: 3px 6px;
    }

    .element-icons {
        gap: 4px;
    }

    .element-icon {
        width: 14px;
        height: 14px;
    }

    .tibia-guide-button {
        font-size: 13px;
        padding: 8px 12px;
        gap: 8px;
    }

    .guide-icon {
        width: 16px;
        height: 16px;
    }
}

/* ============================================
   ANIMACIONES
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar personalizado para contenido largo */
.tibia-monster-container::-webkit-scrollbar {
    width: 8px;
}

.tibia-monster-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.tibia-monster-container::-webkit-scrollbar-thumb {
    background: #d4af37;
    border-radius: 4px;
}

.tibia-monster-container::-webkit-scrollbar-thumb:hover {
    background: #ffd700;
}