/* LOGO GALLERY STYLES - VERSIÓN CORREGIDA PARA TOOLTIPS SIEMPRE VISIBLES */
.logo-gallery {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    margin: 3rem 0;
    padding: 2rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    /* CRÍTICO: Añadir espacio extra abajo para tooltips */
    margin-bottom: 5rem;
    /* CRÍTICO: Permitir que los tooltips se vean */
    position: relative;
    z-index: 1;
}

.logo-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    min-height: 140px;
    width: calc(25% - 1.5rem);
    max-width: 200px;
    min-width: 150px;
    position: relative;
    cursor: pointer;
    /* CAMBIO CRÍTICO: Remover overflow hidden */
    overflow: visible !important;
    z-index: 2;
    margin-bottom: 1.5rem;
}

/* Normalizar tamaño de todas las imágenes */
.logo-item img {
    width: 140px;
    height: auto;
    object-fit: contain;
    object-position: center;
    filter: grayscale(30%) opacity(0.8);
    transition: all 0.3s ease;
    display: block;
}

/* HOVER STATE - Z-INDEX MÁS ALTO */
.logo-item:hover,
.logo-item.clicked {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.2);
    background: linear-gradient(135deg, #fff, #f8f8f8);
    /* CRÍTICO: Z-index muy alto en hover */
    z-index: 9999 !important;
}

.logo-item.clicked {
    /* Mantener el estado elevado cuando está clicked */
    box-shadow: 0 12px 30px rgba(196, 165, 95, 0.3);
    background: linear-gradient(135deg, #fff, #fefdf8);
}

.logo-item:hover img,
.logo-item.clicked img {
    filter: grayscale(0%) opacity(1);
    transform: scale(1.1);
}

/* TOOLTIP - Z-INDEX EXTREMADAMENTE ALTO */
.logo-item::after {
    content: attr(data-company);
    position: absolute;
    bottom: -45px; /* Más separación */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.95); /* Más opaco */
    color: white;
    padding: 10px 16px; /* Más padding */
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600; /* Más bold */
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    /* Z-INDEX CRÍTICO */
    z-index: 99999 !important;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    /* Asegurar ancho máximo para textos largos */
    max-width: 250px;
    white-space: normal;
    text-align: center;
    line-height: 1.3;
}

/* FLECHA DEL TOOLTIP */
.logo-item::before {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid rgba(0, 0, 0, 0.95);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 99998 !important;
}

/* ESTADOS DE HOVER Y CLICK PARA MOSTRAR TOOLTIP */
.logo-item:hover::after,
.logo-item.clicked::after {
    opacity: 1;
    visibility: visible;
    bottom: -40px; /* Posición final */
}

.logo-item:hover::before,
.logo-item.clicked::before {
    opacity: 1;
    visibility: visible;
    bottom: -12px; /* Flecha más cerca del tooltip */
}

/* ESTADO ACTIVO (CLICKED) - COLOR DIFERENTE PARA DISTINGUIR */
.logo-item.clicked::after {
    background: rgba(251, 251, 251, 0.95); /* Color dorado de PLACON */
    border-color: rgba(196, 165, 95, 0.95);
}

.logo-item.clicked::before {
    border-bottom-color: rgba(196, 165, 95, 0.95);
}

/* SOPORTE PARA NAVEGACIÓN CON TECLADO */
.logo-item:focus {
    outline: 2px solid #C4A55F;
    outline-offset: 2px;
}

.logo-item:focus::after,
.logo-item:focus::before {
    opacity: 1;
    visibility: visible;
}

.logo-item:focus::after {
    bottom: -40px;
}

.logo-item:focus::before {
    bottom: -12px;
}

/* Animation for logo items */
.logo-item {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
    animation-delay: calc(var(--order, 1) * 0.1s);
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments */
@media screen and (max-width: 1024px) {
    .logo-item {
        width: calc(33.333% - 1.33rem);
    }
    
    .logo-gallery {
        margin-bottom: 4rem;
    }
}

@media screen and (max-width: 768px) {
    .logo-gallery {
        gap: 1.5rem;
        padding: 1.5rem;
        margin-bottom: 4rem;
    }
    
    .logo-item {
        width: calc(50% - 0.75rem);
        padding: 1rem;
        min-height: 120px;
        /* Asegurar overflow visible en móvil también */
        overflow: visible !important;
    }
    
    .logo-item::after {
        font-size: 0.8rem;
        padding: 8px 12px;
        max-width: 200px;
        bottom: -35px;
    }
    
    .logo-item:hover::after,
    .logo-item.clicked::after {
        bottom: -30px;
    }
    
    .logo-item:hover::before,
    .logo-item.clicked::before {
        bottom: -10px;
    }
}

@media screen and (max-width: 480px) {
    .logo-item {
        width: 100%;
        max-width: 280px;
        /* Mantener overflow visible */
        overflow: visible !important;
    }
    
    .logo-gallery {
        gap: 1rem;
        padding: 1rem;
        margin-bottom: 4rem;
    }
    
    .logo-item::after {
        max-width: 180px;
        font-size: 0.75rem;
    }
}

/* Ajuste para pantallas muy grandes */
@media screen and (min-width: 1400px) {
    .logo-gallery {
        max-width: 1400px;
        margin-bottom: 6rem;
    }
    
    .logo-item {
        width: calc(20% - 1.6rem);
    }
}