/* Fix para imágenes de Instagram/Portfolio */

.instagram-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.instagram-item {
    position: relative;
    background: #f5f5f5;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 1;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.instagram-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
}

.instagram-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Imagen de respaldo mientras carga */
.instagram-item img::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #FF6B6B 0%, #4ECDC4 100%);
    z-index: -1;
}

/* Overlay mejorado */
.instagram-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.7) 50%, transparent 100%);
    padding: 20px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    color: white;
}

.instagram-item:hover .instagram-overlay {
    transform: translateY(0);
}

.instagram-caption {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.instagram-date {
    font-size: 12px;
    opacity: 0.8;
    display: block;
    margin-bottom: 10px;
}

.instagram-link {
    color: #4ECDC4;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: color 0.3s ease;
}

.instagram-link:hover {
    color: #FF6B6B;
}

.instagram-link::after {
    content: '→';
    font-size: 16px;
}

/* Loading placeholder */
.instagram-item.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Filtros mejorados */
.filter-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 20px;
    border: 2px solid #FF6B6B;
    background: white;
    color: #FF6B6B;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 14px;
}

.filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255,107,107,0.3);
}

.filter-btn.active {
    background: #FF6B6B;
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .instagram-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .instagram-overlay {
        padding: 15px;
        transform: translateY(0);
        background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
    }
    
    .instagram-caption {
        font-size: 12px;
        -webkit-line-clamp: 2;
    }
    
    .filter-buttons {
        gap: 5px;
    }
    
    .filter-btn {
        padding: 8px 15px;
        font-size: 12px;
    }
}

/* Fix para imágenes que no cargan */
.instagram-item img[src=""],
.instagram-item img:not([src]),
.instagram-item img[src*="undefined"] {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #FF6B6B 0%, #4ECDC4 100%);
    position: relative;
}

.instagram-item img[src=""]::after,
.instagram-item img:not([src])::after,
.instagram-item img[src*="undefined"]::after {
    content: 'Grabaditos RD';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}